Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
cpmac.c File Reference
#include <linux/module.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/moduleparam.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/netdevice.h>
#include <linux/if_vlan.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/skbuff.h>
#include <linux/mii.h>
#include <linux/phy.h>
#include <linux/phy_fixed.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/clk.h>
#include <linux/gpio.h>
#include <linux/atomic.h>

Go to the source code of this file.

Data Structures

struct  cpmac_desc
 
struct  cpmac_priv
 

Macros

#define CPMAC_VERSION   "0.5.2"
 
#define CPMAC_SKB_SIZE   (ETH_FRAME_LEN + ETH_FCS_LEN + VLAN_HLEN)
 
#define CPMAC_QUEUES   8
 
#define CPMAC_TX_CONTROL   0x0004
 
#define CPMAC_TX_TEARDOWN   0x0008
 
#define CPMAC_RX_CONTROL   0x0014
 
#define CPMAC_RX_TEARDOWN   0x0018
 
#define CPMAC_MBP   0x0100
 
#define MBP_RXPASSCRC   0x40000000
 
#define MBP_RXQOS   0x20000000
 
#define MBP_RXNOCHAIN   0x10000000
 
#define MBP_RXCMF   0x01000000
 
#define MBP_RXSHORT   0x00800000
 
#define MBP_RXCEF   0x00400000
 
#define MBP_RXPROMISC   0x00200000
 
#define MBP_PROMISCCHAN(channel)   (((channel) & 0x7) << 16)
 
#define MBP_RXBCAST   0x00002000
 
#define MBP_BCASTCHAN(channel)   (((channel) & 0x7) << 8)
 
#define MBP_RXMCAST   0x00000020
 
#define MBP_MCASTCHAN(channel)   ((channel) & 0x7)
 
#define CPMAC_UNICAST_ENABLE   0x0104
 
#define CPMAC_UNICAST_CLEAR   0x0108
 
#define CPMAC_MAX_LENGTH   0x010c
 
#define CPMAC_BUFFER_OFFSET   0x0110
 
#define CPMAC_MAC_CONTROL   0x0160
 
#define MAC_TXPTYPE   0x00000200
 
#define MAC_TXPACE   0x00000040
 
#define MAC_MII   0x00000020
 
#define MAC_TXFLOW   0x00000010
 
#define MAC_RXFLOW   0x00000008
 
#define MAC_MTEST   0x00000004
 
#define MAC_LOOPBACK   0x00000002
 
#define MAC_FDX   0x00000001
 
#define CPMAC_MAC_STATUS   0x0164
 
#define MAC_STATUS_QOS   0x00000004
 
#define MAC_STATUS_RXFLOW   0x00000002
 
#define MAC_STATUS_TXFLOW   0x00000001
 
#define CPMAC_TX_INT_ENABLE   0x0178
 
#define CPMAC_TX_INT_CLEAR   0x017c
 
#define CPMAC_MAC_INT_VECTOR   0x0180
 
#define MAC_INT_STATUS   0x00080000
 
#define MAC_INT_HOST   0x00040000
 
#define MAC_INT_RX   0x00020000
 
#define MAC_INT_TX   0x00010000
 
#define CPMAC_MAC_EOI_VECTOR   0x0184
 
#define CPMAC_RX_INT_ENABLE   0x0198
 
#define CPMAC_RX_INT_CLEAR   0x019c
 
#define CPMAC_MAC_INT_ENABLE   0x01a8
 
#define CPMAC_MAC_INT_CLEAR   0x01ac
 
#define CPMAC_MAC_ADDR_LO(channel)   (0x01b0 + (channel) * 4)
 
#define CPMAC_MAC_ADDR_MID   0x01d0
 
#define CPMAC_MAC_ADDR_HI   0x01d4
 
#define CPMAC_MAC_HASH_LO   0x01d8
 
#define CPMAC_MAC_HASH_HI   0x01dc
 
#define CPMAC_TX_PTR(channel)   (0x0600 + (channel) * 4)
 
#define CPMAC_RX_PTR(channel)   (0x0620 + (channel) * 4)
 
#define CPMAC_TX_ACK(channel)   (0x0640 + (channel) * 4)
 
#define CPMAC_RX_ACK(channel)   (0x0660 + (channel) * 4)
 
