Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
dmfe.c File Reference
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/ptrace.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/skbuff.h>
#include <linux/delay.h>
#include <linux/spinlock.h>
#include <linux/crc32.h>
#include <linux/bitops.h>
#include <asm/processor.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <asm/uaccess.h>
#include <asm/irq.h>

Go to the source code of this file.

Data Structures

struct  tx_desc
 
struct  rx_desc
 
struct  dmfe_board_info
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define DRV_NAME   "dmfe"
 
#define DRV_VERSION   "1.36.4"
 
#define DRV_RELDATE   "2002-01-17"
 
#define PCI_DM9132_ID   0x91321282 /* Davicom DM9132 ID */
 
#define PCI_DM9102_ID   0x91021282 /* Davicom DM9102 ID */
 
#define PCI_DM9100_ID   0x91001282 /* Davicom DM9100 ID */
 
#define PCI_DM9009_ID   0x90091282 /* Davicom DM9009 ID */
 
#define DM9102_IO_SIZE   0x80
 
#define DM9102A_IO_SIZE   0x100
 
#define TX_MAX_SEND_CNT   0x1 /* Maximum tx packet per time */
 
#define TX_DESC_CNT   0x10 /* Allocated Tx descriptors */
 
#define RX_DESC_CNT   0x20 /* Allocated Rx descriptors */
 
#define TX_FREE_DESC_CNT   (TX_DESC_CNT - 2) /* Max TX packet count */
 
#define TX_WAKE_DESC_CNT   (TX_DESC_CNT - 3) /* TX wakeup count */
 
#define DESC_ALL_CNT   (TX_DESC_CNT + RX_DESC_CNT)
 
#define TX_BUF_ALLOC   0x600
 
#define RX_ALLOC_SIZE   0x620
 
#define DM910X_RESET   1
 
#define CR0_DEFAULT   0x00E00000 /* TX & RX burst mode */
 
#define CR6_DEFAULT   0x00080000 /* HD */
 
#define CR7_DEFAULT   0x180c1
 
#define CR15_DEFAULT   0x06 /* TxJabber RxWatchdog */
 
#define TDES0_ERR_MASK   0x4302 /* TXJT, LC, EC, FUE */
 
#define MAX_PACKET_SIZE   1514
 
#define DMFE_MAX_MULTICAST   14
 
#define RX_COPY_SIZE   100
 
#define MAX_CHECK_PACKET   0x8000
 
#define DM9801_NOISE_FLOOR   8
 
#define DM9802_NOISE_FLOOR   5
 
#define DMFE_WOL_LINKCHANGE   0x20000000
 
#define DMFE_WOL_SAMPLEPACKET   0x10000000
 
#define DMFE_WOL_MAGICPACKET   0x08000000
 
#define DMFE_10MHF   0
 
#define DMFE_100MHF   1
 
#define DMFE_10MFD   4
 
#define DMFE_100MFD   5
 
#define DMFE_AUTO   8
 
#define DMFE_1M_HPNA   0x10
 
#define DMFE_TXTH_72   0x400000 /* TX TH 72 byte */
 
#define DMFE_TXTH_96   0x404000 /* TX TH 96 byte */
 
#define DMFE_TXTH_128   0x0000 /* TX TH 128 byte */
 
#define DMFE_TXTH_256   0x4000 /* TX TH 256 byte */
 
#define DMFE_TXTH_512   0x8000 /* TX TH 512 byte */
 
#define DMFE_TXTH_1K   0xC000 /* TX TH 1K byte */
 
#define DMFE_TIMER_WUT   (jiffies + HZ * 1)/* timer wakeup time : 1 second */
 
#define DMFE_TX_TIMEOUT   ((3*HZ)/2) /* tx packet time-out time 1.5 s" */
 
#define DMFE_TX_KICK   (HZ/2) /* tx packet Kick-out time 0.5 s" */
 
#define dw32(reg, val)   iowrite32(val, ioaddr + (reg))
 
#define dw16(reg, val)   iowrite16(val, ioaddr + (reg))
 
#define dr32(reg)   ioread32(ioaddr + (reg))
 
#define dr16(reg)   ioread16(ioaddr + (reg))
 
#define dr8(reg)   ioread8(ioaddr + (reg))
 
#define DMFE_DBUG(dbug_now, msg, value)
 
#define SHOW_MEDIA_TYPE(mode)
 
#define CR9_SROM_READ   0x4800
 
#define CR9_SRCS   0x1
 
#define CR9_SRCLK   0x2
 
#define CR9_CRDOUT   0x8
 
#define SROM_DATA_0   0x0
 
#define SROM_DATA_1   0x4
 
#define PHY_DATA_1   0x20000
 
#define PHY_DATA_0   0x00000
 
#define MDCLKH   0x10000
 
