iPXE
smsc75xx.h
Go to the documentation of this file.
1 #ifndef _SMSC75XX_H
2 #define _SMSC75XX_H
3 
4 /** @file
5  *
6  * SMSC LAN75xx USB Ethernet driver
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 FILE_SECBOOT ( PERMITTED );
12 
13 #include "smscusb.h"
14 
15 /** Interrupt status register */
16 #define SMSC75XX_INT_STS 0x00c
17 #define SMSC75XX_INT_STS_RDFO_INT 0x00400000UL /**< RX FIFO overflow */
18 #define SMSC75XX_INT_STS_PHY_INT 0x00020000UL /**< PHY interrupt */
19 
20 /** Hardware configuration register */
21 #define SMSC75XX_HW_CFG 0x010
22 #define SMSC75XX_HW_CFG_BIR 0x00000080UL /**< Bulk IN use NAK */
23 #define SMSC75XX_HW_CFG_LRST 0x00000002UL /**< Soft lite reset */
24 
25 /** Interrupt endpoint control register */
26 #define SMSC75XX_INT_EP_CTL 0x038
27 #define SMSC75XX_INT_EP_CTL_RDFO_EN 0x00400000UL /**< RX FIFO overflow */
28 #define SMSC75XX_INT_EP_CTL_PHY_EN 0x00020000UL /**< PHY interrupt */
29 
30 /** Bulk IN delay register */
31 #define SMSC75XX_BULK_IN_DLY 0x03c
32 #define SMSC75XX_BULK_IN_DLY_SET(ticks) ( (ticks) << 0 ) /**< Delay / 16.7ns */
33 
34 /** EEPROM register base */
35 #define SMSC75XX_E2P_BASE 0x040
36 
37 /** Receive filtering engine control register */
38 #define SMSC75XX_RFE_CTL 0x060
39 #define SMSC75XX_RFE_CTL_AB 0x00000400UL /**< Accept broadcast */
40 #define SMSC75XX_RFE_CTL_AM 0x00000200UL /**< Accept multicast */
41 #define SMSC75XX_RFE_CTL_AU 0x00000100UL /**< Accept unicast */
42 
43 /** FIFO controller RX FIFO control register */
44 #define SMSC75XX_FCT_RX_CTL 0x090
45 #define SMSC75XX_FCT_RX_CTL_EN 0x80000000UL /**< FCT RX enable */
46 #define SMSC75XX_FCT_RX_CTL_BAD 0x02000000UL /**< Store bad frames */
47 
48 /** FIFO controller TX FIFO control register */
49 #define SMSC75XX_FCT_TX_CTL 0x094
50 #define SMSC75XX_FCT_TX_CTL_EN 0x80000000UL /**< FCT TX enable */
51 
52 /** MAC receive register */
53 #define SMSC75XX_MAC_RX 0x104
54 #define SMSC75XX_MAC_RX_MAX_SIZE(mtu) ( (mtu) << 16 ) /**< Max frame size */
55 #define SMSC75XX_MAC_RX_MAX_SIZE_DEFAULT \
56  SMSC75XX_MAC_RX_MAX_SIZE ( ETH_FRAME_LEN + 4 /* VLAN */ + 4 /* CRC */ )
57 #define SMSC75XX_MAC_RX_FCS 0x00000010UL /**< FCS stripping */
58 #define SMSC75XX_MAC_RX_EN 0x00000001UL /**< RX enable */
59 
60 /** MAC transmit register */
61 #define SMSC75XX_MAC_TX 0x108
62 #define SMSC75XX_MAC_TX_EN 0x00000001UL /**< TX enable */
63 
64 /** MAC receive address register base */
65 #define SMSC75XX_RX_ADDR_BASE 0x118
66 
67 /** MII register base */
68 #define SMSC75XX_MII_BASE 0x120
69 
70 /** PHY interrupt source MII register */
71 #define SMSC75XX_MII_PHY_INTR_SOURCE 29
72 
73 /** PHY interrupt mask MII register */
74 #define SMSC75XX_MII_PHY_INTR_MASK 30
75 
76 /** PHY interrupt: auto-negotiation complete */
77 #define SMSC75XX_PHY_INTR_ANEG_DONE 0x0040
78 
79 /** PHY interrupt: link down */
80 #define SMSC75XX_PHY_INTR_LINK_DOWN 0x0010
81 
82 /** MAC address perfect filter register base */
83 #define SMSC75XX_ADDR_FILT_BASE 0x300
84 
85 /** Receive packet header */
87  /** RX command word */
89  /** VLAN tag */
91  /** Checksum */
93  /** Two-byte padding used to align Ethernet payload */
95 } __attribute__ (( packed ));
96 
97 /** Receive error detected */
98 #define SMSC75XX_RX_RED 0x00400000UL
99 
100 /** Transmit packet header */
102  /** TX command word */
104  /** VLAN tag */
106  /** Maximum segment size */
108 } __attribute__ (( packed ));
109 
110 /** Insert frame checksum and pad */
111 #define SMSC75XX_TX_FCS 0x00400000UL
112 
113 /** Byte count statistics */
115  /** Unicast byte count */
117  /** Broadcast byte count */
119  /** Multicast byte count */
121 } __attribute__ (( packed ));
122 
123 /** Frame count statistics */
125  /** Unicast frames */
127  /** Broadcast frames */
129  /** Multicast frames */
131  /** Pause frames */
133  /** Frames by length category */
135 } __attribute__ (( packed ));
136 
137 /** Receive error statistics */
139  /** FCS errors */
141  /** Alignment errors */
143  /** Fragment errors */
145  /** Jabber errors */
147  /** Undersize frame errors */
149  /** Oversize frame errors */
151  /** Dropped frame errors */
153 } __attribute__ (( packed ));
154 
155 /** Receive statistics */
157  /** Error statistics */
159  /** Byte count statistics */
161  /** Frame count statistics */
163 } __attribute__ (( packed ));
164 
165 /** Transmit error statistics */
167  /** FCS errors */
169  /** Excess deferral errors */
171  /** Carrier errors */
173  /** Bad byte count */
175  /** Single collisions */
177  /** Multiple collisions */
179  /** Excession collisions */
181  /** Late collisions */
183 } __attribute__ (( packed ));
184 
185 /** Transmit statistics */
187  /** Error statistics */
189  /** Byte count statistics */
191  /** Frame count statistics */
193 } __attribute__ (( packed ));
194 
195 /** Statistics */
197  /** Receive statistics */
199  /** Transmit statistics */
201 } __attribute__ (( packed ));
202 
203 /** Maximum time to wait for reset (in milliseconds) */
204 #define SMSC75XX_RESET_MAX_WAIT_MS 100
205 
206 /** Bulk IN maximum fill level
207  *
208  * This is a policy decision.
209  */
210 #define SMSC75XX_IN_MAX_FILL 8
211 
212 /** Bulk IN buffer size */
213 #define SMSC75XX_IN_MTU \
214  ( sizeof ( struct smsc75xx_rx_header ) + \
215  ETH_FRAME_LEN + 4 /* possible VLAN header */ )
216 
218 
219 extern int smsc75xx_dump_statistics ( struct smscusb_device *smscusb );
220 extern int smsc75xx_transmit ( struct net_device *netdev,
221  struct io_buffer *iobuf );
222 extern void smsc75xx_poll ( struct net_device *netdev );
223 
224 #endif /* _SMSC75XX_H */
uint32_t command
RX command word.
Definition: smsc75xx.h:88
uint32_t pause
Pause frames.
Definition: smsc75xx.h:132
#define __attribute__(x)
Definition: compiler.h:10
unsigned short uint16_t
Definition: stdint.h:11
Transmit error statistics.
Definition: smsc75xx.h:166
Receive error statistics.
Definition: smsc75xx.h:138
uint32_t oversize
Oversize frame errors.
Definition: smsc75xx.h:150
Receive packet header.
Definition: smsc75xx.h:86
uint32_t undersize
Undersize frame errors.
Definition: smsc75xx.h:148
An SMSC USB device.
Definition: smscusb.h:148
struct smsc75xx_tx_error_statistics err
Error statistics.
Definition: smsc75xx.h:188
Transmit packet header.
Definition: smsc75xx.h:101
uint32_t count
Bad byte count.
Definition: smsc75xx.h:174
uint32_t carrier
Carrier errors.
Definition: smsc75xx.h:172
uint32_t unicast
Unicast frames.
Definition: smsc75xx.h:126
uint32_t jabber
Jabber errors.
Definition: smsc75xx.h:146
uint16_t vtag
VLAN tag.
Definition: smsc75xx.h:90
uint16_t tag
VLAN tag.
Definition: smsc75xx.h:105
struct usb_endpoint_driver_operations smsc75xx_in_operations
Bulk IN endpoint operations.
Definition: smsc75xx.c:234
Statistics.
Definition: smsc75xx.h:196
uint32_t multicast
Multicast frames.
Definition: smsc75xx.h:130
uint16_t csum
Checksum.
Definition: smsc75xx.h:92
uint32_t fcs
FCS errors.
Definition: smsc75xx.h:140
uint32_t multicast
Multicast byte count.
Definition: smsc75xx.h:120
uint32_t unicast
Unicast byte count.
Definition: smsc75xx.h:116
uint32_t dropped
Dropped frame errors.
Definition: smsc75xx.h:152
uint32_t deferral
Excess deferral errors.
Definition: smsc75xx.h:170
struct smsc75xx_frame_statistics frame
Frame count statistics.
Definition: smsc75xx.h:192
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static struct net_device * netdev
Definition: gdbudp.c:52
uint32_t command
TX command word.
Definition: smsc75xx.h:103
int smsc75xx_dump_statistics(struct smscusb_device *smscusb)
Dump statistics (for debugging)
Definition: smsc75xx.c:64
uint32_t late
Late collisions.
Definition: smsc75xx.h:182
FILE_SECBOOT(PERMITTED)
A network device.
Definition: netdevice.h:353
SMSC USB Ethernet drivers.
uint32_t broadcast
Broadcast frames.
Definition: smsc75xx.h:128
struct smsc75xx_tx_statistics tx
Transmit statistics.
Definition: smsc75xx.h:200
unsigned int uint32_t
Definition: stdint.h:12
unsigned char byte
Definition: smc9000.h:38
uint16_t mss
Maximum segment size.
Definition: smsc75xx.h:107
struct smsc75xx_rx_statistics rx
Receive statistics.
Definition: smsc75xx.h:198
int smsc75xx_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
Definition: smsc75xx.c:404
struct smsc75xx_frame_statistics frame
Frame count statistics.
Definition: smsc75xx.h:162
uint32_t alignment
Alignment errors.
Definition: smsc75xx.h:142
uint32_t excessive
Excession collisions.
Definition: smsc75xx.h:180
void smsc75xx_poll(struct net_device *netdev)
Poll for completed and received packets.
Definition: smsc75xx.c:420
uint32_t single
Single collisions.
Definition: smsc75xx.h:176
uint32_t broadcast
Broadcast byte count.
Definition: smsc75xx.h:118
uint32_t fragment
Fragment errors.
Definition: smsc75xx.h:144
Byte count statistics.
Definition: smsc75xx.h:114
Transmit statistics.
Definition: smsc75xx.h:186
uint32_t fcs
FCS errors.
Definition: smsc75xx.h:168
USB endpoint driver operations.
Definition: usb.h:489
uint32_t multiple
Multiple collisions.
Definition: smsc75xx.h:178
uint32_t len[7]
Frames by length category.
Definition: smsc75xx.h:134
struct smsc75xx_rx_error_statistics err
Error statistics.
Definition: smsc75xx.h:158
Receive statistics.
Definition: smsc75xx.h:156
uint16_t pad
Two-byte padding used to align Ethernet payload.
Definition: smsc75xx.h:94
A persistent I/O buffer.
Definition: iobuf.h:38
Frame count statistics.
Definition: smsc75xx.h:124