Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
cpsw.c File Reference
#include <linux/kernel.h>
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/timer.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/irqreturn.h>
#include <linux/interrupt.h>
#include <linux/if_ether.h>
#include <linux/etherdevice.h>
#include <linux/netdevice.h>
#include <linux/phy.h>
#include <linux/workqueue.h>
#include <linux/delay.h>
#include <linux/pm_runtime.h>
#include <linux/of.h>
#include <linux/of_net.h>
#include <linux/of_device.h>
#include <linux/platform_data/cpsw.h>
#include "cpsw_ale.h"
#include "davinci_cpdma.h"

Go to the source code of this file.

Data Structures

struct  cpsw_ss_regs
 
struct  cpsw_regs
 
struct  cpsw_slave_regs
 
struct  cpsw_host_regs
 
struct  cpsw_sliver_regs
 
struct  cpsw_slave
 
struct  cpsw_priv
 

Macros

#define CPSW_DEBUG
 
#define cpsw_info(priv, type, format,...)
 
#define cpsw_err(priv, type, format,...)
 
#define cpsw_dbg(priv, type, format,...)
 
#define cpsw_notice(priv, type, format,...)
 
#define CPSW_MAJOR_VERSION(reg)   (reg >> 8 & 0x7)
 
#define CPSW_MINOR_VERSION(reg)   (reg & 0xff)
 
#define CPSW_RTL_VERSION(reg)   ((reg >> 11) & 0x1f)
 
#define CPDMA_RXTHRESH   0x0c0
 
#define CPDMA_RXFREE   0x0e0
 
#define CPDMA_TXHDP   0x00
 
#define CPDMA_RXHDP   0x20
 
#define CPDMA_TXCP   0x40
 
#define CPDMA_RXCP   0x60
 
#define cpsw_dma_regs(base, offset)   (void __iomem *)((base) + (offset))
 
#define cpsw_dma_rxthresh(base, offset)   (void __iomem *)((base) + (offset) + CPDMA_RXTHRESH)
 
#define cpsw_dma_rxfree(base, offset)   (void __iomem *)((base) + (offset) + CPDMA_RXFREE)
 
#define cpsw_dma_txhdp(base, offset)   (void __iomem *)((base) + (offset) + CPDMA_TXHDP)
 
#define cpsw_dma_rxhdp(base, offset)   (void __iomem *)((base) + (offset) + CPDMA_RXHDP)
 
#define cpsw_dma_txcp(base, offset)   (void __iomem *)((base) + (offset) + CPDMA_TXCP)
 
#define cpsw_dma_rxcp(base, offset)   (void __iomem *)((base) + (offset) + CPDMA_RXCP)
 
#define CPSW_POLL_WEIGHT   64
 
#define CPSW_MIN_PACKET_SIZE   60
 
#define CPSW_MAX_PACKET_SIZE   (1500 + 14 + 4 + 4)
 
#define RX_PRIORITY_MAPPING   0x76543210
 
#define TX_PRIORITY_MAPPING   0x33221100
 
#define CPDMA_TX_PRIORITY_MAP   0x76543210
 
#define cpsw_enable_irq(priv)
 
#define cpsw_disable_irq(priv)
 
#define napi_to_priv(napi)   container_of(napi, struct cpsw_priv, napi)
 
#define for_each_slave(priv, func, arg...)
 
#define mac_hi(mac)
 
#define mac_lo(mac)   (((mac)[4] << 0) | ((mac)[5] << 8))
 

Functions

 module_param (debug_level, int, 0)
 
 MODULE_PARM_DESC (debug_level,"cpsw debug level (NETIF_MSG bits)")
 
 module_param (ale_ageout, int, 0)
 
 MODULE_PARM_DESC (ale_ageout,"cpsw ale ageout interval (seconds)")
 
 module_param (rx_packet_max, int, 0)
 
 MODULE_PARM_DESC (rx_packet_max,"maximum receive packet size (bytes)")
 
void cpsw_tx_handler (void *token, int len, int status)
 
void cpsw_rx_handler (void *token, int len, int status)
 
 late_initcall (cpsw_init)
 
 module_exit (cpsw_exit)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_AUTHOR ("Cyril Chemparathy <[email protected]>")
 
 MODULE_AUTHOR ("Mugunthan V N <[email protected]>")
 
 MODULE_DESCRIPTION ("TI CPSW Ethernet driver")
 

Macro Definition Documentation

#define CPDMA_RXCP   0x60

Definition at line 82 of file cpsw.c.

#define CPDMA_RXFREE   0x0e0

Definition at line 78 of file cpsw.c.

#define CPDMA_RXHDP   0x20

Definition at line 80 of file cpsw.c.

#define CPDMA_RXTHRESH   0x0c0

Definition at line 77 of file cpsw.c.

#define CPDMA_TX_PRIORITY_MAP   0x76543210

Definition at line 105 of file cpsw.c.

#define CPDMA_TXCP   0x40

Definition at line 81 of file cpsw.c.

#define CPDMA_TXHDP   0x00

Definition at line 79 of file cpsw.c.

#define cpsw_dbg (   priv,
  type,
  format,
  ... 
)
Value:
do { \
if (netif_msg_##type(priv) && net_ratelimit()) \
dev_dbg(priv->dev, format, ## __VA_ARGS__); \
} while (0)

Definition at line 61 of file cpsw.c.

#define CPSW_DEBUG
Value:
NETIF_MSG_DRV | NETIF_MSG_LINK | \
NETIF_MSG_IFUP | NETIF_MSG_INTR | \
NETIF_MSG_PROBE | NETIF_MSG_TIMER | \
NETIF_MSG_IFDOWN | NETIF_MSG_RX_ERR | \
NETIF_MSG_TX_ERR | NETIF_MSG_TX_DONE | \
NETIF_MSG_PKTDATA | NETIF_MSG_TX_QUEUED | \
NETIF_MSG_RX_STATUS)

Definition at line 40 of file cpsw.c.

#define cpsw_disable_irq (   priv)
Value:
do { \
u32 i; \
for (i = 0; i < priv->num_irqs; i++) \
disable_irq_nosync(priv->irqs_table[i]); \
} while (0);

Definition at line 113 of file cpsw.c.

#define cpsw_dma_regs (   base,
  offset 
)    (void __iomem *)((base) + (offset))

