162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci *  Definitions for the Ethernet registers
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci *  Copyright 2002 Allend Stichter <allen.stichter@idt.com>
562306a36Sopenharmony_ci *  Copyright 2008 Florian Fainelli <florian@openwrt.org>
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci *  This program is free software; you can redistribute  it and/or modify it
862306a36Sopenharmony_ci *  under  the terms of  the GNU General  Public License as published by the
962306a36Sopenharmony_ci *  Free Software Foundation;  either version 2 of the  License, or (at your
1062306a36Sopenharmony_ci *  option) any later version.
1162306a36Sopenharmony_ci *
1262306a36Sopenharmony_ci *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
1362306a36Sopenharmony_ci *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
1462306a36Sopenharmony_ci *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
1562306a36Sopenharmony_ci *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
1662306a36Sopenharmony_ci *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1762306a36Sopenharmony_ci *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
1862306a36Sopenharmony_ci *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1962306a36Sopenharmony_ci *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
2062306a36Sopenharmony_ci *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2162306a36Sopenharmony_ci *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2262306a36Sopenharmony_ci *
2362306a36Sopenharmony_ci *  You should have received a copy of the  GNU General Public License along
2462306a36Sopenharmony_ci *  with this program; if not, write  to the Free Software Foundation, Inc.,
2562306a36Sopenharmony_ci *  675 Mass Ave, Cambridge, MA 02139, USA.
2662306a36Sopenharmony_ci *
2762306a36Sopenharmony_ci */
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#ifndef __ASM_RC32434_ETH_H
3062306a36Sopenharmony_ci#define __ASM_RC32434_ETH_H
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#define ETH0_BASE_ADDR		0x18060000
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_cistruct eth_regs {
3662306a36Sopenharmony_ci	u32 ethintfc;
3762306a36Sopenharmony_ci	u32 ethfifott;
3862306a36Sopenharmony_ci	u32 etharc;
3962306a36Sopenharmony_ci	u32 ethhash0;
4062306a36Sopenharmony_ci	u32 ethhash1;
4162306a36Sopenharmony_ci	u32 ethu0[4];		/* Reserved. */
4262306a36Sopenharmony_ci	u32 ethpfs;
4362306a36Sopenharmony_ci	u32 ethmcp;
4462306a36Sopenharmony_ci	u32 eth_u1[10];		/* Reserved. */
4562306a36Sopenharmony_ci	u32 ethspare;
4662306a36Sopenharmony_ci	u32 eth_u2[42];		/* Reserved. */
4762306a36Sopenharmony_ci	u32 ethsal0;
4862306a36Sopenharmony_ci	u32 ethsah0;
4962306a36Sopenharmony_ci	u32 ethsal1;
5062306a36Sopenharmony_ci	u32 ethsah1;
5162306a36Sopenharmony_ci	u32 ethsal2;
5262306a36Sopenharmony_ci	u32 ethsah2;
5362306a36Sopenharmony_ci	u32 ethsal3;
5462306a36Sopenharmony_ci	u32 ethsah3;
5562306a36Sopenharmony_ci	u32 ethrbc;
5662306a36Sopenharmony_ci	u32 ethrpc;
5762306a36Sopenharmony_ci	u32 ethrupc;
5862306a36Sopenharmony_ci	u32 ethrfc;
5962306a36Sopenharmony_ci	u32 ethtbc;
6062306a36Sopenharmony_ci	u32 ethgpf;
6162306a36Sopenharmony_ci	u32 eth_u9[50];		/* Reserved. */
6262306a36Sopenharmony_ci	u32 ethmac1;
6362306a36Sopenharmony_ci	u32 ethmac2;
6462306a36Sopenharmony_ci	u32 ethipgt;
6562306a36Sopenharmony_ci	u32 ethipgr;
6662306a36Sopenharmony_ci	u32 ethclrt;
6762306a36Sopenharmony_ci	u32 ethmaxf;
6862306a36Sopenharmony_ci	u32 eth_u10;		/* Reserved. */
6962306a36Sopenharmony_ci	u32 ethmtest;
7062306a36Sopenharmony_ci	u32 miimcfg;
7162306a36Sopenharmony_ci	u32 miimcmd;
7262306a36Sopenharmony_ci	u32 miimaddr;
7362306a36Sopenharmony_ci	u32 miimwtd;
7462306a36Sopenharmony_ci	u32 miimrdd;
7562306a36Sopenharmony_ci	u32 miimind;
7662306a36Sopenharmony_ci	u32 eth_u11;		/* Reserved. */
7762306a36Sopenharmony_ci	u32 eth_u12;		/* Reserved. */
7862306a36Sopenharmony_ci	u32 ethcfsa0;
7962306a36Sopenharmony_ci	u32 ethcfsa1;
8062306a36Sopenharmony_ci	u32 ethcfsa2;
8162306a36Sopenharmony_ci};
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci/* Ethernet interrupt registers */
8462306a36Sopenharmony_ci#define ETH_INT_FC_EN		(1 << 0)
8562306a36Sopenharmony_ci#define ETH_INT_FC_ITS		(1 << 1)
8662306a36Sopenharmony_ci#define ETH_INT_FC_RIP		(1 << 2)
8762306a36Sopenharmony_ci#define ETH_INT_FC_JAM		(1 << 3)
8862306a36Sopenharmony_ci#define ETH_INT_FC_OVR		(1 << 4)
8962306a36Sopenharmony_ci#define ETH_INT_FC_UND		(1 << 5)
9062306a36Sopenharmony_ci#define ETH_INT_FC_IOC		0x000000c0
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci/* Ethernet FIFO registers */
9362306a36Sopenharmony_ci#define ETH_FIFI_TT_TTH_BIT	0
9462306a36Sopenharmony_ci#define ETH_FIFO_TT_TTH		0x0000007f
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci/* Ethernet ARC/multicast registers */
9762306a36Sopenharmony_ci#define ETH_ARC_PRO		(1 << 0)
9862306a36Sopenharmony_ci#define ETH_ARC_AM		(1 << 1)
9962306a36Sopenharmony_ci#define ETH_ARC_AFM		(1 << 2)
10062306a36Sopenharmony_ci#define ETH_ARC_AB		(1 << 3)
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci/* Ethernet SAL registers */
10362306a36Sopenharmony_ci#define ETH_SAL_BYTE_5		0x000000ff
10462306a36Sopenharmony_ci#define ETH_SAL_BYTE_4		0x0000ff00
10562306a36Sopenharmony_ci#define ETH_SAL_BYTE_3		0x00ff0000
10662306a36Sopenharmony_ci#define ETH_SAL_BYTE_2		0xff000000
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci/* Ethernet SAH registers */
10962306a36Sopenharmony_ci#define ETH_SAH_BYTE1		0x000000ff
11062306a36Sopenharmony_ci#define ETH_SAH_BYTE0		0x0000ff00
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci/* Ethernet GPF register */
11362306a36Sopenharmony_ci#define ETH_GPF_PTV		0x0000ffff
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci/* Ethernet PFG register */
11662306a36Sopenharmony_ci#define ETH_PFS_PFD		(1 << 0)
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci/* Ethernet CFSA[0-3] registers */
11962306a36Sopenharmony_ci#define ETH_CFSA0_CFSA4		0x000000ff
12062306a36Sopenharmony_ci#define ETH_CFSA0_CFSA5		0x0000ff00
12162306a36Sopenharmony_ci#define ETH_CFSA1_CFSA2		0x000000ff
12262306a36Sopenharmony_ci#define ETH_CFSA1_CFSA3		0x0000ff00
12362306a36Sopenharmony_ci#define ETH_CFSA1_CFSA0		0x000000ff
12462306a36Sopenharmony_ci#define ETH_CFSA1_CFSA1		0x0000ff00
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci/* Ethernet MAC1 registers */
12762306a36Sopenharmony_ci#define ETH_MAC1_RE		(1 << 0)
12862306a36Sopenharmony_ci#define ETH_MAC1_PAF		(1 << 1)
12962306a36Sopenharmony_ci#define ETH_MAC1_RFC		(1 << 2)
13062306a36Sopenharmony_ci#define ETH_MAC1_TFC		(1 << 3)
13162306a36Sopenharmony_ci#define ETH_MAC1_LB		(1 << 4)
13262306a36Sopenharmony_ci#define ETH_MAC1_MR		(1 << 31)
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci/* Ethernet MAC2 registers */
13562306a36Sopenharmony_ci#define ETH_MAC2_FD		(1 << 0)
13662306a36Sopenharmony_ci#define ETH_MAC2_FLC		(1 << 1)
13762306a36Sopenharmony_ci#define ETH_MAC2_HFE		(1 << 2)
13862306a36Sopenharmony_ci#define ETH_MAC2_DC		(1 << 3)
13962306a36Sopenharmony_ci#define ETH_MAC2_CEN		(1 << 4)
14062306a36Sopenharmony_ci#define ETH_MAC2_PE		(1 << 5)
14162306a36Sopenharmony_ci#define ETH_MAC2_VPE		(1 << 6)
14262306a36Sopenharmony_ci#define ETH_MAC2_APE		(1 << 7)
14362306a36Sopenharmony_ci#define ETH_MAC2_PPE		(1 << 8)
14462306a36Sopenharmony_ci#define ETH_MAC2_LPE		(1 << 9)
14562306a36Sopenharmony_ci#define ETH_MAC2_NB		(1 << 12)
14662306a36Sopenharmony_ci#define ETH_MAC2_BP		(1 << 13)
14762306a36Sopenharmony_ci#define ETH_MAC2_ED		(1 << 14)
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ci/* Ethernet IPGT register */
15062306a36Sopenharmony_ci#define ETH_IPGT		0x0000007f
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci/* Ethernet IPGR registers */
15362306a36Sopenharmony_ci#define ETH_IPGR_IPGR2		0x0000007f
15462306a36Sopenharmony_ci#define ETH_IPGR_IPGR1		0x00007f00
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci/* Ethernet CLRT registers */
15762306a36Sopenharmony_ci#define ETH_CLRT_MAX_RET	0x0000000f
15862306a36Sopenharmony_ci#define ETH_CLRT_COL_WIN	0x00003f00
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci/* Ethernet MAXF register */
16162306a36Sopenharmony_ci#define ETH_MAXF		0x0000ffff
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci/* Ethernet test registers */
16462306a36Sopenharmony_ci#define ETH_TEST_REG		(1 << 2)
16562306a36Sopenharmony_ci#define ETH_MCP_DIV		0x000000ff
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci/* MII registers */
16862306a36Sopenharmony_ci#define ETH_MII_CFG_RSVD	0x0000000c
16962306a36Sopenharmony_ci#define ETH_MII_CMD_RD		(1 << 0)
17062306a36Sopenharmony_ci#define ETH_MII_CMD_SCN		(1 << 1)
17162306a36Sopenharmony_ci#define ETH_MII_REG_ADDR	0x0000001f
17262306a36Sopenharmony_ci#define ETH_MII_PHY_ADDR	0x00001f00
17362306a36Sopenharmony_ci#define ETH_MII_WTD_DATA	0x0000ffff
17462306a36Sopenharmony_ci#define ETH_MII_RDD_DATA	0x0000ffff
17562306a36Sopenharmony_ci#define ETH_MII_IND_BSY		(1 << 0)
17662306a36Sopenharmony_ci#define ETH_MII_IND_SCN		(1 << 1)
17762306a36Sopenharmony_ci#define ETH_MII_IND_NV		(1 << 2)
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ci/*
18062306a36Sopenharmony_ci * Values for the DEVCS field of the Ethernet DMA Rx and Tx descriptors.
18162306a36Sopenharmony_ci */
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ci#define ETH_RX_FD		(1 << 0)
18462306a36Sopenharmony_ci#define ETH_RX_LD		(1 << 1)
18562306a36Sopenharmony_ci#define ETH_RX_ROK		(1 << 2)
18662306a36Sopenharmony_ci#define ETH_RX_FM		(1 << 3)
18762306a36Sopenharmony_ci#define ETH_RX_MP		(1 << 4)
18862306a36Sopenharmony_ci#define ETH_RX_BP		(1 << 5)
18962306a36Sopenharmony_ci#define ETH_RX_VLT		(1 << 6)
19062306a36Sopenharmony_ci#define ETH_RX_CF		(1 << 7)
19162306a36Sopenharmony_ci#define ETH_RX_OVR		(1 << 8)
19262306a36Sopenharmony_ci#define ETH_RX_CRC		(1 << 9)
19362306a36Sopenharmony_ci#define ETH_RX_CV		(1 << 10)
19462306a36Sopenharmony_ci#define ETH_RX_DB		(1 << 11)
19562306a36Sopenharmony_ci#define ETH_RX_LE		(1 << 12)
19662306a36Sopenharmony_ci#define ETH_RX_LOR		(1 << 13)
19762306a36Sopenharmony_ci#define ETH_RX_CES		(1 << 14)
19862306a36Sopenharmony_ci#define ETH_RX_LEN_BIT		16
19962306a36Sopenharmony_ci#define ETH_RX_LEN		0xffff0000
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ci#define ETH_TX_FD		(1 << 0)
20262306a36Sopenharmony_ci#define ETH_TX_LD		(1 << 1)
20362306a36Sopenharmony_ci#define ETH_TX_OEN		(1 << 2)
20462306a36Sopenharmony_ci#define ETH_TX_PEN		(1 << 3)
20562306a36Sopenharmony_ci#define ETH_TX_CEN		(1 << 4)
20662306a36Sopenharmony_ci#define ETH_TX_HEN		(1 << 5)
20762306a36Sopenharmony_ci#define ETH_TX_TOK		(1 << 6)
20862306a36Sopenharmony_ci#define ETH_TX_MP		(1 << 7)
20962306a36Sopenharmony_ci#define ETH_TX_BP		(1 << 8)
21062306a36Sopenharmony_ci#define ETH_TX_UND		(1 << 9)
21162306a36Sopenharmony_ci#define ETH_TX_OF		(1 << 10)
21262306a36Sopenharmony_ci#define ETH_TX_ED		(1 << 11)
21362306a36Sopenharmony_ci#define ETH_TX_EC		(1 << 12)
21462306a36Sopenharmony_ci#define ETH_TX_LC		(1 << 13)
21562306a36Sopenharmony_ci#define ETH_TX_TD		(1 << 14)
21662306a36Sopenharmony_ci#define ETH_TX_CRC		(1 << 15)
21762306a36Sopenharmony_ci#define ETH_TX_LE		(1 << 16)
21862306a36Sopenharmony_ci#define ETH_TX_CC		0x001E0000
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ci#endif	/* __ASM_RC32434_ETH_H */
221