#define CPMAC_REG_END   0x0680
 
#define CPMAC_STATS_RX_GOOD   0x0200
 
#define CPMAC_STATS_RX_BCAST   0x0204
 
#define CPMAC_STATS_RX_MCAST   0x0208
 
#define CPMAC_STATS_RX_PAUSE   0x020c
 
#define CPMAC_STATS_RX_CRC   0x0210
 
#define CPMAC_STATS_RX_ALIGN   0x0214
 
#define CPMAC_STATS_RX_OVER   0x0218
 
#define CPMAC_STATS_RX_JABBER   0x021c
 
#define CPMAC_STATS_RX_UNDER   0x0220
 
#define CPMAC_STATS_RX_FRAG   0x0224
 
#define CPMAC_STATS_RX_FILTER   0x0228
 
#define CPMAC_STATS_RX_QOSFILTER   0x022c
 
#define CPMAC_STATS_RX_OCTETS   0x0230
 
#define CPMAC_STATS_TX_GOOD   0x0234
 
#define CPMAC_STATS_TX_BCAST   0x0238
 
#define CPMAC_STATS_TX_MCAST   0x023c
 
#define CPMAC_STATS_TX_PAUSE   0x0240
 
#define CPMAC_STATS_TX_DEFER   0x0244
 
#define CPMAC_STATS_TX_COLLISION   0x0248
 
#define CPMAC_STATS_TX_SINGLECOLL   0x024c
 
#define CPMAC_STATS_TX_MULTICOLL   0x0250
 
#define CPMAC_STATS_TX_EXCESSCOLL   0x0254
 
#define CPMAC_STATS_TX_LATECOLL   0x0258
 
#define CPMAC_STATS_TX_UNDERRUN   0x025c
 
#define CPMAC_STATS_TX_CARRIERSENSE   0x0260
 
#define CPMAC_STATS_TX_OCTETS   0x0264
 
#define cpmac_read(base, reg)   (readl((void __iomem *)(base) + (reg)))
 
#define cpmac_write(base, reg, val)
 
#define CPMAC_MDIO_VERSION   0x0000
 
#define CPMAC_MDIO_CONTROL   0x0004
 
#define MDIOC_IDLE   0x80000000
 
#define MDIOC_ENABLE   0x40000000
 
#define MDIOC_PREAMBLE   0x00100000
 
#define MDIOC_FAULT   0x00080000
 
#define MDIOC_FAULTDETECT   0x00040000
 
#define MDIOC_INTTEST   0x00020000
 
#define MDIOC_CLKDIV(div)   ((div) & 0xff)
 
#define CPMAC_MDIO_ALIVE   0x0008
 
#define CPMAC_MDIO_LINK   0x000c
 
#define CPMAC_MDIO_ACCESS(channel)   (0x0080 + (channel) * 8)
 
#define MDIO_BUSY   0x80000000
 
#define MDIO_WRITE   0x40000000
 
#define MDIO_REG(reg)   (((reg) & 0x1f) << 21)
 
#define MDIO_PHY(phy)   (((phy) & 0x1f) << 16)
 
#define MDIO_DATA(data)   ((data) & 0xffff)
 
#define CPMAC_MDIO_PHYSEL(channel)   (0x0084 + (channel) * 8)
 
#define PHYSEL_LINKSEL   0x00000040
 
#define PHYSEL_LINKINT   0x00000020
 
#define CPMAC_SOP   0x8000
 
#define CPMAC_EOP   0x4000
 
#define CPMAC_OWN   0x2000
 
#define CPMAC_EOQ   0x1000
 

Functions

 MODULE_AUTHOR ("Eugene Konev <[email protected]>")
 
 MODULE_DESCRIPTION ("TI AR7 ethernet driver (CPMAC)")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_ALIAS ("platform:cpmac")
 
 module_param (debug_level, int, 0444)
 
 module_param (dumb_switch, int, 0444)
 
 MODULE_PARM_DESC (debug_level,"Number of NETIF_MSG bits to enable")
 
 MODULE_PARM_DESC (dumb_switch,"Assume switch is not connected to MDIO bus")
 
int __devinit cpmac_init (void)
 
void __devexit cpmac_exit (void)
 
 module_init (cpmac_init)
 
 module_exit (cpmac_exit)
 

Macro Definition Documentation