#define PHY_POWER_DOWN   0x800
 
#define SROM_V41_CODE   0x14
 
#define __CHK_IO_SIZE(pci_id, dev_rev)
 
#define CHK_IO_SIZE(pci_dev)
 
#define DEVICE   net_device
 
#define dmfe_suspend   NULL
 
#define dmfe_resume   NULL
 

Enumerations

enum  dmfe_offsets {
  DCR0 = 0x00, DCR1 = 0x08, DCR2 = 0x10, DCR3 = 0x18,
  DCR4 = 0x20, DCR5 = 0x28, DCR6 = 0x30, DCR7 = 0x38,
  DCR8 = 0x40, DCR9 = 0x48, DCR10 = 0x50, DCR11 = 0x58,
  DCR12 = 0x60, DCR13 = 0x68, DCR14 = 0x70, DCR15 = 0x78
}
 
enum  dmfe_CR6_bits {
  CR6_RXSC = 0x2, CR6_PBF = 0x8, CR6_PM = 0x40, CR6_PAM = 0x80,
  CR6_FDM = 0x200, CR6_TXSC = 0x2000, CR6_STI = 0x100000, CR6_SFT = 0x200000,
  CR6_RXA = 0x40000000, CR6_NO_PURGE = 0x20000000
}
 

Functions

struct tx_desc __attribute__ ((aligned(32)))
 
 MODULE_DEVICE_TABLE (pci, dmfe_pci_tbl)
 
 MODULE_AUTHOR ("Sten Wang, [email protected]")
 
 MODULE_DESCRIPTION ("Davicom DM910X fast ethernet driver")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_VERSION (DRV_VERSION)
 
 module_param (debug, int, 0)
 
 module_param (mode, byte, 0)
 
 module_param (cr6set, int, 0)
 
 module_param (chkmode, byte, 0)
 
 module_param (HPNA_mode, byte, 0)
 
 module_param (HPNA_rx_cmd, byte, 0)
 
 module_param (HPNA_tx_cmd, byte, 0)
 
 module_param (HPNA_NoiseFloor, byte, 0)
 
 module_param (SF_mode, byte, 0)
 
 MODULE_PARM_DESC (debug,"Davicom DM9xxx enable debugging (0-1)")
 
 MODULE_PARM_DESC (mode,"Davicom DM9xxx: ""Bit 0: 10/100Mbps, bit 2: duplex, bit 8: HomePNA")
 
 MODULE_PARM_DESC (SF_mode,"Davicom DM9xxx special function ""(bit 0: VLAN, bit 1 Flow Control, bit 2: TX pause packet)")
 
 module_init (dmfe_init_module)
 
 module_exit (dmfe_cleanup_module)
 

Variables

__le32 tdes0
 
__le32 tdes1
 
__le32 tdes2
 
__le32 tdes3
 
chartx_buf_ptr
 
struct tx_descnext_tx_desc
 
__le32 rdes0
 
__le32 rdes1
 
__le32 rdes2
 
__le32 rdes3
 
struct sk_buffrx_skb_ptr
 
struct rx_descnext_rx_desc
 
struct dmfe_board_info __attribute__
 

Macro Definition Documentation

#define __CHK_IO_SIZE (   pci_id,
  dev_rev 
)
Value:
(( ((pci_id)==PCI_DM9132_ID) || ((dev_rev) >= 0x30) ) ? \

Definition at line 187 of file dmfe.c.

#define CHK_IO_SIZE (   pci_dev)
Value:

Definition at line 191 of file dmfe.c.

#define CR0_DEFAULT   0x00E00000 /* TX & RX burst mode */

Definition at line 118 of file dmfe.c.

#define CR15_DEFAULT   0x06 /* TxJabber RxWatchdog */

Definition at line 121 of file dmfe.c.

#define CR6_DEFAULT   0x00080000 /* HD */

Definition at line 119 of file dmfe.c.

#define CR7_DEFAULT   0x180c1

Definition at line 120 of file dmfe.c.

#define CR9_CRDOUT   0x8

Definition at line 176 of file dmfe.c.

#define CR9_SRCLK   0x2

Definition at line 175 of file dmfe.c.

#define CR9_SRCS   0x1

Definition at line 174 of file dmfe.c.

#define CR9_SROM_READ   0x4800

Definition at line 173 of file dmfe.c.

#define DESC_ALL_CNT   (TX_DESC_CNT + RX_DESC_CNT)

Definition at line 114 of file dmfe.c.

#define DEVICE   net_device

Definition at line 196 of file dmfe.c.

#define DM9102_IO_SIZE   0x80

Definition at line 107 of file dmfe.c.

#define DM9102A_IO_SIZE   0x100

Definition at line 108 of file dmfe.c.

#define DM910X_RESET   1

Definition at line 117 of file dmfe.c.

#define DM9801_NOISE_FLOOR   8

Definition at line 127 of file dmfe.c.

#define DM9802_NOISE_FLOOR   5

Definition at line 128 of file dmfe.c.

#define DMFE_100MFD   5

Definition at line 138 of file dmfe.c.

#define DMFE_100MHF   1

Definition at line 136 of file dmfe.c.

#define DMFE_10MFD   4

Definition at line 137 of file dmfe.c.

#define DMFE_10MHF   0

Definition at line 135 of file dmfe.c.

#define DMFE_1M_HPNA   0x10

Definition at line 140 of file dmfe.c.

#define DMFE_AUTO   8

Definition at line 139 of file dmfe.c.

#define DMFE_DBUG (   dbug_now,
  msg,
  value 
)
Value:
do { \
if (dmfe_debug || (dbug_now)) \
pr_err("%s %lx\n", \
(msg), (long) (value)); \
} while (0)

