aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2008-04-10 11:25:31 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-04-16 20:06:50 -0400
commit7f225b427be7d3f2940fdebf5d79f753f38d3083 (patch)
treea66e7ea30569c682ee61fdad21e89121545c1608 /drivers/net
parentc6686fe3e4c4e8e5104bbec254a5874779eed2bc (diff)
tc35815: Whitespace cleanup
Cosmetic TAB/whitespace cleanups and some style cleanups. No functional changes. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/tc35815.c372
1 files changed, 187 insertions, 185 deletions
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index 59f783eb98b9..744f11f5ffb8 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -81,7 +81,7 @@ static const struct pci_device_id tc35815_pci_tbl[] = {
81 {PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA_2, PCI_DEVICE_ID_TOSHIBA_TC35815_TX4939), .driver_data = TC35815_TX4939 }, 81 {PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA_2, PCI_DEVICE_ID_TOSHIBA_TC35815_TX4939), .driver_data = TC35815_TX4939 },
82 {0,} 82 {0,}
83}; 83};
84MODULE_DEVICE_TABLE (pci, tc35815_pci_tbl); 84MODULE_DEVICE_TABLE(pci, tc35815_pci_tbl);
85 85
86/* see MODULE_PARM_DESC */ 86/* see MODULE_PARM_DESC */
87static struct tc35815_options { 87static struct tc35815_options {
@@ -130,159 +130,159 @@ struct tc35815_regs {
130 * Bit assignments 130 * Bit assignments
131 */ 131 */
132/* DMA_Ctl bit asign ------------------------------------------------------- */ 132/* DMA_Ctl bit asign ------------------------------------------------------- */
133#define DMA_RxAlign 0x00c00000 /* 1:Reception Alignment */ 133#define DMA_RxAlign 0x00c00000 /* 1:Reception Alignment */
134#define DMA_RxAlign_1 0x00400000 134#define DMA_RxAlign_1 0x00400000
135#define DMA_RxAlign_2 0x00800000 135#define DMA_RxAlign_2 0x00800000
136#define DMA_RxAlign_3 0x00c00000 136#define DMA_RxAlign_3 0x00c00000
137#define DMA_M66EnStat 0x00080000 /* 1:66MHz Enable State */ 137#define DMA_M66EnStat 0x00080000 /* 1:66MHz Enable State */
138#define DMA_IntMask 0x00040000 /* 1:Interupt mask */ 138#define DMA_IntMask 0x00040000 /* 1:Interupt mask */
139#define DMA_SWIntReq 0x00020000 /* 1:Software Interrupt request */ 139#define DMA_SWIntReq 0x00020000 /* 1:Software Interrupt request */
140#define DMA_TxWakeUp 0x00010000 /* 1:Transmit Wake Up */ 140#define DMA_TxWakeUp 0x00010000 /* 1:Transmit Wake Up */
141#define DMA_RxBigE 0x00008000 /* 1:Receive Big Endian */ 141#define DMA_RxBigE 0x00008000 /* 1:Receive Big Endian */
142#define DMA_TxBigE 0x00004000 /* 1:Transmit Big Endian */ 142#define DMA_TxBigE 0x00004000 /* 1:Transmit Big Endian */
143#define DMA_TestMode 0x00002000 /* 1:Test Mode */ 143#define DMA_TestMode 0x00002000 /* 1:Test Mode */
144#define DMA_PowrMgmnt 0x00001000 /* 1:Power Management */ 144#define DMA_PowrMgmnt 0x00001000 /* 1:Power Management */
145#define DMA_DmBurst_Mask 0x000001fc /* DMA Burst size */ 145#define DMA_DmBurst_Mask 0x000001fc /* DMA Burst size */
146 146
147/* RxFragSize bit asign ---------------------------------------------------- */ 147/* RxFragSize bit asign ---------------------------------------------------- */
148#define RxFrag_EnPack 0x00008000 /* 1:Enable Packing */ 148#define RxFrag_EnPack 0x00008000 /* 1:Enable Packing */
149#define RxFrag_MinFragMask 0x00000ffc /* Minimum Fragment */ 149#define RxFrag_MinFragMask 0x00000ffc /* Minimum Fragment */
150 150
151/* MAC_Ctl bit asign ------------------------------------------------------- */ 151/* MAC_Ctl bit asign ------------------------------------------------------- */
152#define MAC_Link10 0x00008000 /* 1:Link Status 10Mbits */ 152#define MAC_Link10 0x00008000 /* 1:Link Status 10Mbits */
153#define MAC_EnMissRoll 0x00002000 /* 1:Enable Missed Roll */ 153#define MAC_EnMissRoll 0x00002000 /* 1:Enable Missed Roll */
154#define MAC_MissRoll 0x00000400 /* 1:Missed Roll */ 154#define MAC_MissRoll 0x00000400 /* 1:Missed Roll */
155#define MAC_Loop10 0x00000080 /* 1:Loop 10 Mbps */ 155#define MAC_Loop10 0x00000080 /* 1:Loop 10 Mbps */
156#define MAC_Conn_Auto 0x00000000 /*00:Connection mode (Automatic) */ 156#define MAC_Conn_Auto 0x00000000 /*00:Connection mode (Automatic) */
157#define MAC_Conn_10M 0x00000020 /*01: (10Mbps endec)*/ 157#define MAC_Conn_10M 0x00000020 /*01: (10Mbps endec)*/
158#define MAC_Conn_Mll 0x00000040 /*10: (Mll clock) */ 158#define MAC_Conn_Mll 0x00000040 /*10: (Mll clock) */
159#define MAC_MacLoop 0x00000010 /* 1:MAC Loopback */ 159#define MAC_MacLoop 0x00000010 /* 1:MAC Loopback */
160#define MAC_FullDup 0x00000008 /* 1:Full Duplex 0:Half Duplex */ 160#define MAC_FullDup 0x00000008 /* 1:Full Duplex 0:Half Duplex */
161#define MAC_Reset 0x00000004 /* 1:Software Reset */ 161#define MAC_Reset 0x00000004 /* 1:Software Reset */
162#define MAC_HaltImm 0x00000002 /* 1:Halt Immediate */ 162#define MAC_HaltImm 0x00000002 /* 1:Halt Immediate */
163#define MAC_HaltReq 0x00000001 /* 1:Halt request */ 163#define MAC_HaltReq 0x00000001 /* 1:Halt request */
164 164
165/* PROM_Ctl bit asign ------------------------------------------------------ */ 165/* PROM_Ctl bit asign ------------------------------------------------------ */
166#define PROM_Busy 0x00008000 /* 1:Busy (Start Operation) */ 166#define PROM_Busy 0x00008000 /* 1:Busy (Start Operation) */
167#define PROM_Read 0x00004000 /*10:Read operation */ 167#define PROM_Read 0x00004000 /*10:Read operation */
168#define PROM_Write 0x00002000 /*01:Write operation */ 168#define PROM_Write 0x00002000 /*01:Write operation */
169#define PROM_Erase 0x00006000 /*11:Erase operation */ 169#define PROM_Erase 0x00006000 /*11:Erase operation */
170 /*00:Enable or Disable Writting, */ 170 /*00:Enable or Disable Writting, */
171 /* as specified in PROM_Addr. */ 171 /* as specified in PROM_Addr. */
172#define PROM_Addr_Ena 0x00000030 /*11xxxx:PROM Write enable */ 172#define PROM_Addr_Ena 0x00000030 /*11xxxx:PROM Write enable */
173 /*00xxxx: disable */ 173 /*00xxxx: disable */
174 174
175/* CAM_Ctl bit asign ------------------------------------------------------- */ 175/* CAM_Ctl bit asign ------------------------------------------------------- */
176#define CAM_CompEn 0x00000010 /* 1:CAM Compare Enable */ 176#define CAM_CompEn 0x00000010 /* 1:CAM Compare Enable */
177#define CAM_NegCAM 0x00000008 /* 1:Reject packets CAM recognizes,*/ 177#define CAM_NegCAM 0x00000008 /* 1:Reject packets CAM recognizes,*/
178 /* accept other */ 178 /* accept other */
179#define CAM_BroadAcc 0x00000004 /* 1:Broadcast assept */ 179#define CAM_BroadAcc 0x00000004 /* 1:Broadcast assept */
180#define CAM_GroupAcc 0x00000002 /* 1:Multicast assept */ 180#define CAM_GroupAcc 0x00000002 /* 1:Multicast assept */
181#define CAM_StationAcc 0x00000001 /* 1:unicast accept */ 181#define CAM_StationAcc 0x00000001 /* 1:unicast accept */
182 182
183/* CAM_Ena bit asign ------------------------------------------------------- */ 183/* CAM_Ena bit asign ------------------------------------------------------- */
184#define CAM_ENTRY_MAX 21 /* CAM Data entry max count */ 184#define CAM_ENTRY_MAX 21 /* CAM Data entry max count */
185#define CAM_Ena_Mask ((1<<CAM_ENTRY_MAX)-1) /* CAM Enable bits (Max 21bits) */ 185#define CAM_Ena_Mask ((1<<CAM_ENTRY_MAX)-1) /* CAM Enable bits (Max 21bits) */
186#define CAM_Ena_Bit(index) (1<<(index)) 186#define CAM_Ena_Bit(index) (1 << (index))
187#define CAM_ENTRY_DESTINATION 0 187#define CAM_ENTRY_DESTINATION 0
188#define CAM_ENTRY_SOURCE 1 188#define CAM_ENTRY_SOURCE 1
189#define CAM_ENTRY_MACCTL 20 189#define CAM_ENTRY_MACCTL 20
190 190
191/* Tx_Ctl bit asign -------------------------------------------------------- */ 191/* Tx_Ctl bit asign -------------------------------------------------------- */
192#define Tx_En 0x00000001 /* 1:Transmit enable */ 192#define Tx_En 0x00000001 /* 1:Transmit enable */
193#define Tx_TxHalt 0x00000002 /* 1:Transmit Halt Request */ 193#define Tx_TxHalt 0x00000002 /* 1:Transmit Halt Request */
194#define Tx_NoPad 0x00000004 /* 1:Suppress Padding */ 194#define Tx_NoPad 0x00000004 /* 1:Suppress Padding */
195#define Tx_NoCRC 0x00000008 /* 1:Suppress Padding */ 195#define Tx_NoCRC 0x00000008 /* 1:Suppress Padding */
196#define Tx_FBack 0x00000010 /* 1:Fast Back-off */ 196#define Tx_FBack 0x00000010 /* 1:Fast Back-off */
197#define Tx_EnUnder 0x00000100 /* 1:Enable Underrun */ 197#define Tx_EnUnder 0x00000100 /* 1:Enable Underrun */
198#define Tx_EnExDefer 0x00000200 /* 1:Enable Excessive Deferral */ 198#define Tx_EnExDefer 0x00000200 /* 1:Enable Excessive Deferral */
199#define Tx_EnLCarr 0x00000400 /* 1:Enable Lost Carrier */ 199#define Tx_EnLCarr 0x00000400 /* 1:Enable Lost Carrier */
200#define Tx_EnExColl 0x00000800 /* 1:Enable Excessive Collision */ 200#define Tx_EnExColl 0x00000800 /* 1:Enable Excessive Collision */
201#define Tx_EnLateColl 0x00001000 /* 1:Enable Late Collision */ 201#define Tx_EnLateColl 0x00001000 /* 1:Enable Late Collision */
202#define Tx_EnTxPar 0x00002000 /* 1:Enable Transmit Parity */ 202#define Tx_EnTxPar 0x00002000 /* 1:Enable Transmit Parity */
203#define Tx_EnComp 0x00004000 /* 1:Enable Completion */ 203#define Tx_EnComp 0x00004000 /* 1:Enable Completion */
204 204
205/* Tx_Stat bit asign ------------------------------------------------------- */ 205/* Tx_Stat bit asign ------------------------------------------------------- */
206#define Tx_TxColl_MASK 0x0000000F /* Tx Collision Count */ 206#define Tx_TxColl_MASK 0x0000000F /* Tx Collision Count */
207#define Tx_ExColl 0x00000010 /* Excessive Collision */ 207#define Tx_ExColl 0x00000010 /* Excessive Collision */
208#define Tx_TXDefer 0x00000020 /* Transmit Defered */ 208#define Tx_TXDefer 0x00000020 /* Transmit Defered */
209#define Tx_Paused 0x00000040 /* Transmit Paused */ 209#define Tx_Paused 0x00000040 /* Transmit Paused */
210#define Tx_IntTx 0x00000080 /* Interrupt on Tx */ 210#define Tx_IntTx 0x00000080 /* Interrupt on Tx */
211#define Tx_Under 0x00000100 /* Underrun */ 211#define Tx_Under 0x00000100 /* Underrun */
212#define Tx_Defer 0x00000200 /* Deferral */ 212#define Tx_Defer 0x00000200 /* Deferral */
213#define Tx_NCarr 0x00000400 /* No Carrier */ 213#define Tx_NCarr 0x00000400 /* No Carrier */
214#define Tx_10Stat 0x00000800 /* 10Mbps Status */ 214#define Tx_10Stat 0x00000800 /* 10Mbps Status */
215#define Tx_LateColl 0x00001000 /* Late Collision */ 215#define Tx_LateColl 0x00001000 /* Late Collision */
216#define Tx_TxPar 0x00002000 /* Tx Parity Error */ 216#define Tx_TxPar 0x00002000 /* Tx Parity Error */
217#define Tx_Comp 0x00004000 /* Completion */ 217#define Tx_Comp 0x00004000 /* Completion */
218#define Tx_Halted 0x00008000 /* Tx Halted */ 218#define Tx_Halted 0x00008000 /* Tx Halted */
219#define Tx_SQErr 0x00010000 /* Signal Quality Error(SQE) */ 219#define Tx_SQErr 0x00010000 /* Signal Quality Error(SQE) */
220 220
221/* Rx_Ctl bit asign -------------------------------------------------------- */ 221/* Rx_Ctl bit asign -------------------------------------------------------- */
222#define Rx_EnGood 0x00004000 /* 1:Enable Good */ 222#define Rx_EnGood 0x00004000 /* 1:Enable Good */
223#define Rx_EnRxPar 0x00002000 /* 1:Enable Receive Parity */ 223#define Rx_EnRxPar 0x00002000 /* 1:Enable Receive Parity */
224#define Rx_EnLongErr 0x00000800 /* 1:Enable Long Error */ 224#define Rx_EnLongErr 0x00000800 /* 1:Enable Long Error */
225#define Rx_EnOver 0x00000400 /* 1:Enable OverFlow */ 225#define Rx_EnOver 0x00000400 /* 1:Enable OverFlow */
226#define Rx_EnCRCErr 0x00000200 /* 1:Enable CRC Error */ 226#define Rx_EnCRCErr 0x00000200 /* 1:Enable CRC Error */
227#define Rx_EnAlign 0x00000100 /* 1:Enable Alignment */ 227#define Rx_EnAlign 0x00000100 /* 1:Enable Alignment */
228#define Rx_IgnoreCRC 0x00000040 /* 1:Ignore CRC Value */ 228#define Rx_IgnoreCRC 0x00000040 /* 1:Ignore CRC Value */
229#define Rx_StripCRC 0x00000010 /* 1:Strip CRC Value */ 229#define Rx_StripCRC 0x00000010 /* 1:Strip CRC Value */
230#define Rx_ShortEn 0x00000008 /* 1:Short Enable */ 230#define Rx_ShortEn 0x00000008 /* 1:Short Enable */
231#define Rx_LongEn 0x00000004 /* 1:Long Enable */ 231#define Rx_LongEn 0x00000004 /* 1:Long Enable */
232#define Rx_RxHalt 0x00000002 /* 1:Receive Halt Request */ 232#define Rx_RxHalt 0x00000002 /* 1:Receive Halt Request */
233#define Rx_RxEn 0x00000001 /* 1:Receive Intrrupt Enable */ 233#define Rx_RxEn 0x00000001 /* 1:Receive Intrrupt Enable */
234 234
235/* Rx_Stat bit asign ------------------------------------------------------- */ 235/* Rx_Stat bit asign ------------------------------------------------------- */
236#define Rx_Halted 0x00008000 /* Rx Halted */ 236#define Rx_Halted 0x00008000 /* Rx Halted */
237#define Rx_Good 0x00004000 /* Rx Good */ 237#define Rx_Good 0x00004000 /* Rx Good */
238#define Rx_RxPar 0x00002000 /* Rx Parity Error */ 238#define Rx_RxPar 0x00002000 /* Rx Parity Error */
239 /* 0x00001000 not use */ 239 /* 0x00001000 not use */
240#define Rx_LongErr 0x00000800 /* Rx Long Error */ 240#define Rx_LongErr 0x00000800 /* Rx Long Error */
241#define Rx_Over 0x00000400 /* Rx Overflow */ 241#define Rx_Over 0x00000400 /* Rx Overflow */
242#define Rx_CRCErr 0x00000200 /* Rx CRC Error */ 242#define Rx_CRCErr 0x00000200 /* Rx CRC Error */
243#define Rx_Align 0x00000100 /* Rx Alignment Error */ 243#define Rx_Align 0x00000100 /* Rx Alignment Error */
244#define Rx_10Stat 0x00000080 /* Rx 10Mbps Status */ 244#define Rx_10Stat 0x00000080 /* Rx 10Mbps Status */
245#define Rx_IntRx 0x00000040 /* Rx Interrupt */ 245#define Rx_IntRx 0x00000040 /* Rx Interrupt */
246#define Rx_CtlRecd 0x00000020 /* Rx Control Receive */ 246#define Rx_CtlRecd 0x00000020 /* Rx Control Receive */
247 247
248#define Rx_Stat_Mask 0x0000EFC0 /* Rx All Status Mask */ 248#define Rx_Stat_Mask 0x0000EFC0 /* Rx All Status Mask */
249 249
250/* Int_En bit asign -------------------------------------------------------- */ 250/* Int_En bit asign -------------------------------------------------------- */
251#define Int_NRAbtEn 0x00000800 /* 1:Non-recoverable Abort Enable */ 251#define Int_NRAbtEn 0x00000800 /* 1:Non-recoverable Abort Enable */
252#define Int_TxCtlCmpEn 0x00000400 /* 1:Transmit Control Complete Enable */ 252#define Int_TxCtlCmpEn 0x00000400 /* 1:Transmit Ctl Complete Enable */
253#define Int_DmParErrEn 0x00000200 /* 1:DMA Parity Error Enable */ 253#define Int_DmParErrEn 0x00000200 /* 1:DMA Parity Error Enable */
254#define Int_DParDEn 0x00000100 /* 1:Data Parity Error Enable */ 254#define Int_DParDEn 0x00000100 /* 1:Data Parity Error Enable */
255#define Int_EarNotEn 0x00000080 /* 1:Early Notify Enable */ 255#define Int_EarNotEn 0x00000080 /* 1:Early Notify Enable */
256#define Int_DParErrEn 0x00000040 /* 1:Detected Parity Error Enable */ 256#define Int_DParErrEn 0x00000040 /* 1:Detected Parity Error Enable */
257#define Int_SSysErrEn 0x00000020 /* 1:Signalled System Error Enable */ 257#define Int_SSysErrEn 0x00000020 /* 1:Signalled System Error Enable */
258#define Int_RMasAbtEn 0x00000010 /* 1:Received Master Abort Enable */ 258#define Int_RMasAbtEn 0x00000010 /* 1:Received Master Abort Enable */
259#define Int_RTargAbtEn 0x00000008 /* 1:Received Target Abort Enable */ 259#define Int_RTargAbtEn 0x00000008 /* 1:Received Target Abort Enable */
260#define Int_STargAbtEn 0x00000004 /* 1:Signalled Target Abort Enable */ 260#define Int_STargAbtEn 0x00000004 /* 1:Signalled Target Abort Enable */
261#define Int_BLExEn 0x00000002 /* 1:Buffer List Exhausted Enable */ 261#define Int_BLExEn 0x00000002 /* 1:Buffer List Exhausted Enable */
262#define Int_FDAExEn 0x00000001 /* 1:Free Descriptor Area */ 262#define Int_FDAExEn 0x00000001 /* 1:Free Descriptor Area */
263 /* Exhausted Enable */ 263 /* Exhausted Enable */
264 264
265/* Int_Src bit asign ------------------------------------------------------- */ 265/* Int_Src bit asign ------------------------------------------------------- */
266#define Int_NRabt 0x00004000 /* 1:Non Recoverable error */ 266#define Int_NRabt 0x00004000 /* 1:Non Recoverable error */
267#define Int_DmParErrStat 0x00002000 /* 1:DMA Parity Error & Clear */ 267#define Int_DmParErrStat 0x00002000 /* 1:DMA Parity Error & Clear */
268#define Int_BLEx 0x00001000 /* 1:Buffer List Empty & Clear */ 268#define Int_BLEx 0x00001000 /* 1:Buffer List Empty & Clear */
269#define Int_FDAEx 0x00000800 /* 1:FDA Empty & Clear */ 269#define Int_FDAEx 0x00000800 /* 1:FDA Empty & Clear */
270#define Int_IntNRAbt 0x00000400 /* 1:Non Recoverable Abort */ 270#define Int_IntNRAbt 0x00000400 /* 1:Non Recoverable Abort */
271#define Int_IntCmp 0x00000200 /* 1:MAC control packet complete */ 271#define Int_IntCmp 0x00000200 /* 1:MAC control packet complete */
272#define Int_IntExBD 0x00000100 /* 1:Interrupt Extra BD & Clear */ 272#define Int_IntExBD 0x00000100 /* 1:Interrupt Extra BD & Clear */
273#define Int_DmParErr 0x00000080 /* 1:DMA Parity Error & Clear */ 273#define Int_DmParErr 0x00000080 /* 1:DMA Parity Error & Clear */
274#define Int_IntEarNot 0x00000040 /* 1:Receive Data write & Clear */ 274#define Int_IntEarNot 0x00000040 /* 1:Receive Data write & Clear */
275#define Int_SWInt 0x00000020 /* 1:Software request & Clear */ 275#define Int_SWInt 0x00000020 /* 1:Software request & Clear */
276#define Int_IntBLEx 0x00000010 /* 1:Buffer List Empty & Clear */ 276#define Int_IntBLEx 0x00000010 /* 1:Buffer List Empty & Clear */
277#define Int_IntFDAEx 0x00000008 /* 1:FDA Empty & Clear */ 277#define Int_IntFDAEx 0x00000008 /* 1:FDA Empty & Clear */
278#define Int_IntPCI 0x00000004 /* 1:PCI controller & Clear */ 278#define Int_IntPCI 0x00000004 /* 1:PCI controller & Clear */
279#define Int_IntMacRx 0x00000002 /* 1:Rx controller & Clear */ 279#define Int_IntMacRx 0x00000002 /* 1:Rx controller & Clear */
280#define Int_IntMacTx 0x00000001 /* 1:Tx controller & Clear */ 280#define Int_IntMacTx 0x00000001 /* 1:Tx controller & Clear */
281 281
282/* MD_CA bit asign --------------------------------------------------------- */ 282/* MD_CA bit asign --------------------------------------------------------- */
283#define MD_CA_PreSup 0x00001000 /* 1:Preamble Supress */ 283#define MD_CA_PreSup 0x00001000 /* 1:Preamble Supress */
284#define MD_CA_Busy 0x00000800 /* 1:Busy (Start Operation) */ 284#define MD_CA_Busy 0x00000800 /* 1:Busy (Start Operation) */
285#define MD_CA_Wr 0x00000400 /* 1:Write 0:Read */ 285#define MD_CA_Wr 0x00000400 /* 1:Write 0:Read */
286 286
287 287
288/* 288/*
@@ -306,24 +306,24 @@ struct BDesc {
306#define FD_ALIGN 16 306#define FD_ALIGN 16
307 307
308/* Frame Descripter bit asign ---------------------------------------------- */ 308/* Frame Descripter bit asign ---------------------------------------------- */
309#define FD_FDLength_MASK 0x0000FFFF /* Length MASK */ 309#define FD_FDLength_MASK 0x0000FFFF /* Length MASK */
310#define FD_BDCnt_MASK 0x001F0000 /* BD count MASK in FD */ 310#define FD_BDCnt_MASK 0x001F0000 /* BD count MASK in FD */
311#define FD_FrmOpt_MASK 0x7C000000 /* Frame option MASK */ 311#define FD_FrmOpt_MASK 0x7C000000 /* Frame option MASK */
312#define FD_FrmOpt_BigEndian 0x40000000 /* Tx/Rx */ 312#define FD_FrmOpt_BigEndian 0x40000000 /* Tx/Rx */
313#define FD_FrmOpt_IntTx 0x20000000 /* Tx only */ 313#define FD_FrmOpt_IntTx 0x20000000 /* Tx only */
314#define FD_FrmOpt_NoCRC 0x10000000 /* Tx only */ 314#define FD_FrmOpt_NoCRC 0x10000000 /* Tx only */
315#define FD_FrmOpt_NoPadding 0x08000000 /* Tx only */ 315#define FD_FrmOpt_NoPadding 0x08000000 /* Tx only */
316#define FD_FrmOpt_Packing 0x04000000 /* Rx only */ 316#define FD_FrmOpt_Packing 0x04000000 /* Rx only */
317#define FD_CownsFD 0x80000000 /* FD Controller owner bit */ 317#define FD_CownsFD 0x80000000 /* FD Controller owner bit */
318#define FD_Next_EOL 0x00000001 /* FD EOL indicator */ 318#define FD_Next_EOL 0x00000001 /* FD EOL indicator */
319#define FD_BDCnt_SHIFT 16 319#define FD_BDCnt_SHIFT 16
320 320
321/* Buffer Descripter bit asign --------------------------------------------- */ 321/* Buffer Descripter bit asign --------------------------------------------- */
322#define BD_BuffLength_MASK 0x0000FFFF /* Recieve Data Size */ 322#define BD_BuffLength_MASK 0x0000FFFF /* Recieve Data Size */
323#define BD_RxBDID_MASK 0x00FF0000 /* BD ID Number MASK */ 323#define BD_RxBDID_MASK 0x00FF0000 /* BD ID Number MASK */
324#define BD_RxBDSeqN_MASK 0x7F000000 /* Rx BD Sequence Number */ 324#define BD_RxBDSeqN_MASK 0x7F000000 /* Rx BD Sequence Number */
325#define BD_CownsBD 0x80000000 /* BD Controller owner bit */ 325#define BD_CownsBD 0x80000000 /* BD Controller owner bit */
326#define BD_RxBDID_SHIFT 16 326#define BD_RxBDID_SHIFT 16
327#define BD_RxBDSeqN_SHIFT 24 327#define BD_RxBDSeqN_SHIFT 24
328 328
329 329
@@ -352,8 +352,10 @@ struct BDesc {
352/* Tuning parameters */ 352/* Tuning parameters */
353#define DMA_BURST_SIZE 32 353#define DMA_BURST_SIZE 32
354#define TX_THRESHOLD 1024 354#define TX_THRESHOLD 1024
355#define TX_THRESHOLD_MAX 1536 /* used threshold with packet max byte for low pci transfer ability.*/ 355/* used threshold with packet max byte for low pci transfer ability.*/
356#define TX_THRESHOLD_KEEP_LIMIT 10 /* setting threshold max value when overrun error occured this count. */ 356#define TX_THRESHOLD_MAX 1536
357/* setting threshold max value when overrun error occured this count. */
358#define TX_THRESHOLD_KEEP_LIMIT 10
357 359
358/* 16 + RX_BUF_NUM * 8 + RX_FD_NUM * 16 + TX_FD_NUM * 32 <= PAGE_SIZE*FD_PAGE_NUM */ 360/* 16 + RX_BUF_NUM * 8 + RX_FD_NUM * 16 + TX_FD_NUM * 32 <= PAGE_SIZE*FD_PAGE_NUM */
359#ifdef TC35815_USE_PACKEDBUFFER 361#ifdef TC35815_USE_PACKEDBUFFER
@@ -412,7 +414,7 @@ struct tc35815_local {
412 int max_tx_qlen; 414 int max_tx_qlen;
413 int tx_ints; 415 int tx_ints;
414 int rx_ints; 416 int rx_ints;
415 int tx_underrun; 417 int tx_underrun;
416 } lstats; 418 } lstats;
417 419
418 /* Tx control lock. This protects the transmit buffer ring 420 /* Tx control lock. This protects the transmit buffer ring
@@ -441,7 +443,7 @@ struct tc35815_local {
441 * RX_BUF_NUM BD in Free Buffer FD. 443 * RX_BUF_NUM BD in Free Buffer FD.
442 * One Free Buffer BD has ETH_FRAME_LEN data buffer. 444 * One Free Buffer BD has ETH_FRAME_LEN data buffer.
443 */ 445 */
444 void * fd_buf; /* for TxFD, RxFD, FrFD */ 446 void *fd_buf; /* for TxFD, RxFD, FrFD */
445 dma_addr_t fd_buf_dma; 447 dma_addr_t fd_buf_dma;
446 struct TxFD *tfd_base; 448 struct TxFD *tfd_base;
447 unsigned int tfd_start; 449 unsigned int tfd_start;
@@ -452,7 +454,7 @@ struct tc35815_local {
452 struct FrFD *fbl_ptr; 454 struct FrFD *fbl_ptr;
453#ifdef TC35815_USE_PACKEDBUFFER 455#ifdef TC35815_USE_PACKEDBUFFER
454 unsigned char fbl_curid; 456 unsigned char fbl_curid;
455 void * data_buf[RX_BUF_NUM]; /* packing */ 457 void *data_buf[RX_BUF_NUM]; /* packing */
456 dma_addr_t data_buf_dma[RX_BUF_NUM]; 458 dma_addr_t data_buf_dma[RX_BUF_NUM];
457 struct { 459 struct {
458 struct sk_buff *skb; 460 struct sk_buff *skb;
@@ -493,13 +495,14 @@ static inline void *rxbuf_bus_to_virt(struct tc35815_local *lp, dma_addr_t bus)
493} 495}
494 496
495#define TC35815_DMA_SYNC_ONDEMAND 497#define TC35815_DMA_SYNC_ONDEMAND
496static void* alloc_rxbuf_page(struct pci_dev *hwdev, dma_addr_t *dma_handle) 498static void *alloc_rxbuf_page(struct pci_dev *hwdev, dma_addr_t *dma_handle)
497{ 499{
498#ifdef TC35815_DMA_SYNC_ONDEMAND 500#ifdef TC35815_DMA_SYNC_ONDEMAND
499 void *buf; 501 void *buf;
500 /* pci_map + pci_dma_sync will be more effective than 502 /* pci_map + pci_dma_sync will be more effective than
501 * pci_alloc_consistent on some archs. */ 503 * pci_alloc_consistent on some archs. */
502 if ((buf = (void *)__get_free_page(GFP_ATOMIC)) == NULL) 504 buf = (void *)__get_free_page(GFP_ATOMIC);
505 if (!buf)
503 return NULL; 506 return NULL;
504 *dma_handle = pci_map_single(hwdev, buf, PAGE_SIZE, 507 *dma_handle = pci_map_single(hwdev, buf, PAGE_SIZE,
505 PCI_DMA_FROMDEVICE); 508 PCI_DMA_FROMDEVICE);
@@ -564,7 +567,7 @@ static void tc35815_txdone(struct net_device *dev);
564static int tc35815_close(struct net_device *dev); 567static int tc35815_close(struct net_device *dev);
565static struct net_device_stats *tc35815_get_stats(struct net_device *dev); 568static struct net_device_stats *tc35815_get_stats(struct net_device *dev);
566static void tc35815_set_multicast_list(struct net_device *dev); 569static void tc35815_set_multicast_list(struct net_device *dev);
567static void tc35815_tx_timeout(struct net_device *dev); 570static void tc35815_tx_timeout(struct net_device *dev);
568static int tc35815_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 571static int tc35815_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
569#ifdef CONFIG_NET_POLL_CONTROLLER 572#ifdef CONFIG_NET_POLL_CONTROLLER
570static void tc35815_poll_controller(struct net_device *dev); 573static void tc35815_poll_controller(struct net_device *dev);
@@ -572,8 +575,8 @@ static void tc35815_poll_controller(struct net_device *dev);
572static const struct ethtool_ops tc35815_ethtool_ops; 575static const struct ethtool_ops tc35815_ethtool_ops;
573 576
574/* Example routines you must write ;->. */ 577/* Example routines you must write ;->. */
575static void tc35815_chip_reset(struct net_device *dev); 578static void tc35815_chip_reset(struct net_device *dev);
576static void tc35815_chip_init(struct net_device *dev); 579static void tc35815_chip_init(struct net_device *dev);
577 580
578#ifdef DEBUG 581#ifdef DEBUG
579static void panic_queues(struct net_device *dev); 582static void panic_queues(struct net_device *dev);
@@ -825,7 +828,7 @@ static int __devinit tc35815_read_plat_dev_addr(struct net_device *dev)
825} 828}
826#endif 829#endif
827 830
828static int __devinit tc35815_init_dev_addr (struct net_device *dev) 831static int __devinit tc35815_init_dev_addr(struct net_device *dev)
829{ 832{
830 struct tc35815_regs __iomem *tr = 833 struct tc35815_regs __iomem *tr =
831 (struct tc35815_regs __iomem *)dev->base_addr; 834 (struct tc35815_regs __iomem *)dev->base_addr;
@@ -847,8 +850,8 @@ static int __devinit tc35815_init_dev_addr (struct net_device *dev)
847 return 0; 850 return 0;
848} 851}
849 852
850static int __devinit tc35815_init_one (struct pci_dev *pdev, 853static int __devinit tc35815_init_one(struct pci_dev *pdev,
851 const struct pci_device_id *ent) 854 const struct pci_device_id *ent)
852{ 855{
853 void __iomem *ioaddr = NULL; 856 void __iomem *ioaddr = NULL;
854 struct net_device *dev; 857 struct net_device *dev;
@@ -870,7 +873,7 @@ static int __devinit tc35815_init_one (struct pci_dev *pdev,
870 } 873 }
871 874
872 /* dev zeroed in alloc_etherdev */ 875 /* dev zeroed in alloc_etherdev */
873 dev = alloc_etherdev (sizeof (*lp)); 876 dev = alloc_etherdev(sizeof(*lp));
874 if (dev == NULL) { 877 if (dev == NULL) {
875 dev_err(&pdev->dev, "unable to alloc new ethernet\n"); 878 dev_err(&pdev->dev, "unable to alloc new ethernet\n");
876 return -ENOMEM; 879 return -ENOMEM;
@@ -907,7 +910,7 @@ static int __devinit tc35815_init_one (struct pci_dev *pdev,
907#endif 910#endif
908 911
909 dev->irq = pdev->irq; 912 dev->irq = pdev->irq;
910 dev->base_addr = (unsigned long) ioaddr; 913 dev->base_addr = (unsigned long)ioaddr;
911 914
912 INIT_WORK(&lp->restart_work, tc35815_restart_work); 915 INIT_WORK(&lp->restart_work, tc35815_restart_work);
913 spin_lock_init(&lp->lock); 916 spin_lock_init(&lp->lock);
@@ -926,7 +929,7 @@ static int __devinit tc35815_init_one (struct pci_dev *pdev,
926 random_ether_addr(dev->dev_addr); 929 random_ether_addr(dev->dev_addr);
927 } 930 }
928 931
929 rc = register_netdev (dev); 932 rc = register_netdev(dev);
930 if (rc) 933 if (rc)
931 goto err_out; 934 goto err_out;
932 935
@@ -947,23 +950,22 @@ static int __devinit tc35815_init_one (struct pci_dev *pdev,
947err_out_unregister: 950err_out_unregister:
948 unregister_netdev(dev); 951 unregister_netdev(dev);
949err_out: 952err_out:
950 free_netdev (dev); 953 free_netdev(dev);
951 return rc; 954 return rc;
952} 955}
953 956
954 957
955static void __devexit tc35815_remove_one (struct pci_dev *pdev) 958static void __devexit tc35815_remove_one(struct pci_dev *pdev)
956{ 959{
957 struct net_device *dev = pci_get_drvdata (pdev); 960 struct net_device *dev = pci_get_drvdata(pdev);
958 struct tc35815_local *lp = netdev_priv(dev); 961 struct tc35815_local *lp = netdev_priv(dev);
959 962
960 phy_disconnect(lp->phy_dev); 963 phy_disconnect(lp->phy_dev);
961 mdiobus_unregister(&lp->mii_bus); 964 mdiobus_unregister(&lp->mii_bus);
962 kfree(lp->mii_bus.irq); 965 kfree(lp->mii_bus.irq);
963 unregister_netdev (dev); 966 unregister_netdev(dev);
964 free_netdev (dev); 967 free_netdev(dev);
965 968 pci_set_drvdata(pdev, NULL);
966 pci_set_drvdata (pdev, NULL);
967} 969}
968 970
969static int 971static int
@@ -980,11 +982,17 @@ tc35815_init_queues(struct net_device *dev)
980 sizeof(struct TxFD) * TX_FD_NUM > 982 sizeof(struct TxFD) * TX_FD_NUM >
981 PAGE_SIZE * FD_PAGE_NUM); 983 PAGE_SIZE * FD_PAGE_NUM);
982 984
983 if ((lp->fd_buf = pci_alloc_consistent(lp->pci_dev, PAGE_SIZE * FD_PAGE_NUM, &lp->fd_buf_dma)) == 0) 985 lp->fd_buf = pci_alloc_consistent(lp->pci_dev,
986 PAGE_SIZE * FD_PAGE_NUM,
987 &lp->fd_buf_dma);
988 if (!lp->fd_buf)
984 return -ENOMEM; 989 return -ENOMEM;
985 for (i = 0; i < RX_BUF_NUM; i++) { 990 for (i = 0; i < RX_BUF_NUM; i++) {
986#ifdef TC35815_USE_PACKEDBUFFER 991#ifdef TC35815_USE_PACKEDBUFFER
987 if ((lp->data_buf[i] = alloc_rxbuf_page(lp->pci_dev, &lp->data_buf_dma[i])) == NULL) { 992 lp->data_buf[i] =
993 alloc_rxbuf_page(lp->pci_dev,
994 &lp->data_buf_dma[i]);
995 if (!lp->data_buf[i]) {
988 while (--i >= 0) { 996 while (--i >= 0) {
989 free_rxbuf_page(lp->pci_dev, 997 free_rxbuf_page(lp->pci_dev,
990 lp->data_buf[i], 998 lp->data_buf[i],
@@ -1027,18 +1035,17 @@ tc35815_init_queues(struct net_device *dev)
1027#endif 1035#endif
1028 printk("\n"); 1036 printk("\n");
1029 } else { 1037 } else {
1030 for (i = 0; i < FD_PAGE_NUM; i++) { 1038 for (i = 0; i < FD_PAGE_NUM; i++)
1031 clear_page((void *)((unsigned long)lp->fd_buf + i * PAGE_SIZE)); 1039 clear_page((void *)((unsigned long)lp->fd_buf +
1032 } 1040 i * PAGE_SIZE));
1033 } 1041 }
1034 fd_addr = (unsigned long)lp->fd_buf; 1042 fd_addr = (unsigned long)lp->fd_buf;
1035 1043
1036 /* Free Descriptors (for Receive) */ 1044 /* Free Descriptors (for Receive) */
1037 lp->rfd_base = (struct RxFD *)fd_addr; 1045 lp->rfd_base = (struct RxFD *)fd_addr;
1038 fd_addr += sizeof(struct RxFD) * RX_FD_NUM; 1046 fd_addr += sizeof(struct RxFD) * RX_FD_NUM;
1039 for (i = 0; i < RX_FD_NUM; i++) { 1047 for (i = 0; i < RX_FD_NUM; i++)
1040 lp->rfd_base[i].fd.FDCtl = cpu_to_le32(FD_CownsFD); 1048 lp->rfd_base[i].fd.FDCtl = cpu_to_le32(FD_CownsFD);
1041 }
1042 lp->rfd_cur = lp->rfd_base; 1049 lp->rfd_cur = lp->rfd_base;
1043 lp->rfd_limit = (struct RxFD *)fd_addr - (RX_FD_RESERVE + 1); 1050 lp->rfd_limit = (struct RxFD *)fd_addr - (RX_FD_RESERVE + 1);
1044 1051
@@ -1218,7 +1225,7 @@ dump_rxfd(struct RxFD *fd)
1218 le32_to_cpu(fd->fd.FDStat), 1225 le32_to_cpu(fd->fd.FDStat),
1219 le32_to_cpu(fd->fd.FDCtl)); 1226 le32_to_cpu(fd->fd.FDCtl));
1220 if (le32_to_cpu(fd->fd.FDCtl) & FD_CownsFD) 1227 if (le32_to_cpu(fd->fd.FDCtl) & FD_CownsFD)
1221 return 0; 1228 return 0;
1222 printk("BD: "); 1229 printk("BD: ");
1223 for (i = 0; i < bd_count; i++) 1230 for (i = 0; i < bd_count; i++)
1224 printk(" %08x %08x", 1231 printk(" %08x %08x",
@@ -1366,9 +1373,9 @@ tc35815_open(struct net_device *dev)
1366 * This is used if the interrupt line can turned off (shared). 1373 * This is used if the interrupt line can turned off (shared).
1367 * See 3c503.c for an example of selecting the IRQ at config-time. 1374 * See 3c503.c for an example of selecting the IRQ at config-time.
1368 */ 1375 */
1369 if (request_irq(dev->irq, &tc35815_interrupt, IRQF_SHARED, dev->name, dev)) { 1376 if (request_irq(dev->irq, &tc35815_interrupt, IRQF_SHARED,
1377 dev->name, dev))
1370 return -EAGAIN; 1378 return -EAGAIN;
1371 }
1372 1379
1373 tc35815_chip_reset(dev); 1380 tc35815_chip_reset(dev);
1374 1381
@@ -2050,7 +2057,7 @@ tc35815_txdone(struct net_device *dev)
2050 struct tc35815_regs __iomem *tr = 2057 struct tc35815_regs __iomem *tr =
2051 (struct tc35815_regs __iomem *)dev->base_addr; 2058 (struct tc35815_regs __iomem *)dev->base_addr;
2052 int head = (lp->tfd_start + TX_FD_NUM - 1) % TX_FD_NUM; 2059 int head = (lp->tfd_start + TX_FD_NUM - 1) % TX_FD_NUM;
2053 struct TxFD* txhead = &lp->tfd_base[head]; 2060 struct TxFD *txhead = &lp->tfd_base[head];
2054 int qlen = (lp->tfd_start + TX_FD_NUM 2061 int qlen = (lp->tfd_start + TX_FD_NUM
2055 - lp->tfd_end) % TX_FD_NUM; 2062 - lp->tfd_end) % TX_FD_NUM;
2056 2063
@@ -2085,7 +2092,7 @@ tc35815_txdone(struct net_device *dev)
2085 * condition, and space has now been made available, 2092 * condition, and space has now been made available,
2086 * wake up the queue. 2093 * wake up the queue.
2087 */ 2094 */
2088 if (netif_queue_stopped(dev) && ! tc35815_tx_full(dev)) 2095 if (netif_queue_stopped(dev) && !tc35815_tx_full(dev))
2089 netif_wake_queue(dev); 2096 netif_wake_queue(dev);
2090} 2097}
2091 2098
@@ -2182,8 +2189,7 @@ tc35815_set_multicast_list(struct net_device *dev)
2182 struct tc35815_regs __iomem *tr = 2189 struct tc35815_regs __iomem *tr =
2183 (struct tc35815_regs __iomem *)dev->base_addr; 2190 (struct tc35815_regs __iomem *)dev->base_addr;
2184 2191
2185 if (dev->flags&IFF_PROMISC) 2192 if (dev->flags & IFF_PROMISC) {
2186 {
2187#ifdef WORKAROUND_100HALF_PROMISC 2193#ifdef WORKAROUND_100HALF_PROMISC
2188 /* With some (all?) 100MHalf HUB, controller will hang 2194 /* With some (all?) 100MHalf HUB, controller will hang
2189 * if we enabled promiscuous mode before linkup... */ 2195 * if we enabled promiscuous mode before linkup... */
@@ -2194,16 +2200,13 @@ tc35815_set_multicast_list(struct net_device *dev)
2194#endif 2200#endif
2195 /* Enable promiscuous mode */ 2201 /* Enable promiscuous mode */
2196 tc_writel(CAM_CompEn | CAM_BroadAcc | CAM_GroupAcc | CAM_StationAcc, &tr->CAM_Ctl); 2202 tc_writel(CAM_CompEn | CAM_BroadAcc | CAM_GroupAcc | CAM_StationAcc, &tr->CAM_Ctl);
2197 } 2203 } else if ((dev->flags & IFF_ALLMULTI) ||
2198 else if((dev->flags&IFF_ALLMULTI) || dev->mc_count > CAM_ENTRY_MAX - 3) 2204 dev->mc_count > CAM_ENTRY_MAX - 3) {
2199 {
2200 /* CAM 0, 1, 20 are reserved. */ 2205 /* CAM 0, 1, 20 are reserved. */
2201 /* Disable promiscuous mode, use normal mode. */ 2206 /* Disable promiscuous mode, use normal mode. */
2202 tc_writel(CAM_CompEn | CAM_BroadAcc | CAM_GroupAcc, &tr->CAM_Ctl); 2207 tc_writel(CAM_CompEn | CAM_BroadAcc | CAM_GroupAcc, &tr->CAM_Ctl);
2203 } 2208 } else if (dev->mc_count) {
2204 else if(dev->mc_count) 2209 struct dev_mc_list *cur_addr = dev->mc_list;
2205 {
2206 struct dev_mc_list* cur_addr = dev->mc_list;
2207 int i; 2210 int i;
2208 int ena_bits = CAM_Ena_Bit(CAM_ENTRY_SOURCE); 2211 int ena_bits = CAM_Ena_Bit(CAM_ENTRY_SOURCE);
2209 2212
@@ -2218,8 +2221,7 @@ tc35815_set_multicast_list(struct net_device *dev)
2218 } 2221 }
2219 tc_writel(ena_bits, &tr->CAM_Ena); 2222 tc_writel(ena_bits, &tr->CAM_Ena);
2220 tc_writel(CAM_CompEn | CAM_BroadAcc, &tr->CAM_Ctl); 2223 tc_writel(CAM_CompEn | CAM_BroadAcc, &tr->CAM_Ctl);
2221 } 2224 } else {
2222 else {
2223 tc_writel(CAM_Ena_Bit(CAM_ENTRY_SOURCE), &tr->CAM_Ena); 2225 tc_writel(CAM_Ena_Bit(CAM_ENTRY_SOURCE), &tr->CAM_Ena);
2224 tc_writel(CAM_CompEn | CAM_BroadAcc, &tr->CAM_Ctl); 2226 tc_writel(CAM_CompEn | CAM_BroadAcc, &tr->CAM_Ctl);
2225 } 2227 }