#define CPMAC_BUFFER_OFFSET   0x0110

Definition at line 86 of file cpmac.c.

#define CPMAC_EOP   0x4000

Definition at line 188 of file cpmac.c.

#define CPMAC_EOQ   0x1000

Definition at line 190 of file cpmac.c.

#define CPMAC_MAC_ADDR_HI   0x01d4

Definition at line 114 of file cpmac.c.

#define CPMAC_MAC_ADDR_LO (   channel)    (0x01b0 + (channel) * 4)

Definition at line 112 of file cpmac.c.

#define CPMAC_MAC_ADDR_MID   0x01d0

Definition at line 113 of file cpmac.c.

#define CPMAC_MAC_CONTROL   0x0160

Definition at line 87 of file cpmac.c.

#define CPMAC_MAC_EOI_VECTOR   0x0184

Definition at line 107 of file cpmac.c.

#define CPMAC_MAC_HASH_HI   0x01dc

Definition at line 116 of file cpmac.c.

#define CPMAC_MAC_HASH_LO   0x01d8

Definition at line 115 of file cpmac.c.

#define CPMAC_MAC_INT_CLEAR   0x01ac

Definition at line 111 of file cpmac.c.

#define CPMAC_MAC_INT_ENABLE   0x01a8

Definition at line 110 of file cpmac.c.

#define CPMAC_MAC_INT_VECTOR   0x0180

Definition at line 102 of file cpmac.c.

#define CPMAC_MAC_STATUS   0x0164

Definition at line 96 of file cpmac.c.

#define CPMAC_MAX_LENGTH   0x010c

Definition at line 85 of file cpmac.c.

#define CPMAC_MBP   0x0100

Definition at line 70 of file cpmac.c.

#define CPMAC_MDIO_ACCESS (   channel)    (0x0080 + (channel) * 8)

Definition at line 170 of file cpmac.c.

#define CPMAC_MDIO_ALIVE   0x0008

Definition at line 168 of file cpmac.c.

#define CPMAC_MDIO_CONTROL   0x0004

Definition at line 160 of file cpmac.c.

#define CPMAC_MDIO_LINK   0x000c

Definition at line 169 of file cpmac.c.

#define CPMAC_MDIO_PHYSEL (   channel)    (0x0084 + (channel) * 8)

Definition at line 176 of file cpmac.c.

#define CPMAC_MDIO_VERSION   0x0000

Definition at line 159 of file cpmac.c.

#define CPMAC_OWN   0x2000

Definition at line 189 of file cpmac.c.

#define CPMAC_QUEUES   8

Definition at line 63 of file cpmac.c.

#define cpmac_read (   base,
  reg 
)    (readl((void __iomem *)(base) + (reg)))

Definition at line 154 of file cpmac.c.

#define CPMAC_REG_END   0x0680

Definition at line 121 of file cpmac.c.

#define CPMAC_RX_ACK (   channel)    (0x0660 + (channel) * 4)

Definition at line 120 of file cpmac.c.

#define CPMAC_RX_CONTROL   0x0014

Definition at line 68 of file cpmac.c.

#define CPMAC_RX_INT_CLEAR   0x019c

Definition at line 109 of file cpmac.c.

#define CPMAC_RX_INT_ENABLE   0x0198

Definition at line 108 of file cpmac.c.

#define CPMAC_RX_PTR (   channel)    (0x0620 + (channel) * 4)

Definition at line 118 of file cpmac.c.

#define CPMAC_RX_TEARDOWN   0x0018

Definition at line 69 of file cpmac.c.

#define CPMAC_SKB_SIZE   (ETH_FRAME_LEN + ETH_FCS_LEN + VLAN_HLEN)

Definition at line 62 of file cpmac.c.

#define CPMAC_SOP   0x8000

Definition at line 187 of file cpmac.c.

#define CPMAC_STATS_RX_ALIGN   0x0214

Definition at line 131 of file cpmac.c.

#define CPMAC_STATS_RX_BCAST   0x0204

Definition at line 127 of file cpmac.c.

#define CPMAC_STATS_RX_CRC   0x0210

Definition at line 130 of file cpmac.c.

#define CPMAC_STATS_RX_FILTER   0x0228

Definition at line 136 of file cpmac.c.

#define CPMAC_STATS_RX_FRAG   0x0224

