Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
ixp4xx_eth.c File Reference
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/dmapool.h>
#include <linux/etherdevice.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/net_tstamp.h>
#include <linux/phy.h>
#include <linux/platform_device.h>
#include <linux/ptp_classify.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <mach/ixp46x_ts.h>
#include <mach/npe.h>
#include <mach/qmgr.h>

Go to the source code of this file.

Data Structures

struct  eth_regs
 
struct  port
 
struct  msg
 
struct  desc
 

Macros

#define DEBUG_DESC   0
 
#define DEBUG_RX   0
 
#define DEBUG_TX   0
 
#define DEBUG_PKT_BYTES   0
 
#define DEBUG_MDIO   0
 
#define DEBUG_CLOSE   0
 
#define DRV_NAME   "ixp4xx_eth"
 
#define MAX_NPES   3
 
#define RX_DESCS   64 /* also length of all RX queues */
 
#define TX_DESCS   16 /* also length of all TX queues */
 
#define TXDONE_QUEUE_LEN   64 /* dwords */
 
#define POOL_ALLOC_SIZE   (sizeof(struct desc) * (RX_DESCS + TX_DESCS))
 
#define REGS_SIZE   0x1000
 
#define MAX_MRU   1536 /* 0x600 */
 
#define RX_BUFF_SIZE   ALIGN((NET_IP_ALIGN) + MAX_MRU, 4)
 
#define NAPI_WEIGHT   16
 
#define MDIO_INTERVAL   (3 * HZ)
 
#define MAX_MDIO_RETRIES   100 /* microseconds, typically 30 cycles */
 
#define MAX_CLOSE_WAIT   1000 /* microseconds, typically 2-3 cycles */
 
#define NPE_ID(port_id)   ((port_id) >> 4)
 
#define PHYSICAL_ID(port_id)   ((NPE_ID(port_id) + 2) % 3)
 
#define TX_QUEUE(port_id)   (NPE_ID(port_id) + 23)
 
#define RXFREE_QUEUE(port_id)   (NPE_ID(port_id) + 26)
 
#define TXDONE_QUEUE   31
 
#define PTP_SLAVE_MODE   1
 
#define PTP_MASTER_MODE   2
 
#define PORT2CHANNEL(p)   NPE_ID(p->id)
 
#define TX_CNTRL0_TX_EN   0x01
 
#define TX_CNTRL0_HALFDUPLEX   0x02
 
#define TX_CNTRL0_RETRY   0x04
 
#define TX_CNTRL0_PAD_EN   0x08
 
#define TX_CNTRL0_APPEND_FCS   0x10
 
#define TX_CNTRL0_2DEFER   0x20
 
#define TX_CNTRL0_RMII   0x40 /* reduced MII */
 
#define TX_CNTRL1_RETRIES   0x0F /* 4 bits */
 
#define RX_CNTRL0_RX_EN   0x01
 
#define RX_CNTRL0_PADSTRIP_EN   0x02
 
#define RX_CNTRL0_SEND_FCS   0x04
 
#define RX_CNTRL0_PAUSE_EN   0x08
 
#define RX_CNTRL0_LOOP_EN   0x10
 
#define RX_CNTRL0_ADDR_FLTR_EN   0x20
 
#define RX_CNTRL0_RX_RUNT_EN   0x40
 
#define RX_CNTRL0_BCAST_DIS   0x80
 
#define RX_CNTRL1_DEFER_EN   0x01
 
#define CORE_RESET   0x01
 
#define CORE_RX_FIFO_FLUSH   0x02
 
#define CORE_TX_FIFO_FLUSH   0x04
 
#define CORE_SEND_JAM   0x08
 
#define CORE_MDC_EN   0x10 /* MDIO using NPE-B ETH-0 only */
 
#define DEFAULT_TX_CNTRL0
 
#define DEFAULT_RX_CNTRL0   RX_CNTRL0_RX_EN
 
#define DEFAULT_CORE_CNTRL   CORE_MDC_EN
 
#define NPE_GETSTATUS   0x00
 
#define NPE_EDB_SETPORTADDRESS   0x01
 
#define NPE_EDB_GETMACADDRESSDATABASE   0x02
 
#define NPE_EDB_SETMACADDRESSSDATABASE   0x03
 
#define NPE_GETSTATS   0x04
 
#define NPE_RESETSTATS   0x05
 
