blob: 89c1e49387eddaaccb1a1558f08da778064a02b4 [file] [log] [blame]
Daniel Hellstromf2879f52010-01-21 16:09:37 +01001/* Gaisler.com GRETH 10/100/1000 Ethernet MAC definitions
2 *
3 * (C) Copyright 2010, 2015
4 * Daniel Hellstrom, Cobham Gaisler, daniel@gaisler.com
5 *
6 * SPDX-License-Identifier: GPL-2.0+
7 */
8
9#ifndef __GRLIB_GRETH_H__
10#define __GRLIB_GRETH_H__
11
12#define GRETH_FD 0x10
13#define GRETH_RESET 0x40
14#define GRETH_MII_BUSY 0x8
15#define GRETH_MII_NVALID 0x10
16
17/* MII registers */
18#define GRETH_MII_EXTADV_1000FD 0x00000200
19#define GRETH_MII_EXTADV_1000HD 0x00000100
20#define GRETH_MII_EXTPRT_1000FD 0x00000800
21#define GRETH_MII_EXTPRT_1000HD 0x00000400
22
23#define GRETH_MII_100T4 0x00000200
24#define GRETH_MII_100TXFD 0x00000100
25#define GRETH_MII_100TXHD 0x00000080
26#define GRETH_MII_10FD 0x00000040
27#define GRETH_MII_10HD 0x00000020
28
29#define GRETH_BD_EN 0x800
30#define GRETH_BD_WR 0x1000
31#define GRETH_BD_IE 0x2000
32#define GRETH_BD_LEN 0x7FF
33
34#define GRETH_TXEN 0x1
35#define GRETH_INT_TX 0x8
36#define GRETH_TXI 0x4
37#define GRETH_TXBD_STATUS 0x0001C000
38#define GRETH_TXBD_MORE 0x20000
39#define GRETH_TXBD_IPCS 0x40000
40#define GRETH_TXBD_TCPCS 0x80000
41#define GRETH_TXBD_UDPCS 0x100000
42#define GRETH_TXBD_ERR_LC 0x10000
43#define GRETH_TXBD_ERR_UE 0x4000
44#define GRETH_TXBD_ERR_AL 0x8000
45#define GRETH_TXBD_NUM 128
46#define GRETH_TXBD_NUM_MASK (GRETH_TXBD_NUM-1)
47#define GRETH_TX_BUF_SIZE 2048
48
49#define GRETH_INT_RX 0x4
50#define GRETH_RXEN 0x2
51#define GRETH_RXI 0x8
52#define GRETH_RXBD_STATUS 0xFFFFC000
53#define GRETH_RXBD_ERR_AE 0x4000
54#define GRETH_RXBD_ERR_FT 0x8000
55#define GRETH_RXBD_ERR_CRC 0x10000
56#define GRETH_RXBD_ERR_OE 0x20000
57#define GRETH_RXBD_ERR_LE 0x40000
58#define GRETH_RXBD_IP_DEC 0x80000
59#define GRETH_RXBD_IP_CSERR 0x100000
60#define GRETH_RXBD_UDP_DEC 0x200000
61#define GRETH_RXBD_UDP_CSERR 0x400000
62#define GRETH_RXBD_TCP_DEC 0x800000
63#define GRETH_RXBD_TCP_CSERR 0x1000000
64
65#define GRETH_RXBD_NUM 128
66#define GRETH_RXBD_NUM_MASK (GRETH_RXBD_NUM-1)
67#define GRETH_RX_BUF_SIZE 2048
68
69/* Ethernet configuration registers */
70typedef struct _greth_regs {
71 volatile unsigned int control;
72 volatile unsigned int status;
73 volatile unsigned int esa_msb;
74 volatile unsigned int esa_lsb;
75 volatile unsigned int mdio;
76 volatile unsigned int tx_desc_p;
77 volatile unsigned int rx_desc_p;
78 volatile unsigned int edcl_ip;
79} greth_regs;
80
81/* Ethernet buffer descriptor */
82typedef struct _greth_bd {
83 volatile unsigned int stat;
84 unsigned int addr; /* Buffer address not changed by HW */
85} greth_bd;
86
87#endif