Definition at line 84 of file cpsw.c.

#define cpsw_dma_rxcp (   base,
  offset 
)    (void __iomem *)((base) + (offset) + CPDMA_RXCP)

Definition at line 96 of file cpsw.c.

#define cpsw_dma_rxfree (   base,
  offset 
)    (void __iomem *)((base) + (offset) + CPDMA_RXFREE)

Definition at line 88 of file cpsw.c.

#define cpsw_dma_rxhdp (   base,
  offset 
)    (void __iomem *)((base) + (offset) + CPDMA_RXHDP)

Definition at line 92 of file cpsw.c.

#define cpsw_dma_rxthresh (   base,
  offset 
)    (void __iomem *)((base) + (offset) + CPDMA_RXTHRESH)

Definition at line 86 of file cpsw.c.

#define cpsw_dma_txcp (   base,
  offset 
)    (void __iomem *)((base) + (offset) + CPDMA_TXCP)

Definition at line 94 of file cpsw.c.

#define cpsw_dma_txhdp (   base,
  offset 
)    (void __iomem *)((base) + (offset) + CPDMA_TXHDP)

Definition at line 90 of file cpsw.c.

#define cpsw_enable_irq (   priv)
Value:
do { \
u32 i; \
for (i = 0; i < priv->num_irqs; i++) \
enable_irq(priv->irqs_table[i]); \
} while (0);

Definition at line 107 of file cpsw.c.

#define cpsw_err (   priv,
  type,
  format,
  ... 
)
Value:
do { \
if (netif_msg_##type(priv) && net_ratelimit()) \
dev_err(priv->dev, format, ## __VA_ARGS__); \
} while (0)

Definition at line 55 of file cpsw.c.

#define cpsw_info (   priv,
  type,
  format,
  ... 
)
Value:
do { \
if (netif_msg_##type(priv) && net_ratelimit()) \
dev_info(priv->dev, format, ## __VA_ARGS__); \
} while (0)

Definition at line 49 of file cpsw.c.

#define CPSW_MAJOR_VERSION (   reg)    (reg >> 8 & 0x7)

Definition at line 73 of file cpsw.c.

#define CPSW_MAX_PACKET_SIZE   (1500 + 14 + 4 + 4)

Definition at line 101 of file cpsw.c.

#define CPSW_MIN_PACKET_SIZE   60

Definition at line 100 of file cpsw.c.

#define CPSW_MINOR_VERSION (   reg)    (reg & 0xff)

Definition at line 74 of file cpsw.c.

#define cpsw_notice (   priv,
  type,
  format,
  ... 
)
Value:
do { \
if (netif_msg_##type(priv) && net_ratelimit()) \
dev_notice(priv->dev, format, ## __VA_ARGS__); \
} while (0)

Definition at line 67 of file cpsw.c.

#define CPSW_POLL_WEIGHT   64

Definition at line 99 of file cpsw.c.

#define CPSW_RTL_VERSION (   reg)    ((reg >> 11) & 0x1f)

Definition at line 75 of file cpsw.c.

#define for_each_slave (   priv,
  func,
  arg... 
)
Value:
do { \
int idx; \
for (idx = 0; idx < (priv)->data.slaves; idx++) \
(func)((priv)->slaves + idx, ##arg); \
} while (0)

Definition at line 224 of file cpsw.c.

#define mac_hi (   mac)
Value:
(((mac)[0] << 0) | ((mac)[1] << 8) | \
((mac)[2] << 16) | ((mac)[3] << 24))

Definition at line 355 of file cpsw.c.

#define mac_lo (   mac)    (((mac)[4] << 0) | ((mac)[5] << 8))

Definition at line 357 of file cpsw.c.

#define napi_to_priv (   napi)    container_of(napi, struct cpsw_priv, napi)

Definition at line 223 of file cpsw.c.

#define RX_PRIORITY_MAPPING   0x76543210

Definition at line 103 of file cpsw.c.

#define TX_PRIORITY_MAPPING   0x33221100

Definition at line 104 of file cpsw.c.

Function Documentation

void cpsw_rx_handler ( void token,
int  len,
int  status 
)

Definition at line 262 of file cpsw.c.

void cpsw_tx_handler ( void token,
int  len,
int  status 
)

Definition at line 249 of file cpsw.c.

late_initcall ( cpsw_init  )
MODULE_AUTHOR ( "Cyril Chemparathy <[email protected]>"  )
MODULE_AUTHOR ( "Mugunthan V N <[email protected]>"  )
MODULE_DESCRIPTION ( "TI CPSW Ethernet driver )
module_exit ( cpsw_exit  )
MODULE_LICENSE ( "GPL"  )
module_param ( debug_level  ,
int  ,
 
)
module_param ( ale_ageout  ,
int  ,
 
)
module_param ( rx_packet_max  ,
int  ,
 
)
MODULE_PARM_DESC ( debug_level  ,
"cpsw debug level (NETIF_MSG bits)"   
)
MODULE_PARM_DESC ( ale_ageout  ,
"cpsw ale ageout interval (seconds)"   
)
MODULE_PARM_DESC ( rx_packet_max  ,
"maximum receive packet size (bytes)"   
)