#define NPE_SETMAXFRAMELENGTHS   0x06
 
#define NPE_VLAN_SETRXTAGMODE   0x07
 
#define NPE_VLAN_SETDEFAULTRXVID   0x08
 
#define NPE_VLAN_SETPORTVLANTABLEENTRY   0x09
 
#define NPE_VLAN_SETPORTVLANTABLERANGE   0x0A
 
#define NPE_VLAN_SETRXQOSENTRY   0x0B
 
#define NPE_VLAN_SETPORTIDEXTRACTIONMODE   0x0C
 
#define NPE_STP_SETBLOCKINGSTATE   0x0D
 
#define NPE_FW_SETFIREWALLMODE   0x0E
 
#define NPE_PC_SETFRAMECONTROLDURATIONID   0x0F
 
#define NPE_PC_SETAPMACTABLE   0x11
 
#define NPE_SETLOOPBACK_MODE   0x12
 
#define NPE_PC_SETBSSIDTABLE   0x13
 
#define NPE_ADDRESS_FILTER_CONFIG   0x14
 
#define NPE_APPENDFCSCONFIG   0x15
 
#define NPE_NOTIFY_MAC_RECOVERY_DONE   0x16
 
#define NPE_MAC_RECOVERY_START   0x17
 
#define free_buffer   kfree
 
#define free_buffer_irq   kfree
 
#define rx_desc_phys(port, n)
 
#define rx_desc_ptr(port, n)   (&(port)->desc_tab[n])
 
#define tx_desc_phys(port, n)
 
#define tx_desc_ptr(port, n)   (&(port)->desc_tab[(n) + RX_DESCS])
 

Typedefs

typedef void buffer_t
 

Functions

 EXPORT_SYMBOL_GPL (ixp46x_phc_index)
 
 MODULE_AUTHOR ("Krzysztof Halasa")
 
 MODULE_DESCRIPTION ("Intel IXP4xx Ethernet driver")
 
 MODULE_LICENSE ("GPL v2")
 
 MODULE_ALIAS ("platform:ixp4xx_eth")
 
 module_init (eth_init_module)
 
 module_exit (eth_cleanup_module)
 

Variables

int ixp46x_phc_index = -1
 

Macro Definition Documentation

#define CORE_MDC_EN   0x10 /* MDIO using NPE-B ETH-0 only */

Definition at line 104 of file ixp4xx_eth.c.

#define CORE_RESET   0x01

Definition at line 100 of file ixp4xx_eth.c.

#define CORE_RX_FIFO_FLUSH   0x02

Definition at line 101 of file ixp4xx_eth.c.

#define CORE_SEND_JAM   0x08

Definition at line 103 of file ixp4xx_eth.c.

#define CORE_TX_FIFO_FLUSH   0x04

Definition at line 102 of file ixp4xx_eth.c.

#define DEBUG_CLOSE   0

Definition at line 48 of file ixp4xx_eth.c.

#define DEBUG_DESC   0

Definition at line 43 of file ixp4xx_eth.c.

#define DEBUG_MDIO   0

Definition at line 47 of file ixp4xx_eth.c.

#define DEBUG_PKT_BYTES   0

Definition at line 46 of file ixp4xx_eth.c.

#define DEBUG_RX   0

Definition at line 44 of file ixp4xx_eth.c.

#define DEBUG_TX   0

Definition at line 45 of file ixp4xx_eth.c.

#define DEFAULT_CORE_CNTRL   CORE_MDC_EN

Definition at line 110 of file ixp4xx_eth.c.

#define DEFAULT_RX_CNTRL0   RX_CNTRL0_RX_EN

Definition at line 109 of file ixp4xx_eth.c.

#define DEFAULT_TX_CNTRL0
Value:
TX_CNTRL0_PAD_EN | TX_CNTRL0_APPEND_FCS | \
TX_CNTRL0_2DEFER)

Definition at line 106 of file ixp4xx_eth.c.

#define DRV_NAME   "ixp4xx_eth"

Definition at line 50 of file ixp4xx_eth.c.

#define free_buffer   kfree

Definition at line 145 of file ixp4xx_eth.c.

#define free_buffer_irq   kfree

Definition at line 146 of file ixp4xx_eth.c.

#define MAX_CLOSE_WAIT   1000 /* microseconds, typically 2-3 cycles */

Definition at line 66 of file ixp4xx_eth.c.

