aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/amd/7990.h
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2013-12-28 15:11:14 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-29 00:46:38 -0500
commita8ab77a83a6e5641182ad0fbf7906671cb4228b7 (patch)
tree7eb42df3c25f24f9f0da777ac04a47c520f48aad /drivers/net/ethernet/amd/7990.h
parentea074b3495a023c2cf969605d51991b2b9df9514 (diff)
net/7990: Fix whitespace errors
Most of them reported by checkpatch.pl Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/amd/7990.h')
-rw-r--r--drivers/net/ethernet/amd/7990.h268
1 files changed, 132 insertions, 136 deletions
diff --git a/drivers/net/ethernet/amd/7990.h b/drivers/net/ethernet/amd/7990.h
index ae33a99bf476..6cf566c3d249 100644
--- a/drivers/net/ethernet/amd/7990.h
+++ b/drivers/net/ethernet/amd/7990.h
@@ -35,33 +35,32 @@
35#define LANCE_LOG_RX_BUFFERS 3 35#define LANCE_LOG_RX_BUFFERS 3
36#endif 36#endif
37 37
38#define TX_RING_SIZE (1<<LANCE_LOG_TX_BUFFERS) 38#define TX_RING_SIZE (1 << LANCE_LOG_TX_BUFFERS)
39#define RX_RING_SIZE (1<<LANCE_LOG_RX_BUFFERS) 39#define RX_RING_SIZE (1 << LANCE_LOG_RX_BUFFERS)
40#define TX_RING_MOD_MASK (TX_RING_SIZE - 1) 40#define TX_RING_MOD_MASK (TX_RING_SIZE - 1)
41#define RX_RING_MOD_MASK (RX_RING_SIZE - 1) 41#define RX_RING_MOD_MASK (RX_RING_SIZE - 1)
42#define TX_RING_LEN_BITS ((LANCE_LOG_TX_BUFFERS) << 29) 42#define TX_RING_LEN_BITS ((LANCE_LOG_TX_BUFFERS) << 29)
43#define RX_RING_LEN_BITS ((LANCE_LOG_RX_BUFFERS) << 29) 43#define RX_RING_LEN_BITS ((LANCE_LOG_RX_BUFFERS) << 29)
44#define PKT_BUFF_SIZE (1544) 44#define PKT_BUFF_SIZE (1544)
45#define RX_BUFF_SIZE PKT_BUFF_SIZE 45#define RX_BUFF_SIZE PKT_BUFF_SIZE
46#define TX_BUFF_SIZE PKT_BUFF_SIZE 46#define TX_BUFF_SIZE PKT_BUFF_SIZE
47 47
48/* Each receive buffer is described by a receive message descriptor (RMD) */ 48/* Each receive buffer is described by a receive message descriptor (RMD) */
49struct lance_rx_desc { 49struct lance_rx_desc {
50 volatile unsigned short rmd0; /* low address of packet */ 50 volatile unsigned short rmd0; /* low address of packet */
51 volatile unsigned char rmd1_bits; /* descriptor bits */ 51 volatile unsigned char rmd1_bits; /* descriptor bits */
52 volatile unsigned char rmd1_hadr; /* high address of packet */ 52 volatile unsigned char rmd1_hadr; /* high address of packet */
53 volatile short length; /* This length is 2s complement (negative)! 53 volatile short length; /* This length is 2s complement (negative)!
54 * Buffer length 54 * Buffer length */
55 */ 55 volatile unsigned short mblength; /* Actual number of bytes received */
56 volatile unsigned short mblength; /* Actual number of bytes received */
57}; 56};
58 57
59/* Ditto for TMD: */ 58/* Ditto for TMD: */
60struct lance_tx_desc { 59struct lance_tx_desc {
61 volatile unsigned short tmd0; /* low address of packet */ 60 volatile unsigned short tmd0; /* low address of packet */
62 volatile unsigned char tmd1_bits; /* descriptor bits */ 61 volatile unsigned char tmd1_bits; /* descriptor bits */
63 volatile unsigned char tmd1_hadr; /* high address of packet */ 62 volatile unsigned char tmd1_hadr; /* high address of packet */
64 volatile short length; /* Length is 2s complement (negative)! */ 63 volatile short length; /* Length is 2s complement (negative)! */
65 volatile unsigned short misc; 64 volatile unsigned short misc;
66}; 65};
67 66
@@ -71,181 +70,178 @@ struct lance_tx_desc {
71 * init block,the Tx and Rx rings and the buffers together in memory: 70 * init block,the Tx and Rx rings and the buffers together in memory:
72 */ 71 */
73struct lance_init_block { 72struct lance_init_block {
74 volatile unsigned short mode; /* Pre-set mode (reg. 15) */ 73 volatile unsigned short mode; /* Pre-set mode (reg. 15) */
75 volatile unsigned char phys_addr[6]; /* Physical ethernet address */ 74 volatile unsigned char phys_addr[6]; /* Physical ethernet address */
76 volatile unsigned filter[2]; /* Multicast filter (64 bits) */ 75 volatile unsigned filter[2]; /* Multicast filter (64 bits) */
77 76
78 /* Receive and transmit ring base, along with extra bits. */ 77 /* Receive and transmit ring base, along with extra bits. */
79 volatile unsigned short rx_ptr; /* receive descriptor addr */ 78 volatile unsigned short rx_ptr; /* receive descriptor addr */
80 volatile unsigned short rx_len; /* receive len and high addr */ 79 volatile unsigned short rx_len; /* receive len and high addr */
81 volatile unsigned short tx_ptr; /* transmit descriptor addr */ 80 volatile unsigned short tx_ptr; /* transmit descriptor addr */
82 volatile unsigned short tx_len; /* transmit len and high addr */ 81 volatile unsigned short tx_len; /* transmit len and high addr */
83 82
84 /* The Tx and Rx ring entries must be aligned on 8-byte boundaries. 83 /* The Tx and Rx ring entries must be aligned on 8-byte boundaries.
85 * This will be true if this whole struct is 8-byte aligned. 84 * This will be true if this whole struct is 8-byte aligned.
86 */ 85 */
87 volatile struct lance_tx_desc btx_ring[TX_RING_SIZE]; 86 volatile struct lance_tx_desc btx_ring[TX_RING_SIZE];
88 volatile struct lance_rx_desc brx_ring[RX_RING_SIZE]; 87 volatile struct lance_rx_desc brx_ring[RX_RING_SIZE];
89 88
90 volatile char tx_buf [TX_RING_SIZE][TX_BUFF_SIZE]; 89 volatile char tx_buf[TX_RING_SIZE][TX_BUFF_SIZE];
91 volatile char rx_buf [RX_RING_SIZE][RX_BUFF_SIZE]; 90 volatile char rx_buf[RX_RING_SIZE][RX_BUFF_SIZE];
92 /* we use this just to make the struct big enough that we can move its startaddr 91 /* we use this just to make the struct big enough that we can move its startaddr
93 * in order to force alignment to an eight byte boundary. 92 * in order to force alignment to an eight byte boundary.
94 */ 93 */
95}; 94};
96 95
97/* This is where we keep all the stuff the driver needs to know about. 96/* This is where we keep all the stuff the driver needs to know about.
98 * I'm definitely unhappy about the mechanism for allowing specific 97 * I'm definitely unhappy about the mechanism for allowing specific
99 * drivers to add things... 98 * drivers to add things...
100 */ 99 */
101struct lance_private 100struct lance_private {
102{ 101 char *name;
103 char *name;
104 unsigned long base; 102 unsigned long base;
105 volatile struct lance_init_block *init_block; /* CPU address of RAM */ 103 volatile struct lance_init_block *init_block; /* CPU address of RAM */
106 volatile struct lance_init_block *lance_init_block; /* LANCE address of RAM */ 104 volatile struct lance_init_block *lance_init_block; /* LANCE address of RAM */
107 105
108 int rx_new, tx_new; 106 int rx_new, tx_new;
109 int rx_old, tx_old; 107 int rx_old, tx_old;
110 108
111 int lance_log_rx_bufs, lance_log_tx_bufs; 109 int lance_log_rx_bufs, lance_log_tx_bufs;
112 int rx_ring_mod_mask, tx_ring_mod_mask; 110 int rx_ring_mod_mask, tx_ring_mod_mask;
113 111
114 int tpe; /* TPE is selected */ 112 int tpe; /* TPE is selected */
115 int auto_select; /* cable-selection is by carrier */ 113 int auto_select; /* cable-selection is by carrier */
116 unsigned short busmaster_regval; 114 unsigned short busmaster_regval;
117 115
118 unsigned int irq; /* IRQ to register */ 116 unsigned int irq; /* IRQ to register */
119 117
120 /* This is because the HP LANCE is disgusting and you have to check 118 /* This is because the HP LANCE is disgusting and you have to check
121 * a DIO-specific register every time you read/write the LANCE regs :-< 119 * a DIO-specific register every time you read/write the LANCE regs :-<
122 * [could we get away with making these some sort of macro?] 120 * [could we get away with making these some sort of macro?]
123 */ 121 */
124 void (*writerap)(void *, unsigned short); 122 void (*writerap)(void *, unsigned short);
125 void (*writerdp)(void *, unsigned short); 123 void (*writerdp)(void *, unsigned short);
126 unsigned short (*readrdp)(void *); 124 unsigned short (*readrdp)(void *);
127 spinlock_t devlock; 125 spinlock_t devlock;
128 char tx_full; 126 char tx_full;
129}; 127};
130 128
131/* 129/*
132 * Am7990 Control and Status Registers 130 * Am7990 Control and Status Registers
133 */ 131 */
134#define LE_CSR0 0x0000 /* LANCE Controller Status */ 132#define LE_CSR0 0x0000 /* LANCE Controller Status */
135#define LE_CSR1 0x0001 /* IADR[15:0] (bit0==0 ie word aligned) */ 133#define LE_CSR1 0x0001 /* IADR[15:0] (bit0==0 ie word aligned) */
136#define LE_CSR2 0x0002 /* IADR[23:16] (high bits reserved) */ 134#define LE_CSR2 0x0002 /* IADR[23:16] (high bits reserved) */
137#define LE_CSR3 0x0003 /* Misc */ 135#define LE_CSR3 0x0003 /* Misc */
138 136
139/* 137/*
140 * Bit definitions for CSR0 (LANCE Controller Status) 138 * Bit definitions for CSR0 (LANCE Controller Status)
141 */ 139 */
142#define LE_C0_ERR 0x8000 /* Error = BABL | CERR | MISS | MERR */ 140#define LE_C0_ERR 0x8000 /* Error = BABL | CERR | MISS | MERR */
143#define LE_C0_BABL 0x4000 /* Babble: Transmitted too many bits */ 141#define LE_C0_BABL 0x4000 /* Babble: Transmitted too many bits */
144#define LE_C0_CERR 0x2000 /* No Heartbeat (10BASE-T) */ 142#define LE_C0_CERR 0x2000 /* No Heartbeat (10BASE-T) */
145#define LE_C0_MISS 0x1000 /* Missed Frame (no rx buffer to put it in) */ 143#define LE_C0_MISS 0x1000 /* Missed Frame (no rx buffer to put it in) */
146#define LE_C0_MERR 0x0800 /* Memory Error */ 144#define LE_C0_MERR 0x0800 /* Memory Error */
147#define LE_C0_RINT 0x0400 /* Receive Interrupt */ 145#define LE_C0_RINT 0x0400 /* Receive Interrupt */
148#define LE_C0_TINT 0x0200 /* Transmit Interrupt */ 146#define LE_C0_TINT 0x0200 /* Transmit Interrupt */
149#define LE_C0_IDON 0x0100 /* Initialization Done */ 147#define LE_C0_IDON 0x0100 /* Initialization Done */
150#define LE_C0_INTR 0x0080 /* Interrupt Flag 148#define LE_C0_INTR 0x0080 /* Interrupt Flag
151 = BABL | MISS | MERR | RINT | TINT | IDON */ 149 = BABL | MISS | MERR | RINT | TINT | IDON */
152#define LE_C0_INEA 0x0040 /* Interrupt Enable */ 150#define LE_C0_INEA 0x0040 /* Interrupt Enable */
153#define LE_C0_RXON 0x0020 /* Receive On */ 151#define LE_C0_RXON 0x0020 /* Receive On */
154#define LE_C0_TXON 0x0010 /* Transmit On */ 152#define LE_C0_TXON 0x0010 /* Transmit On */
155#define LE_C0_TDMD 0x0008 /* Transmit Demand */ 153#define LE_C0_TDMD 0x0008 /* Transmit Demand */
156#define LE_C0_STOP 0x0004 /* Stop */ 154#define LE_C0_STOP 0x0004 /* Stop */
157#define LE_C0_STRT 0x0002 /* Start */ 155#define LE_C0_STRT 0x0002 /* Start */
158#define LE_C0_INIT 0x0001 /* Initialize */ 156#define LE_C0_INIT 0x0001 /* Initialize */
159 157
160 158
161/* 159/*
162 * Bit definitions for CSR3 160 * Bit definitions for CSR3
163 */ 161 */
164#define LE_C3_BSWP 0x0004 /* Byte Swap 162#define LE_C3_BSWP 0x0004 /* Byte Swap (on for big endian byte order) */
165 (on for big endian byte order) */ 163#define LE_C3_ACON 0x0002 /* ALE Control (on for active low ALE) */
166#define LE_C3_ACON 0x0002 /* ALE Control 164#define LE_C3_BCON 0x0001 /* Byte Control */
167 (on for active low ALE) */
168#define LE_C3_BCON 0x0001 /* Byte Control */
169 165
170 166
171/* 167/*
172 * Mode Flags 168 * Mode Flags
173 */ 169 */
174#define LE_MO_PROM 0x8000 /* Promiscuous Mode */ 170#define LE_MO_PROM 0x8000 /* Promiscuous Mode */
175/* these next ones 0x4000 -- 0x0080 are not available on the LANCE 7990, 171/* these next ones 0x4000 -- 0x0080 are not available on the LANCE 7990,
176 * but they are in NetBSD's am7990.h, presumably for backwards-compatible chips 172 * but they are in NetBSD's am7990.h, presumably for backwards-compatible chips
177 */ 173 */
178#define LE_MO_DRCVBC 0x4000 /* disable receive broadcast */ 174#define LE_MO_DRCVBC 0x4000 /* disable receive broadcast */
179#define LE_MO_DRCVPA 0x2000 /* disable physical address detection */ 175#define LE_MO_DRCVPA 0x2000 /* disable physical address detection */
180#define LE_MO_DLNKTST 0x1000 /* disable link status */ 176#define LE_MO_DLNKTST 0x1000 /* disable link status */
181#define LE_MO_DAPC 0x0800 /* disable automatic polarity correction */ 177#define LE_MO_DAPC 0x0800 /* disable automatic polarity correction */
182#define LE_MO_MENDECL 0x0400 /* MENDEC loopback mode */ 178#define LE_MO_MENDECL 0x0400 /* MENDEC loopback mode */
183#define LE_MO_LRTTSEL 0x0200 /* lower RX threshold / TX mode selection */ 179#define LE_MO_LRTTSEL 0x0200 /* lower RX threshold / TX mode selection */
184#define LE_MO_PSEL1 0x0100 /* port selection bit1 */ 180#define LE_MO_PSEL1 0x0100 /* port selection bit1 */
185#define LE_MO_PSEL0 0x0080 /* port selection bit0 */ 181#define LE_MO_PSEL0 0x0080 /* port selection bit0 */
186/* and this one is from the C-LANCE data sheet... */ 182/* and this one is from the C-LANCE data sheet... */
187#define LE_MO_EMBA 0x0080 /* Enable Modified Backoff Algorithm 183#define LE_MO_EMBA 0x0080 /* Enable Modified Backoff Algorithm
188 (C-LANCE, not original LANCE) */ 184 (C-LANCE, not original LANCE) */
189#define LE_MO_INTL 0x0040 /* Internal Loopback */ 185#define LE_MO_INTL 0x0040 /* Internal Loopback */
190#define LE_MO_DRTY 0x0020 /* Disable Retry */ 186#define LE_MO_DRTY 0x0020 /* Disable Retry */
191#define LE_MO_FCOLL 0x0010 /* Force Collision */ 187#define LE_MO_FCOLL 0x0010 /* Force Collision */
192#define LE_MO_DXMTFCS 0x0008 /* Disable Transmit CRC */ 188#define LE_MO_DXMTFCS 0x0008 /* Disable Transmit CRC */
193#define LE_MO_LOOP 0x0004 /* Loopback Enable */ 189#define LE_MO_LOOP 0x0004 /* Loopback Enable */
194#define LE_MO_DTX 0x0002 /* Disable Transmitter */ 190#define LE_MO_DTX 0x0002 /* Disable Transmitter */
195#define LE_MO_DRX 0x0001 /* Disable Receiver */ 191#define LE_MO_DRX 0x0001 /* Disable Receiver */
196 192
197 193
198/* 194/*
199 * Receive Flags 195 * Receive Flags
200 */ 196 */
201#define LE_R1_OWN 0x80 /* LANCE owns the descriptor */ 197#define LE_R1_OWN 0x80 /* LANCE owns the descriptor */
202#define LE_R1_ERR 0x40 /* Error */ 198#define LE_R1_ERR 0x40 /* Error */
203#define LE_R1_FRA 0x20 /* Framing Error */ 199#define LE_R1_FRA 0x20 /* Framing Error */
204#define LE_R1_OFL 0x10 /* Overflow Error */ 200#define LE_R1_OFL 0x10 /* Overflow Error */
205#define LE_R1_CRC 0x08 /* CRC Error */ 201#define LE_R1_CRC 0x08 /* CRC Error */
206#define LE_R1_BUF 0x04 /* Buffer Error */ 202#define LE_R1_BUF 0x04 /* Buffer Error */
207#define LE_R1_SOP 0x02 /* Start of Packet */ 203#define LE_R1_SOP 0x02 /* Start of Packet */
208#define LE_R1_EOP 0x01 /* End of Packet */ 204#define LE_R1_EOP 0x01 /* End of Packet */
209#define LE_R1_POK 0x03 /* Packet is complete: SOP + EOP */ 205#define LE_R1_POK 0x03 /* Packet is complete: SOP + EOP */
210 206
211 207
212/* 208/*
213 * Transmit Flags 209 * Transmit Flags
214 */ 210 */
215#define LE_T1_OWN 0x80 /* LANCE owns the descriptor */ 211#define LE_T1_OWN 0x80 /* LANCE owns the descriptor */
216#define LE_T1_ERR 0x40 /* Error */ 212#define LE_T1_ERR 0x40 /* Error */
217#define LE_T1_RES 0x20 /* Reserved, LANCE writes this with a zero */ 213#define LE_T1_RES 0x20 /* Reserved, LANCE writes this with a zero */
218#define LE_T1_EMORE 0x10 /* More than one retry needed */ 214#define LE_T1_EMORE 0x10 /* More than one retry needed */
219#define LE_T1_EONE 0x08 /* One retry needed */ 215#define LE_T1_EONE 0x08 /* One retry needed */
220#define LE_T1_EDEF 0x04 /* Deferred */ 216#define LE_T1_EDEF 0x04 /* Deferred */
221#define LE_T1_SOP 0x02 /* Start of Packet */ 217#define LE_T1_SOP 0x02 /* Start of Packet */
222#define LE_T1_EOP 0x01 /* End of Packet */ 218#define LE_T1_EOP 0x01 /* End of Packet */
223#define LE_T1_POK 0x03 /* Packet is complete: SOP + EOP */ 219#define LE_T1_POK 0x03 /* Packet is complete: SOP + EOP */
224 220
225/* 221/*
226 * Error Flags 222 * Error Flags
227 */ 223 */
228#define LE_T3_BUF 0x8000 /* Buffer Error */ 224#define LE_T3_BUF 0x8000 /* Buffer Error */
229#define LE_T3_UFL 0x4000 /* Underflow Error */ 225#define LE_T3_UFL 0x4000 /* Underflow Error */
230#define LE_T3_LCOL 0x1000 /* Late Collision */ 226#define LE_T3_LCOL 0x1000 /* Late Collision */
231#define LE_T3_CLOS 0x0800 /* Loss of Carrier */ 227#define LE_T3_CLOS 0x0800 /* Loss of Carrier */
232#define LE_T3_RTY 0x0400 /* Retry Error */ 228#define LE_T3_RTY 0x0400 /* Retry Error */
233#define LE_T3_TDR 0x03ff /* Time Domain Reflectometry */ 229#define LE_T3_TDR 0x03ff /* Time Domain Reflectometry */
234 230
235/* Miscellaneous useful macros */ 231/* Miscellaneous useful macros */
236 232
237#define TX_BUFFS_AVAIL ((lp->tx_old<=lp->tx_new)?\ 233#define TX_BUFFS_AVAIL ((lp->tx_old <= lp->tx_new) ? \
238 lp->tx_old+lp->tx_ring_mod_mask-lp->tx_new:\ 234 lp->tx_old + lp->tx_ring_mod_mask - lp->tx_new : \
239 lp->tx_old - lp->tx_new-1) 235 lp->tx_old - lp->tx_new - 1)
240 236
241/* The LANCE only uses 24 bit addresses. This does the obvious thing. */ 237/* The LANCE only uses 24 bit addresses. This does the obvious thing. */
242#define LANCE_ADDR(x) ((int)(x) & ~0xff000000) 238#define LANCE_ADDR(x) ((int)(x) & ~0xff000000)
243 239
244/* Now the prototypes we export */ 240/* Now the prototypes we export */
245int lance_open(struct net_device *dev); 241int lance_open(struct net_device *dev);
246int lance_close (struct net_device *dev); 242int lance_close(struct net_device *dev);
247int lance_start_xmit (struct sk_buff *skb, struct net_device *dev); 243int lance_start_xmit(struct sk_buff *skb, struct net_device *dev);
248void lance_set_multicast (struct net_device *dev); 244void lance_set_multicast(struct net_device *dev);
249void lance_tx_timeout(struct net_device *dev); 245void lance_tx_timeout(struct net_device *dev);
250#ifdef CONFIG_NET_POLL_CONTROLLER 246#ifdef CONFIG_NET_POLL_CONTROLLER
251void lance_poll(struct net_device *dev); 247void lance_poll(struct net_device *dev);