iPXE
smsc95xx.h
Go to the documentation of this file.
1#ifndef _SMSC95XX_H
2#define _SMSC95XX_H
3
4/** @file
5 *
6 * SMSC LAN95xx USB Ethernet driver
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include "smscusb.h"
14
15/** Interrupt status register */
16#define SMSC95XX_INT_STS 0x008
17#define SMSC95XX_INT_STS_RXDF_INT 0x00000800UL /**< RX FIFO overflow */
18#define SMSC95XX_INT_STS_PHY_INT 0x00008000UL /**< PHY interrupt */
19
20/** Transmit configuration register */
21#define SMSC95XX_TX_CFG 0x010
22#define SMSC95XX_TX_CFG_ON 0x00000004UL /**< TX enable */
23
24/** Hardware configuration register */
25#define SMSC95XX_HW_CFG 0x014
26#define SMSC95XX_HW_CFG_BIR 0x00001000UL /**< Bulk IN use NAK */
27#define SMSC95XX_HW_CFG_LRST 0x00000008UL /**< Soft lite reset */
28
29/** LED GPIO configuration register */
30#define SMSC95XX_LED_GPIO_CFG 0x024
31#define SMSC95XX_LED_GPIO_CFG_GPCTL2(x) ( (x) << 24 ) /**< GPIO 2 control */
32#define SMSC95XX_LED_GPIO_CFG_GPCTL2_NSPD_LED \
33 SMSC95XX_LED_GPIO_CFG_GPCTL2 ( 1 ) /**< Link speed LED */
34#define SMSC95XX_LED_GPIO_CFG_GPCTL1(x) ( (x) << 20 ) /**< GPIO 1 control */
35#define SMSC95XX_LED_GPIO_CFG_GPCTL1_NLNKA_LED \
36 SMSC95XX_LED_GPIO_CFG_GPCTL1 ( 1 ) /**< Activity LED */
37#define SMSC95XX_LED_GPIO_CFG_GPCTL0(x) ( (x) << 16 ) /**< GPIO 0 control */
38#define SMSC95XX_LED_GPIO_CFG_GPCTL0_NFDX_LED \
39 SMSC95XX_LED_GPIO_CFG_GPCTL0 ( 1 ) /**< Full-duplex LED */
40
41/** EEPROM register base */
42#define SMSC95XX_E2P_BASE 0x030
43
44/** Interrupt endpoint control register */
45#define SMSC95XX_INT_EP_CTL 0x068
46#define SMSC95XX_INT_EP_CTL_RXDF_EN 0x00000800UL /**< RX FIFO overflow */
47#define SMSC95XX_INT_EP_CTL_PHY_EN 0x00008000UL /**< PHY interrupt */
48
49/** Bulk IN delay register */
50#define SMSC95XX_BULK_IN_DLY 0x06c
51#define SMSC95XX_BULK_IN_DLY_SET(ticks) ( (ticks) << 0 ) /**< Delay / 16.7ns */
52
53/** MAC control register */
54#define SMSC95XX_MAC_CR 0x100
55#define SMSC95XX_MAC_CR_RXALL 0x80000000UL /**< Receive all */
56#define SMSC95XX_MAC_CR_FDPX 0x00100000UL /**< Full duplex */
57#define SMSC95XX_MAC_CR_MCPAS 0x00080000UL /**< All multicast */
58#define SMSC95XX_MAC_CR_PRMS 0x00040000UL /**< Promiscuous */
59#define SMSC95XX_MAC_CR_PASSBAD 0x00010000UL /**< Pass bad frames */
60#define SMSC95XX_MAC_CR_TXEN 0x00000008UL /**< TX enabled */
61#define SMSC95XX_MAC_CR_RXEN 0x00000004UL /**< RX enabled */
62
63/** MAC address register base */
64#define SMSC95XX_ADDR_BASE 0x104
65
66/** MII register base */
67#define SMSC95XX_MII_BASE 0x0114
68
69/** PHY interrupt source MII register */
70#define SMSC95XX_MII_PHY_INTR_SOURCE 29
71
72/** PHY interrupt mask MII register */
73#define SMSC95XX_MII_PHY_INTR_MASK 30
74
75/** PHY interrupt: auto-negotiation complete */
76#define SMSC95XX_PHY_INTR_ANEG_DONE 0x0040
77
78/** PHY interrupt: link down */
79#define SMSC95XX_PHY_INTR_LINK_DOWN 0x0010
80
81/** Receive packet header */
83 /** Command word */
85} __attribute__ (( packed ));
86
87/** Runt frame */
88#define SMSC95XX_RX_RUNT 0x00004000UL
89
90/** Late collision */
91#define SMSC95XX_RX_LATE 0x00000040UL
92
93/** CRC error */
94#define SMSC95XX_RX_CRC 0x00000002UL
95
96/** Transmit packet header */
98 /** Command word */
100 /** Frame length */
102} __attribute__ (( packed ));
103
104/** First segment */
105#define SMSC95XX_TX_FIRST 0x00002000UL
106
107/** Last segment */
108#define SMSC95XX_TX_LAST 0x00001000UL
109
110/** Buffer size */
111#define SMSC95XX_TX_LEN(len) ( (len) << 0 )
112
113/** Receive statistics */
115 /** Good frames */
117 /** CRC errors */
119 /** Runt frame errors */
121 /** Alignment errors */
123 /** Frame too long errors */
125 /** Later collision errors */
127 /** Bad frames */
129 /** Dropped frames */
131} __attribute__ (( packed ));
132
133/** Receive statistics */
134#define SMSC95XX_RX_STATISTICS 0
135
136/** Transmit statistics */
138 /** Good frames */
140 /** Pause frames */
142 /** Single collisions */
144 /** Multiple collisions */
146 /** Excessive collisions */
148 /** Late collisions */
150 /** Buffer underruns */
152 /** Excessive deferrals */
154 /** Carrier errors */
156 /** Bad frames */
158} __attribute__ (( packed ));
159
160/** Transmit statistics */
161#define SMSC95XX_TX_STATISTICS 1
162
163/** Reset delay (in microseconds) */
164#define SMSC95XX_RESET_DELAY_US 2
165
166/** Bulk IN maximum fill level
167 *
168 * This is a policy decision.
169 */
170#define SMSC95XX_IN_MAX_FILL 8
171
172/** Bulk IN buffer size */
173#define SMSC95XX_IN_MTU \
174 ( sizeof ( struct smsc95xx_rx_header ) + \
175 ETH_FRAME_LEN + 4 /* possible VLAN header */ \
176 + 4 /* CRC */ )
177
178/** Honeywell VM3 MAC address OEM string index */
179#define SMSC95XX_VM3_OEM_STRING_MAC 2
180
181#endif /* _SMSC95XX_H */
unsigned int uint32_t
Definition stdint.h:12
#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
#define __attribute__(x)
Definition compiler.h:10
SMSC USB Ethernet drivers.
Receive packet header.
Definition smsc95xx.h:82
uint32_t command
Command word.
Definition smsc95xx.h:84
Receive statistics.
Definition smsc95xx.h:114
uint32_t bad
Bad frames.
Definition smsc95xx.h:128
uint32_t crc
CRC errors.
Definition smsc95xx.h:118
uint32_t alignment
Alignment errors.
Definition smsc95xx.h:122
uint32_t dropped
Dropped frames.
Definition smsc95xx.h:130
uint32_t late
Later collision errors.
Definition smsc95xx.h:126
uint32_t oversize
Frame too long errors.
Definition smsc95xx.h:124
uint32_t good
Good frames.
Definition smsc95xx.h:116
uint32_t undersize
Runt frame errors.
Definition smsc95xx.h:120
Transmit packet header.
Definition smsc95xx.h:97
uint32_t command
Command word.
Definition smsc95xx.h:99
uint32_t len
Frame length.
Definition smsc95xx.h:101
Transmit statistics.
Definition smsc95xx.h:137
uint32_t underrun
Buffer underruns.
Definition smsc95xx.h:151
uint32_t late
Late collisions.
Definition smsc95xx.h:149
uint32_t pause
Pause frames.
Definition smsc95xx.h:141
uint32_t multiple
Multiple collisions.
Definition smsc95xx.h:145
uint32_t bad
Bad frames.
Definition smsc95xx.h:157
uint32_t deferred
Excessive deferrals.
Definition smsc95xx.h:153
uint32_t carrier
Carrier errors.
Definition smsc95xx.h:155
uint32_t single
Single collisions.
Definition smsc95xx.h:143
uint32_t excessive
Excessive collisions.
Definition smsc95xx.h:147
uint32_t good
Good frames.
Definition smsc95xx.h:139