Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
sc92031.c File Reference
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/crc32.h>
#include <asm/irq.h>

Go to the source code of this file.

Data Structures

struct  sc92031_priv
 

Macros

#define SC92031_NAME   "sc92031"
 
#define SC92031_USE_PIO   0
 
#define RX_BUF_LEN_IDX   3 /* 0==8K, 1==16K, 2==32K, 3==64K ,4==128K*/
 
#define RX_BUF_LEN   (8192 << RX_BUF_LEN_IDX)
 
#define NUM_TX_DESC   4
 
#define MAX_ETH_FRAME_SIZE   1536
 
#define TX_BUF_SIZE   MAX_ETH_FRAME_SIZE
 
#define TX_BUF_TOT_LEN   (TX_BUF_SIZE * NUM_TX_DESC)
 
#define RX_FIFO_THRESH   7 /* Rx buffer level before first PCI xfer. */
 
#define TX_TIMEOUT   (4*HZ)
 
#define SILAN_STATS_NUM   2 /* number of ETHTOOL_GSTATS */
 
#define AUTOSELECT   0x00
 
#define M10_HALF   0x01
 
#define M10_FULL   0x02
 
#define M100_HALF   0x04
 
#define M100_FULL   0x08
 
#define MII_JAB   16
 
#define MII_OutputStatus   24
 
#define PHY_16_JAB_ENB   0x1000
 
#define PHY_16_PORT_ENB   0x1
 

Enumerations

enum  silan_registers {
  Config0 = 0x00, Config1 = 0x04, RxBufWPtr = 0x08, IntrStatus = 0x0C,
  IntrMask = 0x10, RxbufAddr = 0x14, RxBufRPtr = 0x18, Txstatusall = 0x1C,
  TxStatus0 = 0x20, TxAddr0 = 0x30, RxConfig = 0x40, MAC0 = 0x44,
  MAR0 = 0x4C, RxStatus0 = 0x54, TxConfig = 0x5C, PhyCtrl = 0x60,
  FlowCtrlConfig = 0x64, Miicmd0 = 0x68, Miicmd1 = 0x6C, Miistatus = 0x70,
  Timercnt = 0x74, TimerIntr = 0x78, PMConfig = 0x7C, CRC0 = 0x80,
  Wakeup0 = 0x88, LSBCRC0 = 0xC8, TestD0 = 0xD0, TestD4 = 0xD4,
  TestD8 = 0xD8
}
 
enum  IntrStatusBits {
  PCIErr = 0x8000, PCSTimeout = 0x4000, RxFIFOOver = 0x40, RxUnderrun = 0x20,
  RxOverflow = 0x10, TxErr = 0x08, TxOK = 0x04, RxErr = 0x02,
  RxOK = 0x01, RxAckBits = RxFIFOOver | RxOverflow | RxOK, LinkFail = 0x80000000, LinkOK = 0x40000000,
  TimeOut = 0x20000000, RxOverflow = 0x0040, RxOK = 0x0020, TxOK = 0x0001,
  IntrBits = LinkFail|LinkOK|TimeOut|RxOverflow|RxOK|TxOK
}
 
enum  TxStatusBits {
  TxHostOwns = 0x2000, TxUnderrun = 0x4000, TxStatOK = 0x8000, TxOutOfWindow = 0x20000000,
  TxAborted = 0x40000000, TxCarrierLost = 0x80000000, TxCarrierLost = 0x20000000, TxAborted = 0x10000000,
  TxOutOfWindow = 0x08000000, TxNccShift = 22, EarlyTxThresShift = 16, TxStatOK = 0x8000,
  TxUnderrun = 0x4000, TxOwn = 0x2000
}
 
enum  RxStatusBits {
  RxMulticast = 0x8000, RxPhysical = 0x4000, RxBroadcast = 0x2000, RxBadSymbol = 0x0020,
  RxRunt = 0x0010, RxTooLong = 0x0008, RxCRCErr = 0x0004, RxBadAlign = 0x0002,
  RxStatusOK = 0x0001, RxStatesOK = 0x80000, RxBadAlign = 0x40000, RxHugeFrame = 0x20000,
  RxSmallFrame = 0x10000, RxCRCOK = 0x8000, RxCrlFrame = 0x4000, Rx_Broadcast = 0x2000,
  Rx_Multicast = 0x1000, RxAddrMatch = 0x0800, MiiErr = 0x0400
}
 
