21#define CGEM_REG_LEN 0x800
24#define CGEM_NWCTRL 0x000
25#define CGEM_NWCTRL_STARTTX 0x00000200
26#define CGEM_NWCTRL_STATCLR 0x00000020
27#define CGEM_NWCTRL_MDEN 0x00000010
28#define CGEM_NWCTRL_TXEN 0x00000008
29#define CGEM_NWCTRL_RXEN 0x00000004
32#define CGEM_NWCTRL_NORMAL \
33 ( CGEM_NWCTRL_MDEN | CGEM_NWCTRL_TXEN | CGEM_NWCTRL_RXEN )
36#define CGEM_NWCFG 0x004
39#define CGEM_NWSR 0x008
40#define CGEM_NWSR_MII_IDLE 0x00000004
43#define CGEM_DMACR 0x010
44#define CGEM_DMACR_RXBUF( x ) ( ( (x) / 64 ) << 16 )
45#define CGEM_DMACR_TXSIZE( x ) ( (x) << 10 )
46#define CGEM_DMACR_TXSIZE_MAX \
47 CGEM_DMACR_TXSIZE ( 0x1 )
48#define CGEM_DMACR_RXSIZE( x ) ( (x) << 8 )
49#define CGEM_DMACR_RXSIZE_MAX \
50 CGEM_DMACR_RXSIZE ( 0x3 )
51#define CGEM_DMACR_BLENGTH( x ) ( (x) << 0 )
52#define CGEM_DMACR_BLENGTH_MAX \
53 CGEM_DMACR_BLENGTH ( 0x10 )
56#define CGEM_RXQBASE 0x018
59#define CGEM_TXQBASE 0x01c
63#define CGEM_IDR_ALL 0xffffffff
66#define CGEM_PHYMNTNC 0x034
67#define CGEM_PHYMNTNC_CLAUSE22 0x40000000
68#define CGEM_PHYMNTNC_OP_WRITE 0x10000000
69#define CGEM_PHYMNTNC_OP_READ 0x20000000
70#define CGEM_PHYMNTNC_ADDR( x ) ( (x) << 23 )
71#define CGEM_PHYMNTNC_REG( x ) ( (x) << 18 )
72#define CGEM_PHYMNTNC_FIXED 0x00020000
73#define CGEM_PHYMNTNC_DATA_MASK 0x0000ffff
76#define CGEM_MII_MAX_WAIT_US 500
79#define CGEM_LINK_INTERVAL ( 2 * TICKS_PER_SEC )
82#define CGEM_LADDRL 0x088
85#define CGEM_LADDRH 0x08c
96#define CGEM_TX_FL_OWNED 0x80000000
97#define CGEM_TX_FL_WRAP 0x40000000
98#define CGEM_TX_FL_LAST 0x00008000
101#define CGEM_NUM_TX_DESC 8
104#define CGEM_RX_ADDR_OWNED 0x00000001
105#define CGEM_RX_ADDR_WRAP 0x00000002
108#define CGEM_RX_FL_LEN( x ) ( (x) & 0x1fff )
111#define CGEM_NUM_RX_DESC 8
117#define CGEM_RX_LEN 1536
156 unsigned int qbase ) {
#define CGEM_NUM_RX_DESC
Receive ring length.
static void cgem_init_ring(struct cgem_ring *ring, unsigned int count, unsigned int qbase)
Initialise descriptor ring.
static unsigned int unsigned int qbase
static unsigned int count
Number of entries.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Media Independent Interface.
static unsigned int unsigned int reg
A Cadence GEM descriptor.
uint32_t addr
Buffer address.
A Cadence GEM network card.
struct cgem_ring rx
Receive ring.
struct mii_device mii
PHY device.
struct mii_interface mdio
PHY interface.
struct net_device * netdev
Network device.
struct cgem_ring tx
Transmit ring.
struct io_buffer * rx_iobuf[CGEM_NUM_RX_DESC]
Receive I/O buffers.
struct retry_timer timer
Link state timer.
const char * name
Device name (for debugging)
struct dma_device * dma
DMA device.
A Cadence GEM descriptor ring.
struct cgem_descriptor * desc
Descriptors.
unsigned int cons
Consumer index.
uint16_t len
Length of descriptors.
struct dma_mapping map
Descriptor ring DMA mapping.
uint8_t qbase
Queue base address register.
uint8_t count
Number of descriptors.
unsigned int prod
Producer index.
A Cadence GEM MAC address.