#define MAX_MDIO_RETRIES   100 /* microseconds, typically 30 cycles */

Definition at line 65 of file ixp4xx_eth.c.

#define MAX_MRU   1536 /* 0x600 */

Definition at line 60 of file ixp4xx_eth.c.

#define MAX_NPES   3

Definition at line 52 of file ixp4xx_eth.c.

#define MDIO_INTERVAL   (3 * HZ)

Definition at line 64 of file ixp4xx_eth.c.

#define NAPI_WEIGHT   16

Definition at line 63 of file ixp4xx_eth.c.

#define NPE_ADDRESS_FILTER_CONFIG   0x14

Definition at line 133 of file ixp4xx_eth.c.

#define NPE_APPENDFCSCONFIG   0x15

Definition at line 134 of file ixp4xx_eth.c.

#define NPE_EDB_GETMACADDRESSDATABASE   0x02

Definition at line 116 of file ixp4xx_eth.c.

#define NPE_EDB_SETMACADDRESSSDATABASE   0x03

Definition at line 117 of file ixp4xx_eth.c.

#define NPE_EDB_SETPORTADDRESS   0x01

Definition at line 115 of file ixp4xx_eth.c.

#define NPE_FW_SETFIREWALLMODE   0x0E

Definition at line 128 of file ixp4xx_eth.c.

#define NPE_GETSTATS   0x04

Definition at line 118 of file ixp4xx_eth.c.

#define NPE_GETSTATUS   0x00

Definition at line 114 of file ixp4xx_eth.c.

#define NPE_ID (   port_id)    ((port_id) >> 4)

Definition at line 68 of file ixp4xx_eth.c.

#define NPE_MAC_RECOVERY_START   0x17

Definition at line 136 of file ixp4xx_eth.c.

#define NPE_NOTIFY_MAC_RECOVERY_DONE   0x16

Definition at line 135 of file ixp4xx_eth.c.

#define NPE_PC_SETAPMACTABLE   0x11

Definition at line 130 of file ixp4xx_eth.c.

#define NPE_PC_SETBSSIDTABLE   0x13

Definition at line 132 of file ixp4xx_eth.c.

#define NPE_PC_SETFRAMECONTROLDURATIONID   0x0F

Definition at line 129 of file ixp4xx_eth.c.

#define NPE_RESETSTATS   0x05

Definition at line 119 of file ixp4xx_eth.c.

#define NPE_SETLOOPBACK_MODE   0x12

Definition at line 131 of file ixp4xx_eth.c.

#define NPE_SETMAXFRAMELENGTHS   0x06

Definition at line 120 of file ixp4xx_eth.c.

#define NPE_STP_SETBLOCKINGSTATE   0x0D

Definition at line 127 of file ixp4xx_eth.c.

#define NPE_VLAN_SETDEFAULTRXVID   0x08

Definition at line 122 of file ixp4xx_eth.c.

#define NPE_VLAN_SETPORTIDEXTRACTIONMODE   0x0C

Definition at line 126 of file ixp4xx_eth.c.

#define NPE_VLAN_SETPORTVLANTABLEENTRY   0x09

Definition at line 123 of file ixp4xx_eth.c.

#define NPE_VLAN_SETPORTVLANTABLERANGE   0x0A

Definition at line 124 of file ixp4xx_eth.c.

#define NPE_VLAN_SETRXQOSENTRY   0x0B

Definition at line 125 of file ixp4xx_eth.c.

#define NPE_VLAN_SETRXTAGMODE   0x07

Definition at line 121 of file ixp4xx_eth.c.

#define PHYSICAL_ID (   port_id)    ((NPE_ID(port_id) + 2) % 3)

Definition at line 69 of file ixp4xx_eth.c.

#define POOL_ALLOC_SIZE   (sizeof(struct desc) * (RX_DESCS + TX_DESCS))

Definition at line 58 of file ixp4xx_eth.c.

#define PORT2CHANNEL (   p)    NPE_ID(p->id)

Definition at line 76 of file ixp4xx_eth.c.

#define PTP_MASTER_MODE   2

Definition at line 75 of file ixp4xx_eth.c.

#define PTP_SLAVE_MODE   1

Definition at line 74 of file ixp4xx_eth.c.

#define REGS_SIZE   0x1000

Definition at line 59 of file ixp4xx_eth.c.