enum  RxConfigBits {
  RxCfgFIFOShift = 13, RxCfgFIFONone = (7 << RxCfgFIFOShift), RxCfgDMAShift = 8, RxCfgDMAUnlimited = (7 << RxCfgDMAShift),
  RxCfgRcv8K = 0, RxCfgRcv16K = (1 << 11), RxCfgRcv32K = (1 << 12), RxCfgRcv64K = (1 << 11) | (1 << 12),
  RxNoWrap = (1 << 7), RxFullDx = 0x80000000, RxEnb = 0x40000000, RxSmall = 0x20000000,
  RxHuge = 0x10000000, RxErr = 0x08000000, RxAllphys = 0x04000000, RxMulticast = 0x02000000,
  RxBroadcast = 0x01000000, RxLoopBack = (1 << 23) | (1 << 22), LowThresholdShift = 12, HighThresholdShift = 2
}
 
enum  TxConfigBits {
  TxFullDx = 0x80000000, TxEnb = 0x40000000, TxEnbPad = 0x20000000, TxEnbHuge = 0x10000000,
  TxEnbFCS = 0x08000000, TxNoBackOff = 0x04000000, TxEnbPrem = 0x02000000, TxCareLostCrs = 0x1000000,
  TxExdCollNum = 0xf00000, TxDataRate = 0x80000
}
 
enum  PhyCtrlconfigbits {
  PhyCtrlAne = 0x80000000, PhyCtrlSpd100 = 0x40000000, PhyCtrlSpd10 = 0x20000000, PhyCtrlPhyBaseAddr = 0x1f000000,
  PhyCtrlDux = 0x800000, PhyCtrlReset = 0x400000
}
 
enum  FlowCtrlConfigBits { FlowCtrlFullDX = 0x80000000, FlowCtrlEnb = 0x40000000 }
 
enum  Config0Bits { Cfg0_Reset = 0x80000000, Cfg0_Anaoff = 0x40000000, Cfg0_LDPS = 0x20000000 }
 
enum  Config1Bits {
  Cfg1_PM_Enable = 0x01, Cfg1_VPD_Enable = 0x02, Cfg1_PIO = 0x04, Cfg1_MMIO = 0x08,
  LWAKE = 0x10, Cfg1_Driver_Load = 0x20, Cfg1_LED0 = 0x40, Cfg1_LED1 = 0x80,
  SLEEP = (1 << 1), PWRDN = (1 << 0), Cfg1_EarlyRx = 1 << 31, Cfg1_EarlyTx = 1 << 30,
  Cfg1_Rcv8K = 0x0, Cfg1_Rcv16K = 0x1, Cfg1_Rcv32K = 0x3, Cfg1_Rcv64K = 0x7,
  Cfg1_Rcv128K = 0xf
}
 
enum  MiiCmd0Bits {
  Mii_Divider = 0x20000000, Mii_WRITE = 0x400000, Mii_READ = 0x200000, Mii_SCAN = 0x100000,
  Mii_Tamod = 0x80000, Mii_Drvmod = 0x40000, Mii_mdc = 0x20000, Mii_mdoen = 0x10000,
  Mii_mdo = 0x8000, Mii_mdi = 0x4000
}
 
enum  MiiStatusBits { Mii_StatusBusy = 0x80000000 }
 
enum  PMConfigBits {
  PM_Enable = 1 << 31, PM_LongWF = 1 << 30, PM_Magic = 1 << 29, PM_LANWake = 1 << 28,
  PM_LWPTN = (1 << 27 | 1<< 26), PM_LinkUp = 1 << 25, PM_WakeUp = 1 << 24
}
 

