18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci *  Definitions for the Ethernet registers
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci *  Copyright 2002 Allend Stichter <allen.stichter@idt.com>
58c2ecf20Sopenharmony_ci *  Copyright 2008 Florian Fainelli <florian@openwrt.org>
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci *  This program is free software; you can redistribute  it and/or modify it
88c2ecf20Sopenharmony_ci *  under  the terms of  the GNU General  Public License as published by the
98c2ecf20Sopenharmony_ci *  Free Software Foundation;  either version 2 of the  License, or (at your
108c2ecf20Sopenharmony_ci *  option) any later version.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
138c2ecf20Sopenharmony_ci *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
148c2ecf20Sopenharmony_ci *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
158c2ecf20Sopenharmony_ci *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
168c2ecf20Sopenharmony_ci *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
178c2ecf20Sopenharmony_ci *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
188c2ecf20Sopenharmony_ci *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
198c2ecf20Sopenharmony_ci *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
208c2ecf20Sopenharmony_ci *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
218c2ecf20Sopenharmony_ci *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci *  You should have received a copy of the  GNU General Public License along
248c2ecf20Sopenharmony_ci *  with this program; if not, write  to the Free Software Foundation, Inc.,
258c2ecf20Sopenharmony_ci *  675 Mass Ave, Cambridge, MA 02139, USA.
268c2ecf20Sopenharmony_ci *
278c2ecf20Sopenharmony_ci */
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#ifndef __ASM_RC32434_ETH_H
308c2ecf20Sopenharmony_ci#define __ASM_RC32434_ETH_H
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define ETH0_BASE_ADDR		0x18060000
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_cistruct eth_regs {
368c2ecf20Sopenharmony_ci	u32 ethintfc;
378c2ecf20Sopenharmony_ci	u32 ethfifott;
388c2ecf20Sopenharmony_ci	u32 etharc;
398c2ecf20Sopenharmony_ci	u32 ethhash0;
408c2ecf20Sopenharmony_ci	u32 ethhash1;
418c2ecf20Sopenharmony_ci	u32 ethu0[4];		/* Reserved. */
428c2ecf20Sopenharmony_ci	u32 ethpfs;
438c2ecf20Sopenharmony_ci	u32 ethmcp;
448c2ecf20Sopenharmony_ci	u32 eth_u1[10];		/* Reserved. */
458c2ecf20Sopenharmony_ci	u32 ethspare;
468c2ecf20Sopenharmony_ci	u32 eth_u2[42];		/* Reserved. */
478c2ecf20Sopenharmony_ci	u32 ethsal0;
488c2ecf20Sopenharmony_ci	u32 ethsah0;
498c2ecf20Sopenharmony_ci	u32 ethsal1;
508c2ecf20Sopenharmony_ci	u32 ethsah1;
518c2ecf20Sopenharmony_ci	u32 ethsal2;
528c2ecf20Sopenharmony_ci	u32 ethsah2;
538c2ecf20Sopenharmony_ci	u32 ethsal3;
548c2ecf20Sopenharmony_ci	u32 ethsah3;
558c2ecf20Sopenharmony_ci	u32 ethrbc;
568c2ecf20Sopenharmony_ci	u32 ethrpc;
578c2ecf20Sopenharmony_ci	u32 ethrupc;
588c2ecf20Sopenharmony_ci	u32 ethrfc;
598c2ecf20Sopenharmony_ci	u32 ethtbc;
608c2ecf20Sopenharmony_ci	u32 ethgpf;
618c2ecf20Sopenharmony_ci	u32 eth_u9[50];		/* Reserved. */
628c2ecf20Sopenharmony_ci	u32 ethmac1;
638c2ecf20Sopenharmony_ci	u32 ethmac2;
648c2ecf20Sopenharmony_ci	u32 ethipgt;
658c2ecf20Sopenharmony_ci	u32 ethipgr;
668c2ecf20Sopenharmony_ci	u32 ethclrt;
678c2ecf20Sopenharmony_ci	u32 ethmaxf;
688c2ecf20Sopenharmony_ci	u32 eth_u10;		/* Reserved. */
698c2ecf20Sopenharmony_ci	u32 ethmtest;
708c2ecf20Sopenharmony_ci	u32 miimcfg;
718c2ecf20Sopenharmony_ci	u32 miimcmd;
728c2ecf20Sopenharmony_ci	u32 miimaddr;
738c2ecf20Sopenharmony_ci	u32 miimwtd;
748c2ecf20Sopenharmony_ci	u32 miimrdd;
758c2ecf20Sopenharmony_ci	u32 miimind;
768c2ecf20Sopenharmony_ci	u32 eth_u11;		/* Reserved. */
778c2ecf20Sopenharmony_ci	u32 eth_u12;		/* Reserved. */
788c2ecf20Sopenharmony_ci	u32 ethcfsa0;
798c2ecf20Sopenharmony_ci	u32 ethcfsa1;
808c2ecf20Sopenharmony_ci	u32 ethcfsa2;
818c2ecf20Sopenharmony_ci};
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci/* Ethernet interrupt registers */
848c2ecf20Sopenharmony_ci#define ETH_INT_FC_EN		(1 << 0)
858c2ecf20Sopenharmony_ci#define ETH_INT_FC_ITS		(1 << 1)
868c2ecf20Sopenharmony_ci#define ETH_INT_FC_RIP		(1 << 2)
878c2ecf20Sopenharmony_ci#define ETH_INT_FC_JAM		(1 << 3)
888c2ecf20Sopenharmony_ci#define ETH_INT_FC_OVR		(1 << 4)
898c2ecf20Sopenharmony_ci#define ETH_INT_FC_UND		(1 << 5)
908c2ecf20Sopenharmony_ci#define ETH_INT_FC_IOC		0x000000c0
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci/* Ethernet FIFO registers */
938c2ecf20Sopenharmony_ci#define ETH_FIFI_TT_TTH_BIT	0
948c2ecf20Sopenharmony_ci#define ETH_FIFO_TT_TTH		0x0000007f
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci/* Ethernet ARC/multicast registers */
978c2ecf20Sopenharmony_ci#define ETH_ARC_PRO		(1 << 0)
988c2ecf20Sopenharmony_ci#define ETH_ARC_AM		(1 << 1)
998c2ecf20Sopenharmony_ci#define ETH_ARC_AFM		(1 << 2)
1008c2ecf20Sopenharmony_ci#define ETH_ARC_AB		(1 << 3)
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci/* Ethernet SAL registers */
1038c2ecf20Sopenharmony_ci#define ETH_SAL_BYTE_5		0x000000ff
1048c2ecf20Sopenharmony_ci#define ETH_SAL_BYTE_4		0x0000ff00
1058c2ecf20Sopenharmony_ci#define ETH_SAL_BYTE_3		0x00ff0000
1068c2ecf20Sopenharmony_ci#define ETH_SAL_BYTE_2		0xff000000
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci/* Ethernet SAH registers */
1098c2ecf20Sopenharmony_ci#define ETH_SAH_BYTE1		0x000000ff
1108c2ecf20Sopenharmony_ci#define ETH_SAH_BYTE0		0x0000ff00
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci/* Ethernet GPF register */
1138c2ecf20Sopenharmony_ci#define ETH_GPF_PTV		0x0000ffff
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci/* Ethernet PFG register */
1168c2ecf20Sopenharmony_ci#define ETH_PFS_PFD		(1 << 0)
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci/* Ethernet CFSA[0-3] registers */
1198c2ecf20Sopenharmony_ci#define ETH_CFSA0_CFSA4		0x000000ff
1208c2ecf20Sopenharmony_ci#define ETH_CFSA0_CFSA5		0x0000ff00
1218c2ecf20Sopenharmony_ci#define ETH_CFSA1_CFSA2		0x000000ff
1228c2ecf20Sopenharmony_ci#define ETH_CFSA1_CFSA3		0x0000ff00
1238c2ecf20Sopenharmony_ci#define ETH_CFSA1_CFSA0		0x000000ff
1248c2ecf20Sopenharmony_ci#define ETH_CFSA1_CFSA1		0x0000ff00
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci/* Ethernet MAC1 registers */
1278c2ecf20Sopenharmony_ci#define ETH_MAC1_RE		(1 << 0)
1288c2ecf20Sopenharmony_ci#define ETH_MAC1_PAF		(1 << 1)
1298c2ecf20Sopenharmony_ci#define ETH_MAC1_RFC		(1 << 2)
1308c2ecf20Sopenharmony_ci#define ETH_MAC1_TFC		(1 << 3)
1318c2ecf20Sopenharmony_ci#define ETH_MAC1_LB		(1 << 4)
1328c2ecf20Sopenharmony_ci#define ETH_MAC1_MR		(1 << 31)
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci/* Ethernet MAC2 registers */
1358c2ecf20Sopenharmony_ci#define ETH_MAC2_FD		(1 << 0)
1368c2ecf20Sopenharmony_ci#define ETH_MAC2_FLC		(1 << 1)
1378c2ecf20Sopenharmony_ci#define ETH_MAC2_HFE		(1 << 2)
1388c2ecf20Sopenharmony_ci#define ETH_MAC2_DC		(1 << 3)
1398c2ecf20Sopenharmony_ci#define ETH_MAC2_CEN		(1 << 4)
1408c2ecf20Sopenharmony_ci#define ETH_MAC2_PE		(1 << 5)
1418c2ecf20Sopenharmony_ci#define ETH_MAC2_VPE		(1 << 6)
1428c2ecf20Sopenharmony_ci#define ETH_MAC2_APE		(1 << 7)
1438c2ecf20Sopenharmony_ci#define ETH_MAC2_PPE		(1 << 8)
1448c2ecf20Sopenharmony_ci#define ETH_MAC2_LPE		(1 << 9)
1458c2ecf20Sopenharmony_ci#define ETH_MAC2_NB		(1 << 12)
1468c2ecf20Sopenharmony_ci#define ETH_MAC2_BP		(1 << 13)
1478c2ecf20Sopenharmony_ci#define ETH_MAC2_ED		(1 << 14)
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci/* Ethernet IPGT register */
1508c2ecf20Sopenharmony_ci#define ETH_IPGT		0x0000007f
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci/* Ethernet IPGR registers */
1538c2ecf20Sopenharmony_ci#define ETH_IPGR_IPGR2		0x0000007f
1548c2ecf20Sopenharmony_ci#define ETH_IPGR_IPGR1		0x00007f00
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci/* Ethernet CLRT registers */
1578c2ecf20Sopenharmony_ci#define ETH_CLRT_MAX_RET	0x0000000f
1588c2ecf20Sopenharmony_ci#define ETH_CLRT_COL_WIN	0x00003f00
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci/* Ethernet MAXF register */
1618c2ecf20Sopenharmony_ci#define ETH_MAXF		0x0000ffff
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci/* Ethernet test registers */
1648c2ecf20Sopenharmony_ci#define ETH_TEST_REG		(1 << 2)
1658c2ecf20Sopenharmony_ci#define ETH_MCP_DIV		0x000000ff
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci/* MII registers */
1688c2ecf20Sopenharmony_ci#define ETH_MII_CFG_RSVD	0x0000000c
1698c2ecf20Sopenharmony_ci#define ETH_MII_CMD_RD		(1 << 0)
1708c2ecf20Sopenharmony_ci#define ETH_MII_CMD_SCN		(1 << 1)
1718c2ecf20Sopenharmony_ci#define ETH_MII_REG_ADDR	0x0000001f
1728c2ecf20Sopenharmony_ci#define ETH_MII_PHY_ADDR	0x00001f00
1738c2ecf20Sopenharmony_ci#define ETH_MII_WTD_DATA	0x0000ffff
1748c2ecf20Sopenharmony_ci#define ETH_MII_RDD_DATA	0x0000ffff
1758c2ecf20Sopenharmony_ci#define ETH_MII_IND_BSY		(1 << 0)
1768c2ecf20Sopenharmony_ci#define ETH_MII_IND_SCN		(1 << 1)
1778c2ecf20Sopenharmony_ci#define ETH_MII_IND_NV		(1 << 2)
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci/*
1808c2ecf20Sopenharmony_ci * Values for the DEVCS field of the Ethernet DMA Rx and Tx descriptors.
1818c2ecf20Sopenharmony_ci */
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci#define ETH_RX_FD		(1 << 0)
1848c2ecf20Sopenharmony_ci#define ETH_RX_LD		(1 << 1)
1858c2ecf20Sopenharmony_ci#define ETH_RX_ROK		(1 << 2)
1868c2ecf20Sopenharmony_ci#define ETH_RX_FM		(1 << 3)
1878c2ecf20Sopenharmony_ci#define ETH_RX_MP		(1 << 4)
1888c2ecf20Sopenharmony_ci#define ETH_RX_BP		(1 << 5)
1898c2ecf20Sopenharmony_ci#define ETH_RX_VLT		(1 << 6)
1908c2ecf20Sopenharmony_ci#define ETH_RX_CF		(1 << 7)
1918c2ecf20Sopenharmony_ci#define ETH_RX_OVR		(1 << 8)
1928c2ecf20Sopenharmony_ci#define ETH_RX_CRC		(1 << 9)
1938c2ecf20Sopenharmony_ci#define ETH_RX_CV		(1 << 10)
1948c2ecf20Sopenharmony_ci#define ETH_RX_DB		(1 << 11)
1958c2ecf20Sopenharmony_ci#define ETH_RX_LE		(1 << 12)
1968c2ecf20Sopenharmony_ci#define ETH_RX_LOR		(1 << 13)
1978c2ecf20Sopenharmony_ci#define ETH_RX_CES		(1 << 14)
1988c2ecf20Sopenharmony_ci#define ETH_RX_LEN_BIT		16
1998c2ecf20Sopenharmony_ci#define ETH_RX_LEN		0xffff0000
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ci#define ETH_TX_FD		(1 << 0)
2028c2ecf20Sopenharmony_ci#define ETH_TX_LD		(1 << 1)
2038c2ecf20Sopenharmony_ci#define ETH_TX_OEN		(1 << 2)
2048c2ecf20Sopenharmony_ci#define ETH_TX_PEN		(1 << 3)
2058c2ecf20Sopenharmony_ci#define ETH_TX_CEN		(1 << 4)
2068c2ecf20Sopenharmony_ci#define ETH_TX_HEN		(1 << 5)
2078c2ecf20Sopenharmony_ci#define ETH_TX_TOK		(1 << 6)
2088c2ecf20Sopenharmony_ci#define ETH_TX_MP		(1 << 7)
2098c2ecf20Sopenharmony_ci#define ETH_TX_BP		(1 << 8)
2108c2ecf20Sopenharmony_ci#define ETH_TX_UND		(1 << 9)
2118c2ecf20Sopenharmony_ci#define ETH_TX_OF		(1 << 10)
2128c2ecf20Sopenharmony_ci#define ETH_TX_ED		(1 << 11)
2138c2ecf20Sopenharmony_ci#define ETH_TX_EC		(1 << 12)
2148c2ecf20Sopenharmony_ci#define ETH_TX_LC		(1 << 13)
2158c2ecf20Sopenharmony_ci#define ETH_TX_TD		(1 << 14)
2168c2ecf20Sopenharmony_ci#define ETH_TX_CRC		(1 << 15)
2178c2ecf20Sopenharmony_ci#define ETH_TX_LE		(1 << 16)
2188c2ecf20Sopenharmony_ci#define ETH_TX_CC		0x001E0000
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci#endif	/* __ASM_RC32434_ETH_H */
221