xref: /openbmc/linux/arch/mips/include/asm/mach-rc32434/eth.h (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
1*384740dcSRalf Baechle /*
2*384740dcSRalf Baechle  *  Definitions for the Ethernet registers
3*384740dcSRalf Baechle  *
4*384740dcSRalf Baechle  *  Copyright 2002 Allend Stichter <allen.stichter@idt.com>
5*384740dcSRalf Baechle  *  Copyright 2008 Florian Fainelli <florian@openwrt.org>
6*384740dcSRalf Baechle  *
7*384740dcSRalf Baechle  *  This program is free software; you can redistribute  it and/or modify it
8*384740dcSRalf Baechle  *  under  the terms of  the GNU General  Public License as published by the
9*384740dcSRalf Baechle  *  Free Software Foundation;  either version 2 of the  License, or (at your
10*384740dcSRalf Baechle  *  option) any later version.
11*384740dcSRalf Baechle  *
12*384740dcSRalf Baechle  *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
13*384740dcSRalf Baechle  *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
14*384740dcSRalf Baechle  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
15*384740dcSRalf Baechle  *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
16*384740dcSRalf Baechle  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17*384740dcSRalf Baechle  *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
18*384740dcSRalf Baechle  *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19*384740dcSRalf Baechle  *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
20*384740dcSRalf Baechle  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21*384740dcSRalf Baechle  *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22*384740dcSRalf Baechle  *
23*384740dcSRalf Baechle  *  You should have received a copy of the  GNU General Public License along
24*384740dcSRalf Baechle  *  with this program; if not, write  to the Free Software Foundation, Inc.,
25*384740dcSRalf Baechle  *  675 Mass Ave, Cambridge, MA 02139, USA.
26*384740dcSRalf Baechle  *
27*384740dcSRalf Baechle  */
28*384740dcSRalf Baechle 
29*384740dcSRalf Baechle #ifndef __ASM_RC32434_ETH_H
30*384740dcSRalf Baechle #define __ASM_RC32434_ETH_H
31*384740dcSRalf Baechle 
32*384740dcSRalf Baechle 
33*384740dcSRalf Baechle #define ETH0_BASE_ADDR		0x18060000
34*384740dcSRalf Baechle 
35*384740dcSRalf Baechle struct eth_regs {
36*384740dcSRalf Baechle 	u32 ethintfc;
37*384740dcSRalf Baechle 	u32 ethfifott;
38*384740dcSRalf Baechle 	u32 etharc;
39*384740dcSRalf Baechle 	u32 ethhash0;
40*384740dcSRalf Baechle 	u32 ethhash1;
41*384740dcSRalf Baechle 	u32 ethu0[4];		/* Reserved. */
42*384740dcSRalf Baechle 	u32 ethpfs;
43*384740dcSRalf Baechle 	u32 ethmcp;
44*384740dcSRalf Baechle 	u32 eth_u1[10];		/* Reserved. */
45*384740dcSRalf Baechle 	u32 ethspare;
46*384740dcSRalf Baechle 	u32 eth_u2[42];		/* Reserved. */
47*384740dcSRalf Baechle 	u32 ethsal0;
48*384740dcSRalf Baechle 	u32 ethsah0;
49*384740dcSRalf Baechle 	u32 ethsal1;
50*384740dcSRalf Baechle 	u32 ethsah1;
51*384740dcSRalf Baechle 	u32 ethsal2;
52*384740dcSRalf Baechle 	u32 ethsah2;
53*384740dcSRalf Baechle 	u32 ethsal3;
54*384740dcSRalf Baechle 	u32 ethsah3;
55*384740dcSRalf Baechle 	u32 ethrbc;
56*384740dcSRalf Baechle 	u32 ethrpc;
57*384740dcSRalf Baechle 	u32 ethrupc;
58*384740dcSRalf Baechle 	u32 ethrfc;
59*384740dcSRalf Baechle 	u32 ethtbc;
60*384740dcSRalf Baechle 	u32 ethgpf;
61*384740dcSRalf Baechle 	u32 eth_u9[50];		/* Reserved. */
62*384740dcSRalf Baechle 	u32 ethmac1;
63*384740dcSRalf Baechle 	u32 ethmac2;
64*384740dcSRalf Baechle 	u32 ethipgt;
65*384740dcSRalf Baechle 	u32 ethipgr;
66*384740dcSRalf Baechle 	u32 ethclrt;
67*384740dcSRalf Baechle 	u32 ethmaxf;
68*384740dcSRalf Baechle 	u32 eth_u10;		/* Reserved. */
69*384740dcSRalf Baechle 	u32 ethmtest;
70*384740dcSRalf Baechle 	u32 miimcfg;
71*384740dcSRalf Baechle 	u32 miimcmd;
72*384740dcSRalf Baechle 	u32 miimaddr;
73*384740dcSRalf Baechle 	u32 miimwtd;
74*384740dcSRalf Baechle 	u32 miimrdd;
75*384740dcSRalf Baechle 	u32 miimind;
76*384740dcSRalf Baechle 	u32 eth_u11;		/* Reserved. */
77*384740dcSRalf Baechle 	u32 eth_u12;		/* Reserved. */
78*384740dcSRalf Baechle 	u32 ethcfsa0;
79*384740dcSRalf Baechle 	u32 ethcfsa1;
80*384740dcSRalf Baechle 	u32 ethcfsa2;
81*384740dcSRalf Baechle };
82*384740dcSRalf Baechle 
83*384740dcSRalf Baechle /* Ethernet interrupt registers */
84*384740dcSRalf Baechle #define ETH_INT_FC_EN		(1 << 0)
85*384740dcSRalf Baechle #define ETH_INT_FC_ITS		(1 << 1)
86*384740dcSRalf Baechle #define ETH_INT_FC_RIP		(1 << 2)
87*384740dcSRalf Baechle #define ETH_INT_FC_JAM		(1 << 3)
88*384740dcSRalf Baechle #define ETH_INT_FC_OVR		(1 << 4)
89*384740dcSRalf Baechle #define ETH_INT_FC_UND		(1 << 5)
90*384740dcSRalf Baechle #define ETH_INT_FC_IOC		0x000000c0
91*384740dcSRalf Baechle 
92*384740dcSRalf Baechle /* Ethernet FIFO registers */
93*384740dcSRalf Baechle #define ETH_FIFI_TT_TTH_BIT	0
94*384740dcSRalf Baechle #define ETH_FIFO_TT_TTH		0x0000007f
95*384740dcSRalf Baechle 
96*384740dcSRalf Baechle /* Ethernet ARC/multicast registers */
97*384740dcSRalf Baechle #define ETH_ARC_PRO		(1 << 0)
98*384740dcSRalf Baechle #define ETH_ARC_AM		(1 << 1)
99*384740dcSRalf Baechle #define ETH_ARC_AFM		(1 << 2)
100*384740dcSRalf Baechle #define ETH_ARC_AB		(1 << 3)
101*384740dcSRalf Baechle 
102*384740dcSRalf Baechle /* Ethernet SAL registers */
103*384740dcSRalf Baechle #define ETH_SAL_BYTE_5		0x000000ff
104*384740dcSRalf Baechle #define ETH_SAL_BYTE_4		0x0000ff00
105*384740dcSRalf Baechle #define ETH_SAL_BYTE_3		0x00ff0000
106*384740dcSRalf Baechle #define ETH_SAL_BYTE_2		0xff000000
107*384740dcSRalf Baechle 
108*384740dcSRalf Baechle /* Ethernet SAH registers */
109*384740dcSRalf Baechle #define ETH_SAH_BYTE1		0x000000ff
110*384740dcSRalf Baechle #define ETH_SAH_BYTE0		0x0000ff00
111*384740dcSRalf Baechle 
112*384740dcSRalf Baechle /* Ethernet GPF register */
113*384740dcSRalf Baechle #define ETH_GPF_PTV		0x0000ffff
114*384740dcSRalf Baechle 
115*384740dcSRalf Baechle /* Ethernet PFG register */
116*384740dcSRalf Baechle #define ETH_PFS_PFD		(1 << 0)
117*384740dcSRalf Baechle 
118*384740dcSRalf Baechle /* Ethernet CFSA[0-3] registers */
119*384740dcSRalf Baechle #define ETH_CFSA0_CFSA4		0x000000ff
120*384740dcSRalf Baechle #define ETH_CFSA0_CFSA5		0x0000ff00
121*384740dcSRalf Baechle #define ETH_CFSA1_CFSA2		0x000000ff
122*384740dcSRalf Baechle #define ETH_CFSA1_CFSA3		0x0000ff00
123*384740dcSRalf Baechle #define ETH_CFSA1_CFSA0		0x000000ff
124*384740dcSRalf Baechle #define ETH_CFSA1_CFSA1		0x0000ff00
125*384740dcSRalf Baechle 
126*384740dcSRalf Baechle /* Ethernet MAC1 registers */
127*384740dcSRalf Baechle #define ETH_MAC1_RE		(1 << 0)
128*384740dcSRalf Baechle #define ETH_MAC1_PAF		(1 << 1)
129*384740dcSRalf Baechle #define ETH_MAC1_RFC		(1 << 2)
130*384740dcSRalf Baechle #define ETH_MAC1_TFC		(1 << 3)
131*384740dcSRalf Baechle #define ETH_MAC1_LB		(1 << 4)
132*384740dcSRalf Baechle #define ETH_MAC1_MR		(1 << 31)
133*384740dcSRalf Baechle 
134*384740dcSRalf Baechle /* Ethernet MAC2 registers */
135*384740dcSRalf Baechle #define ETH_MAC2_FD		(1 << 0)
136*384740dcSRalf Baechle #define ETH_MAC2_FLC		(1 << 1)
137*384740dcSRalf Baechle #define ETH_MAC2_HFE		(1 << 2)
138*384740dcSRalf Baechle #define ETH_MAC2_DC		(1 << 3)
139*384740dcSRalf Baechle #define ETH_MAC2_CEN		(1 << 4)
140*384740dcSRalf Baechle #define ETH_MAC2_PE		(1 << 5)
141*384740dcSRalf Baechle #define ETH_MAC2_VPE		(1 << 6)
142*384740dcSRalf Baechle #define ETH_MAC2_APE		(1 << 7)
143*384740dcSRalf Baechle #define ETH_MAC2_PPE		(1 << 8)
144*384740dcSRalf Baechle #define ETH_MAC2_LPE		(1 << 9)
145*384740dcSRalf Baechle #define ETH_MAC2_NB		(1 << 12)
146*384740dcSRalf Baechle #define ETH_MAC2_BP		(1 << 13)
147*384740dcSRalf Baechle #define ETH_MAC2_ED		(1 << 14)
148*384740dcSRalf Baechle 
149*384740dcSRalf Baechle /* Ethernet IPGT register */
150*384740dcSRalf Baechle #define ETH_IPGT		0x0000007f
151*384740dcSRalf Baechle 
152*384740dcSRalf Baechle /* Ethernet IPGR registers */
153*384740dcSRalf Baechle #define ETH_IPGR_IPGR2		0x0000007f
154*384740dcSRalf Baechle #define ETH_IPGR_IPGR1		0x00007f00
155*384740dcSRalf Baechle 
156*384740dcSRalf Baechle /* Ethernet CLRT registers */
157*384740dcSRalf Baechle #define ETH_CLRT_MAX_RET	0x0000000f
158*384740dcSRalf Baechle #define ETH_CLRT_COL_WIN	0x00003f00
159*384740dcSRalf Baechle 
160*384740dcSRalf Baechle /* Ethernet MAXF register */
161*384740dcSRalf Baechle #define ETH_MAXF		0x0000ffff
162*384740dcSRalf Baechle 
163*384740dcSRalf Baechle /* Ethernet test registers */
164*384740dcSRalf Baechle #define ETH_TEST_REG		(1 << 2)
165*384740dcSRalf Baechle #define ETH_MCP_DIV		0x000000ff
166*384740dcSRalf Baechle 
167*384740dcSRalf Baechle /* MII registers */
168*384740dcSRalf Baechle #define ETH_MII_CFG_RSVD	0x0000000c
169*384740dcSRalf Baechle #define ETH_MII_CMD_RD		(1 << 0)
170*384740dcSRalf Baechle #define ETH_MII_CMD_SCN		(1 << 1)
171*384740dcSRalf Baechle #define ETH_MII_REG_ADDR	0x0000001f
172*384740dcSRalf Baechle #define ETH_MII_PHY_ADDR	0x00001f00
173*384740dcSRalf Baechle #define ETH_MII_WTD_DATA	0x0000ffff
174*384740dcSRalf Baechle #define ETH_MII_RDD_DATA	0x0000ffff
175*384740dcSRalf Baechle #define ETH_MII_IND_BSY		(1 << 0)
176*384740dcSRalf Baechle #define ETH_MII_IND_SCN		(1 << 1)
177*384740dcSRalf Baechle #define ETH_MII_IND_NV		(1 << 2)
178*384740dcSRalf Baechle 
179*384740dcSRalf Baechle /*
180*384740dcSRalf Baechle  * Values for the DEVCS field of the Ethernet DMA Rx and Tx descriptors.
181*384740dcSRalf Baechle  */
182*384740dcSRalf Baechle 
183*384740dcSRalf Baechle #define ETH_RX_FD		(1 << 0)
184*384740dcSRalf Baechle #define ETH_RX_LD		(1 << 1)
185*384740dcSRalf Baechle #define ETH_RX_ROK		(1 << 2)
186*384740dcSRalf Baechle #define ETH_RX_FM		(1 << 3)
187*384740dcSRalf Baechle #define ETH_RX_MP		(1 << 4)
188*384740dcSRalf Baechle #define ETH_RX_BP		(1 << 5)
189*384740dcSRalf Baechle #define ETH_RX_VLT		(1 << 6)
190*384740dcSRalf Baechle #define ETH_RX_CF		(1 << 7)
191*384740dcSRalf Baechle #define ETH_RX_OVR		(1 << 8)
192*384740dcSRalf Baechle #define ETH_RX_CRC		(1 << 9)
193*384740dcSRalf Baechle #define ETH_RX_CV		(1 << 10)
194*384740dcSRalf Baechle #define ETH_RX_DB		(1 << 11)
195*384740dcSRalf Baechle #define ETH_RX_LE		(1 << 12)
196*384740dcSRalf Baechle #define ETH_RX_LOR		(1 << 13)
197*384740dcSRalf Baechle #define ETH_RX_CES		(1 << 14)
198*384740dcSRalf Baechle #define ETH_RX_LEN_BIT		16
199*384740dcSRalf Baechle #define ETH_RX_LEN		0xffff0000
200*384740dcSRalf Baechle 
201*384740dcSRalf Baechle #define ETH_TX_FD		(1 << 0)
202*384740dcSRalf Baechle #define ETH_TX_LD		(1 << 1)
203*384740dcSRalf Baechle #define ETH_TX_OEN		(1 << 2)
204*384740dcSRalf Baechle #define ETH_TX_PEN		(1 << 3)
205*384740dcSRalf Baechle #define ETH_TX_CEN		(1 << 4)
206*384740dcSRalf Baechle #define ETH_TX_HEN		(1 << 5)
207*384740dcSRalf Baechle #define ETH_TX_TOK		(1 << 6)
208*384740dcSRalf Baechle #define ETH_TX_MP		(1 << 7)
209*384740dcSRalf Baechle #define ETH_TX_BP		(1 << 8)
210*384740dcSRalf Baechle #define ETH_TX_UND		(1 << 9)
211*384740dcSRalf Baechle #define ETH_TX_OF		(1 << 10)
212*384740dcSRalf Baechle #define ETH_TX_ED		(1 << 11)
213*384740dcSRalf Baechle #define ETH_TX_EC		(1 << 12)
214*384740dcSRalf Baechle #define ETH_TX_LC		(1 << 13)
215*384740dcSRalf Baechle #define ETH_TX_TD		(1 << 14)
216*384740dcSRalf Baechle #define ETH_TX_CRC		(1 << 15)
217*384740dcSRalf Baechle #define ETH_TX_LE		(1 << 16)
218*384740dcSRalf Baechle #define ETH_TX_CC		0x001E0000
219*384740dcSRalf Baechle 
220*384740dcSRalf Baechle #endif	/* __ASM_RC32434_ETH_H */
221