Definition at line 159 of file dmfe.c.

#define DMFE_MAX_MULTICAST   14

Definition at line 124 of file dmfe.c.

#define dmfe_resume   NULL

Definition at line 2183 of file dmfe.c.

#define dmfe_suspend   NULL

Definition at line 2182 of file dmfe.c.

#define DMFE_TIMER_WUT   (jiffies + HZ * 1)/* timer wakeup time : 1 second */

Definition at line 149 of file dmfe.c.

#define DMFE_TX_KICK   (HZ/2) /* tx packet Kick-out time 0.5 s" */

Definition at line 151 of file dmfe.c.

#define DMFE_TX_TIMEOUT   ((3*HZ)/2) /* tx packet time-out time 1.5 s" */

Definition at line 150 of file dmfe.c.

#define DMFE_TXTH_128   0x0000 /* TX TH 128 byte */

Definition at line 144 of file dmfe.c.

#define DMFE_TXTH_1K   0xC000 /* TX TH 1K byte */

Definition at line 147 of file dmfe.c.

#define DMFE_TXTH_256   0x4000 /* TX TH 256 byte */

Definition at line 145 of file dmfe.c.

#define DMFE_TXTH_512   0x8000 /* TX TH 512 byte */

Definition at line 146 of file dmfe.c.

#define DMFE_TXTH_72   0x400000 /* TX TH 72 byte */

Definition at line 142 of file dmfe.c.

#define DMFE_TXTH_96   0x404000 /* TX TH 96 byte */

Definition at line 143 of file dmfe.c.

#define DMFE_WOL_LINKCHANGE   0x20000000

Definition at line 130 of file dmfe.c.

#define DMFE_WOL_MAGICPACKET   0x08000000

Definition at line 132 of file dmfe.c.

#define DMFE_WOL_SAMPLEPACKET   0x10000000

Definition at line 131 of file dmfe.c.

#define dr16 (   reg)    ioread16(ioaddr + (reg))

Definition at line 156 of file dmfe.c.

#define dr32 (   reg)    ioread32(ioaddr + (reg))

Definition at line 155 of file dmfe.c.

#define dr8 (   reg)    ioread8(ioaddr + (reg))

Definition at line 157 of file dmfe.c.

#define DRV_NAME   "dmfe"

Definition at line 66 of file dmfe.c.

#define DRV_RELDATE   "2002-01-17"

Definition at line 68 of file dmfe.c.

#define DRV_VERSION   "1.36.4"

Definition at line 67 of file dmfe.c.

#define dw16 (   reg,
  val 
)    iowrite16(val, ioaddr + (reg))

Definition at line 154 of file dmfe.c.

#define dw32 (   reg,
  val 
)    iowrite32(val, ioaddr + (reg))

Definition at line 153 of file dmfe.c.

#define MAX_CHECK_PACKET   0x8000

Definition at line 126 of file dmfe.c.

#define MAX_PACKET_SIZE   1514

Definition at line 123 of file dmfe.c.

#define MDCLKH   0x10000

Definition at line 181 of file dmfe.c.

#define PCI_DM9009_ID   0x90091282 /* Davicom DM9009 ID */

Definition at line 105 of file dmfe.c.

#define PCI_DM9100_ID   0x91001282 /* Davicom DM9100 ID */

Definition at line 104 of file dmfe.c.

#define PCI_DM9102_ID   0x91021282 /* Davicom DM9102 ID */

Definition at line 103 of file dmfe.c.

#define PCI_DM9132_ID   0x91321282 /* Davicom DM9132 ID */

Definition at line 102 of file dmfe.c.

#define PHY_DATA_0   0x00000

Definition at line 180 of file dmfe.c.

#define PHY_DATA_1   0x20000

Definition at line 179 of file dmfe.c.

#define PHY_POWER_DOWN   0x800