Functions

 module_param (multicast_filter_limit, int, 0)
 
 MODULE_PARM_DESC (multicast_filter_limit,"Maximum number of filtered multicast addresses")
 
 module_param (media, int, 0)
 
 MODULE_PARM_DESC (media,"Media type (0x00 = autodetect,"" 0x01 = 10M half, 0x02 = 10M full,"" 0x04 = 100M half, 0x08 = 100M full)")
 
 MODULE_DEVICE_TABLE (pci, sc92031_pci_device_id_table)
 
 module_init (sc92031_init)
 
 module_exit (sc92031_exit)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_AUTHOR ("Cesar Eduardo Barros <[email protected]>")
 
 MODULE_DESCRIPTION ("Silan SC92031 PCI Fast Ethernet Adapter driver")
 

Macro Definition Documentation

#define AUTOSELECT   0x00

Definition at line 79 of file sc92031.c.

#define M100_FULL   0x08

Definition at line 83 of file sc92031.c.

#define M100_HALF   0x04

Definition at line 82 of file sc92031.c.

#define M10_FULL   0x02

Definition at line 81 of file sc92031.c.

#define M10_HALF   0x01

Definition at line 80 of file sc92031.c.

#define MAX_ETH_FRAME_SIZE   1536

Definition at line 64 of file sc92031.c.

#define MII_JAB   16

Definition at line 118 of file sc92031.c.

#define MII_OutputStatus   24

Definition at line 119 of file sc92031.c.

#define NUM_TX_DESC   4

Definition at line 61 of file sc92031.c.

#define PHY_16_JAB_ENB   0x1000

Definition at line 121 of file sc92031.c.

#define PHY_16_PORT_ENB   0x1

Definition at line 122 of file sc92031.c.

#define RX_BUF_LEN   (8192 << RX_BUF_LEN_IDX)

Definition at line 58 of file sc92031.c.

#define RX_BUF_LEN_IDX   3 /* 0==8K, 1==16K, 2==32K, 3==64K ,4==128K*/

Definition at line 57 of file sc92031.c.

#define RX_FIFO_THRESH   7 /* Rx buffer level before first PCI xfer. */

Definition at line 71 of file sc92031.c.

#define SC92031_NAME   "sc92031"

Definition at line 39 of file sc92031.c.

#define SC92031_USE_PIO   0

Definition at line 42 of file sc92031.c.

#define SILAN_STATS_NUM   2 /* number of ETHTOOL_GSTATS */

Definition at line 76 of file sc92031.c.

#define TX_BUF_SIZE   MAX_ETH_FRAME_SIZE

Definition at line 67 of file sc92031.c.

#define TX_BUF_TOT_LEN   (TX_BUF_SIZE * NUM_TX_DESC)

Definition at line 68 of file sc92031.c.

#define TX_TIMEOUT   (4*HZ)

Definition at line 74 of file sc92031.c.

Enumeration Type Documentation

Enumerator:
Cfg0_Reset 
Cfg0_Anaoff 
Cfg0_LDPS 

Definition at line 199 of file sc92031.c.

Enumerator:
Cfg1_PM_Enable 
Cfg1_VPD_Enable 
Cfg1_PIO 
Cfg1_MMIO 
LWAKE 
Cfg1_Driver_Load 
Cfg1_LED0 
Cfg1_LED1 
SLEEP 
PWRDN 
Cfg1_EarlyRx 
Cfg1_EarlyTx 
Cfg1_Rcv8K 
Cfg1_Rcv16K 
Cfg1_Rcv32K 
Cfg1_Rcv64K 
Cfg1_Rcv128K 

Definition at line 205 of file sc92031.c.

Enumerator:
FlowCtrlFullDX 
FlowCtrlEnb 

Definition at line 194 of file sc92031.c.

Enumerator:
PCIErr 
PCSTimeout 
RxFIFOOver 
RxUnderrun 
RxOverflow 
TxErr 
TxOK 
RxErr 
RxOK 
RxAckBits 
LinkFail 
LinkOK 
TimeOut 
RxOverflow 
RxOK 
TxOK 
IntrBits 

Definition at line 124 of file sc92031.c.

