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