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