Definition at line 135 of file cpmac.c.

#define CPMAC_STATS_RX_GOOD   0x0200

Definition at line 126 of file cpmac.c.

#define CPMAC_STATS_RX_JABBER   0x021c

Definition at line 133 of file cpmac.c.

#define CPMAC_STATS_RX_MCAST   0x0208

Definition at line 128 of file cpmac.c.

#define CPMAC_STATS_RX_OCTETS   0x0230

Definition at line 138 of file cpmac.c.

#define CPMAC_STATS_RX_OVER   0x0218

Definition at line 132 of file cpmac.c.

#define CPMAC_STATS_RX_PAUSE   0x020c

Definition at line 129 of file cpmac.c.

#define CPMAC_STATS_RX_QOSFILTER   0x022c

Definition at line 137 of file cpmac.c.

#define CPMAC_STATS_RX_UNDER   0x0220

Definition at line 134 of file cpmac.c.

#define CPMAC_STATS_TX_BCAST   0x0238

Definition at line 141 of file cpmac.c.

#define CPMAC_STATS_TX_CARRIERSENSE   0x0260

Definition at line 151 of file cpmac.c.

#define CPMAC_STATS_TX_COLLISION   0x0248

Definition at line 145 of file cpmac.c.

#define CPMAC_STATS_TX_DEFER   0x0244

Definition at line 144 of file cpmac.c.

#define CPMAC_STATS_TX_EXCESSCOLL   0x0254

Definition at line 148 of file cpmac.c.

#define CPMAC_STATS_TX_GOOD   0x0234

Definition at line 140 of file cpmac.c.

#define CPMAC_STATS_TX_LATECOLL   0x0258

Definition at line 149 of file cpmac.c.

#define CPMAC_STATS_TX_MCAST   0x023c

Definition at line 142 of file cpmac.c.

#define CPMAC_STATS_TX_MULTICOLL   0x0250

Definition at line 147 of file cpmac.c.

#define CPMAC_STATS_TX_OCTETS   0x0264

Definition at line 152 of file cpmac.c.

#define CPMAC_STATS_TX_PAUSE   0x0240

Definition at line 143 of file cpmac.c.

#define CPMAC_STATS_TX_SINGLECOLL   0x024c

Definition at line 146 of file cpmac.c.

#define CPMAC_STATS_TX_UNDERRUN   0x025c

Definition at line 150 of file cpmac.c.

#define CPMAC_TX_ACK (   channel)    (0x0640 + (channel) * 4)

Definition at line 119 of file cpmac.c.

#define CPMAC_TX_CONTROL   0x0004

Definition at line 66 of file cpmac.c.

#define CPMAC_TX_INT_CLEAR   0x017c

Definition at line 101 of file cpmac.c.

#define CPMAC_TX_INT_ENABLE   0x0178

Definition at line 100 of file cpmac.c.

#define CPMAC_TX_PTR (   channel)    (0x0600 + (channel) * 4)

Definition at line 117 of file cpmac.c.

#define CPMAC_TX_TEARDOWN   0x0008

Definition at line 67 of file cpmac.c.

#define CPMAC_UNICAST_CLEAR   0x0108

Definition at line 84 of file cpmac.c.

#define CPMAC_UNICAST_ENABLE   0x0104

Definition at line 83 of file cpmac.c.

#define CPMAC_VERSION   "0.5.2"

Definition at line 60 of file cpmac.c.

#define cpmac_write (   base,
  reg,
  val 
)
Value:
(writel(val, (void __iomem *)(base) + \
(reg)))

Definition at line 155 of file cpmac.c.

#define MAC_FDX   0x00000001

Definition at line 95 of file cpmac.c.

#define MAC_INT_HOST   0x00040000

Definition at line 104 of file cpmac.c.

#define MAC_INT_RX   0x00020000

Definition at line 105 of file cpmac.c.

#define MAC_INT_STATUS   0x00080000

Definition at line 103 of file cpmac.c.

#define MAC_INT_TX   0x00010000

Definition at line 106 of file cpmac.c.

#define MAC_LOOPBACK   0x00000002

Definition at line 94 of file cpmac.c.

#define MAC_MII   0x00000020

Definition at line 90 of file cpmac.c.

#define MAC_MTEST   0x00000004