Definition at line 183 of file dmfe.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 64 of file dmfe.c.

#define RX_ALLOC_SIZE   0x620

Definition at line 116 of file dmfe.c.

#define RX_COPY_SIZE   100

Definition at line 125 of file dmfe.c.

#define RX_DESC_CNT   0x20 /* Allocated Rx descriptors */

Definition at line 111 of file dmfe.c.

#define SHOW_MEDIA_TYPE (   mode)
Value:
pr_info("Change Speed to %sMhz %s duplex\n" , \
(mode & 1) ? "100":"10", \
(mode & 4) ? "full":"half");

Definition at line 166 of file dmfe.c.

#define SROM_DATA_0   0x0

Definition at line 177 of file dmfe.c.

#define SROM_DATA_1   0x4

Definition at line 178 of file dmfe.c.

#define SROM_V41_CODE   0x14

Definition at line 185 of file dmfe.c.

#define TDES0_ERR_MASK   0x4302 /* TXJT, LC, EC, FUE */

Definition at line 122 of file dmfe.c.

#define TX_BUF_ALLOC   0x600

Definition at line 115 of file dmfe.c.

#define TX_DESC_CNT   0x10 /* Allocated Tx descriptors */

Definition at line 110 of file dmfe.c.

#define TX_FREE_DESC_CNT   (TX_DESC_CNT - 2) /* Max TX packet count */

Definition at line 112 of file dmfe.c.

#define TX_MAX_SEND_CNT   0x1 /* Maximum tx packet per time */

Definition at line 109 of file dmfe.c.

#define TX_WAKE_DESC_CNT   (TX_DESC_CNT - 3) /* TX wakeup count */

Definition at line 113 of file dmfe.c.

Enumeration Type Documentation

Enumerator:
CR6_RXSC 
CR6_PBF 
CR6_PM 
CR6_PAM 
CR6_FDM 
CR6_TXSC 
CR6_STI 
CR6_SFT 
CR6_RXA 
CR6_NO_PURGE 

Definition at line 287 of file dmfe.c.

Enumerator:
DCR0 
DCR1 
DCR2 
DCR3 
DCR4 
DCR5 
DCR6 
DCR7 
DCR8 
DCR9 
DCR10 
DCR11 
DCR12 
DCR13 
DCR14 
DCR15 

Definition at line 280 of file dmfe.c.

Function Documentation

MODULE_AUTHOR ( "Sten  Wang,
sten_wang @davicom.com.tw"   
)
MODULE_DESCRIPTION ( "Davicom DM910X fast ethernet driver )
MODULE_DEVICE_TABLE ( pci  ,
dmfe_pci_tbl   
)
module_exit ( dmfe_cleanup_module  )
module_init ( dmfe_init_module  )
MODULE_LICENSE ( "GPL"  )
module_param ( debug  ,
int  ,
 
)
module_param ( mode  ,
byte  ,
 
)
module_param ( cr6set  ,
int  ,
 
)
module_param ( chkmode  ,
byte  ,
 
)
module_param ( HPNA_mode  ,
byte  ,
 
)
module_param ( HPNA_rx_cmd  ,
byte  ,
 
)
module_param ( HPNA_tx_cmd  ,
byte  ,
 
)
module_param ( HPNA_NoiseFloor  ,
byte  ,
 
)
module_param ( SF_mode  ,
byte  ,
 
)
MODULE_PARM_DESC ( debug  ,
"Davicom DM9xxx enable debugging (0-1)"   
)
MODULE_PARM_DESC ( mode  ,
"Davicom DM9xxx: ""Bit 0: 10/  100Mbps,
bit 2:duplex  ,
bit 8:HomePNA"   
)
MODULE_PARM_DESC ( SF_mode  ,
"Davicom DM9xxx special function ""(bit 0: VLAN, bit 1 Flow Control, bit 2: TX pause packet)"   
)
MODULE_VERSION ( DRV_VERSION  )

Variable Documentation

struct rx_desc* next_rx_desc

Definition at line 212 of file dmfe.c.

struct tx_desc* next_tx_desc

Definition at line 206 of file dmfe.c.

__le32 rdes0

Definition at line 210 of file dmfe.c.

__le32 rdes1

Definition at line 210 of file dmfe.c.

__le32 rdes2

Definition at line 210 of file dmfe.c.

__le32 rdes3

Definition at line 210 of file dmfe.c.

struct sk_buff* rx_skb_ptr

Definition at line 211 of file dmfe.c.

__le32 tdes0

Definition at line 204 of file dmfe.c.

__le32 tdes1

Definition at line 204 of file dmfe.c.

__le32 tdes2

Definition at line 204 of file dmfe.c.

__le32 tdes3

Definition at line 204 of file dmfe.c.

char* tx_buf_ptr

Definition at line 205 of file dmfe.c.