Enumerator:
Mii_Divider 
Mii_WRITE 
Mii_READ 
Mii_SCAN 
Mii_Tamod 
Mii_Drvmod 
Mii_mdc 
Mii_mdoen 
Mii_mdo 
Mii_mdi 

Definition at line 217 of file sc92031.c.

Enumerator:
Mii_StatusBusy 

Definition at line 230 of file sc92031.c.

Enumerator:
PhyCtrlAne 
PhyCtrlSpd100 
PhyCtrlSpd10 
PhyCtrlPhyBaseAddr 
PhyCtrlDux 
PhyCtrlReset 

Definition at line 185 of file sc92031.c.

Enumerator:
PM_Enable 
PM_LongWF 
PM_Magic 
PM_LANWake 
PM_LWPTN 
PM_LinkUp 
PM_WakeUp 

Definition at line 234 of file sc92031.c.

Enumerator:
RxCfgFIFOShift 
RxCfgFIFONone 
RxCfgDMAShift 
RxCfgDMAUnlimited 
RxCfgRcv8K 
RxCfgRcv16K 
RxCfgRcv32K 
RxCfgRcv64K 
RxNoWrap 
RxFullDx 
RxEnb 
RxSmall 
RxHuge 
RxErr 
RxAllphys 
RxMulticast 
RxBroadcast 
RxLoopBack 
LowThresholdShift 
HighThresholdShift 

Definition at line 158 of file sc92031.c.

Enumerator:
RxMulticast 
RxPhysical 
RxBroadcast 
RxBadSymbol 
RxRunt 
RxTooLong 
RxCRCErr 
RxBadAlign 
RxStatusOK 
RxStatesOK 
RxBadAlign 
RxHugeFrame 
RxSmallFrame 
RxCRCOK 
RxCrlFrame 
Rx_Broadcast 
Rx_Multicast 
RxAddrMatch 
MiiErr 

Definition at line 145 of file sc92031.c.

Enumerator:
Config0 
Config1 
RxBufWPtr 
IntrStatus 
IntrMask 
RxbufAddr 
RxBufRPtr 
Txstatusall 
TxStatus0 
TxAddr0 
RxConfig 
MAC0 
MAR0 
RxStatus0 
TxConfig 
PhyCtrl 
FlowCtrlConfig 
Miicmd0 
Miicmd1 
Miistatus 
Timercnt 
TimerIntr 
PMConfig 
CRC0 
Wakeup0 
LSBCRC0 
TestD0 
TestD4 
TestD8 

Definition at line 86 of file sc92031.c.

Enumerator:
TxFullDx 
TxEnb 
TxEnbPad 
TxEnbHuge 
TxEnbFCS 
TxNoBackOff 
TxEnbPrem 
TxCareLostCrs 
TxExdCollNum 
TxDataRate 

Definition at line 172 of file sc92031.c.

Enumerator:
TxHostOwns 
TxUnderrun 
TxStatOK 
TxOutOfWindow 
TxAborted 
TxCarrierLost 
TxCarrierLost 
TxAborted 
TxOutOfWindow 
TxNccShift 
EarlyTxThresShift 
TxStatOK 
TxUnderrun 
TxOwn 

Definition at line 134 of file sc92031.c.

Function Documentation

MODULE_AUTHOR ( "Cesar Eduardo Barros <[email protected]>"  )
MODULE_DESCRIPTION ( "Silan SC92031 PCI Fast Ethernet Adapter driver )
MODULE_DEVICE_TABLE ( pci  ,
sc92031_pci_device_id_table   
)
module_exit ( sc92031_exit  )
module_init ( sc92031_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( multicast_filter_limit  ,
int  ,
 
)
module_param ( media  ,
int  ,
 
)
MODULE_PARM_DESC ( multicast_filter_limit  ,
"Maximum number of filtered multicast addresses"   
)
MODULE_PARM_DESC ( media  ,
"Media type (0x00 = autodetect,"" 0x01 = 10M half, 0x02 = 10M full,"" 0x04 = 100M half, 0x08 = 100M full)"   
)