#define RX_BUFF_SIZE   ALIGN((NET_IP_ALIGN) + MAX_MRU, 4)

Definition at line 61 of file ixp4xx_eth.c.

#define RX_CNTRL0_ADDR_FLTR_EN   0x20

Definition at line 94 of file ixp4xx_eth.c.

#define RX_CNTRL0_BCAST_DIS   0x80

Definition at line 96 of file ixp4xx_eth.c.

#define RX_CNTRL0_LOOP_EN   0x10

Definition at line 93 of file ixp4xx_eth.c.

#define RX_CNTRL0_PADSTRIP_EN   0x02

Definition at line 90 of file ixp4xx_eth.c.

#define RX_CNTRL0_PAUSE_EN   0x08

Definition at line 92 of file ixp4xx_eth.c.

#define RX_CNTRL0_RX_EN   0x01

Definition at line 89 of file ixp4xx_eth.c.

#define RX_CNTRL0_RX_RUNT_EN   0x40

Definition at line 95 of file ixp4xx_eth.c.

#define RX_CNTRL0_SEND_FCS   0x04

Definition at line 91 of file ixp4xx_eth.c.

#define RX_CNTRL1_DEFER_EN   0x01

Definition at line 97 of file ixp4xx_eth.c.

#define rx_desc_phys (   port,
  n 
)
Value:
((port)->desc_tab_phys + \
(n) * sizeof(struct desc))

Definition at line 235 of file ixp4xx_eth.c.

#define rx_desc_ptr (   port,
  n 
)    (&(port)->desc_tab[n])

Definition at line 237 of file ixp4xx_eth.c.

#define RX_DESCS   64 /* also length of all RX queues */

Definition at line 54 of file ixp4xx_eth.c.

#define RXFREE_QUEUE (   port_id)    (NPE_ID(port_id) + 26)

Definition at line 71 of file ixp4xx_eth.c.

#define TX_CNTRL0_2DEFER   0x20

Definition at line 84 of file ixp4xx_eth.c.

#define TX_CNTRL0_APPEND_FCS   0x10

Definition at line 83 of file ixp4xx_eth.c.

#define TX_CNTRL0_HALFDUPLEX   0x02

Definition at line 80 of file ixp4xx_eth.c.

#define TX_CNTRL0_PAD_EN   0x08

Definition at line 82 of file ixp4xx_eth.c.

#define TX_CNTRL0_RETRY   0x04

Definition at line 81 of file ixp4xx_eth.c.

#define TX_CNTRL0_RMII   0x40 /* reduced MII */

Definition at line 85 of file ixp4xx_eth.c.

#define TX_CNTRL0_TX_EN   0x01

Definition at line 79 of file ixp4xx_eth.c.

#define TX_CNTRL1_RETRIES   0x0F /* 4 bits */

Definition at line 86 of file ixp4xx_eth.c.

#define tx_desc_phys (   port,
  n 
)
Value:
((port)->desc_tab_phys + \
((n) + RX_DESCS) * sizeof(struct desc))

Definition at line 239 of file ixp4xx_eth.c.

#define tx_desc_ptr (   port,
  n 
)    (&(port)->desc_tab[(n) + RX_DESCS])

Definition at line 241 of file ixp4xx_eth.c.

#define TX_DESCS   16 /* also length of all TX queues */

Definition at line 55 of file ixp4xx_eth.c.

#define TX_QUEUE (   port_id)    (NPE_ID(port_id) + 23)

Definition at line 70 of file ixp4xx_eth.c.

#define TXDONE_QUEUE   31

Definition at line 72 of file ixp4xx_eth.c.

#define TXDONE_QUEUE_LEN   64 /* dwords */

Definition at line 56 of file ixp4xx_eth.c.

Typedef Documentation

typedef void buffer_t

Definition at line 144 of file ixp4xx_eth.c.

Function Documentation

EXPORT_SYMBOL_GPL ( ixp46x_phc_index  )
MODULE_ALIAS ( "platform:ixp4xx_eth"  )
MODULE_AUTHOR ( "Krzysztof Halasa"  )
MODULE_DESCRIPTION ( "Intel IXP4xx Ethernet driver )
module_exit ( eth_cleanup_module  )
module_init ( eth_init_module  )
MODULE_LICENSE ( "GPL v2 )

Variable Documentation

int ixp46x_phc_index = -1

Definition at line 1005 of file ixp4xx_eth.c.