Definition at line 93 of file cpmac.c.

#define MAC_RXFLOW   0x00000008

Definition at line 92 of file cpmac.c.

#define MAC_STATUS_QOS   0x00000004

Definition at line 97 of file cpmac.c.

#define MAC_STATUS_RXFLOW   0x00000002

Definition at line 98 of file cpmac.c.

#define MAC_STATUS_TXFLOW   0x00000001

Definition at line 99 of file cpmac.c.

#define MAC_TXFLOW   0x00000010

Definition at line 91 of file cpmac.c.

#define MAC_TXPACE   0x00000040

Definition at line 89 of file cpmac.c.

#define MAC_TXPTYPE   0x00000200

Definition at line 88 of file cpmac.c.

#define MBP_BCASTCHAN (   channel)    (((channel) & 0x7) << 8)

Definition at line 80 of file cpmac.c.

#define MBP_MCASTCHAN (   channel)    ((channel) & 0x7)

Definition at line 82 of file cpmac.c.

#define MBP_PROMISCCHAN (   channel)    (((channel) & 0x7) << 16)

Definition at line 78 of file cpmac.c.

#define MBP_RXBCAST   0x00002000

Definition at line 79 of file cpmac.c.

#define MBP_RXCEF   0x00400000

Definition at line 76 of file cpmac.c.

#define MBP_RXCMF   0x01000000

Definition at line 74 of file cpmac.c.

#define MBP_RXMCAST   0x00000020

Definition at line 81 of file cpmac.c.

#define MBP_RXNOCHAIN   0x10000000

Definition at line 73 of file cpmac.c.

#define MBP_RXPASSCRC   0x40000000

Definition at line 71 of file cpmac.c.

#define MBP_RXPROMISC   0x00200000

Definition at line 77 of file cpmac.c.

#define MBP_RXQOS   0x20000000

Definition at line 72 of file cpmac.c.

#define MBP_RXSHORT   0x00800000

Definition at line 75 of file cpmac.c.

#define MDIO_BUSY   0x80000000

Definition at line 171 of file cpmac.c.

#define MDIO_DATA (   data)    ((data) & 0xffff)

Definition at line 175 of file cpmac.c.

#define MDIO_PHY (   phy)    (((phy) & 0x1f) << 16)

Definition at line 174 of file cpmac.c.

#define MDIO_REG (   reg)    (((reg) & 0x1f) << 21)

Definition at line 173 of file cpmac.c.

#define MDIO_WRITE   0x40000000

Definition at line 172 of file cpmac.c.

#define MDIOC_CLKDIV (   div)    ((div) & 0xff)

Definition at line 167 of file cpmac.c.

#define MDIOC_ENABLE   0x40000000

Definition at line 162 of file cpmac.c.

#define MDIOC_FAULT   0x00080000

Definition at line 164 of file cpmac.c.

#define MDIOC_FAULTDETECT   0x00040000

Definition at line 165 of file cpmac.c.

#define MDIOC_IDLE   0x80000000

Definition at line 161 of file cpmac.c.

#define MDIOC_INTTEST   0x00020000

Definition at line 166 of file cpmac.c.

#define MDIOC_PREAMBLE   0x00100000

Definition at line 163 of file cpmac.c.

#define PHYSEL_LINKINT   0x00000020

Definition at line 178 of file cpmac.c.

#define PHYSEL_LINKSEL   0x00000040

Definition at line 177 of file cpmac.c.

Function Documentation

void __devexit cpmac_exit ( void  )

Definition at line 1293 of file cpmac.c.

int __devinit cpmac_init ( void  )

Definition at line 1222 of file cpmac.c.

MODULE_ALIAS ( "platform:cpmac"  )
MODULE_AUTHOR ( "Eugene Konev <[email protected]>"  )
MODULE_DESCRIPTION ( "TI AR7 ethernet driver (CPMAC)"  )
module_exit ( cpmac_exit  )
module_init ( cpmac_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( debug_level  ,
int  ,
0444   
)
module_param ( dumb_switch  ,
int  ,
0444   
)
MODULE_PARM_DESC ( debug_level  ,
"Number of NETIF_MSG bits to enable  
)
MODULE_PARM_DESC ( dumb_switch  ,
"Assume switch is not connected to MDIO bus  
)