xref: /freebsd/sys/arm/ti/cpsw/if_cpswreg.h (revision e53470fee3cf7ba343701650d5e75b8142046acf)
1*e53470feSOleksandr Tymoshenko /*-
2*e53470feSOleksandr Tymoshenko  * Copyright (c) 2012 Damjan Marion <dmarion@Freebsd.org>
3*e53470feSOleksandr Tymoshenko  * All rights reserved.
4*e53470feSOleksandr Tymoshenko  *
5*e53470feSOleksandr Tymoshenko  * Redistribution and use in source and binary forms, with or without
6*e53470feSOleksandr Tymoshenko  * modification, are permitted provided that the following conditions
7*e53470feSOleksandr Tymoshenko  * are met:
8*e53470feSOleksandr Tymoshenko  * 1. Redistributions of source code must retain the above copyright
9*e53470feSOleksandr Tymoshenko  *    notice, this list of conditions and the following disclaimer.
10*e53470feSOleksandr Tymoshenko  * 2. Redistributions in binary form must reproduce the above copyright
11*e53470feSOleksandr Tymoshenko  *    notice, this list of conditions and the following disclaimer in the
12*e53470feSOleksandr Tymoshenko  *    documentation and/or other materials provided with the distribution.
13*e53470feSOleksandr Tymoshenko  *
14*e53470feSOleksandr Tymoshenko  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15*e53470feSOleksandr Tymoshenko  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16*e53470feSOleksandr Tymoshenko  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17*e53470feSOleksandr Tymoshenko  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18*e53470feSOleksandr Tymoshenko  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19*e53470feSOleksandr Tymoshenko  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20*e53470feSOleksandr Tymoshenko  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21*e53470feSOleksandr Tymoshenko  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22*e53470feSOleksandr Tymoshenko  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23*e53470feSOleksandr Tymoshenko  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24*e53470feSOleksandr Tymoshenko  * SUCH DAMAGE.
25*e53470feSOleksandr Tymoshenko  *
26*e53470feSOleksandr Tymoshenko  * $FreeBSD$
27*e53470feSOleksandr Tymoshenko  */
28*e53470feSOleksandr Tymoshenko 
29*e53470feSOleksandr Tymoshenko #ifndef	_IF_CPSWREG_H
30*e53470feSOleksandr Tymoshenko #define	_IF_CPSWREG_H
31*e53470feSOleksandr Tymoshenko 
32*e53470feSOleksandr Tymoshenko #define CPSW_SS_OFFSET			0x0000
33*e53470feSOleksandr Tymoshenko #define CPSW_SS_IDVER			(CPSW_SS_OFFSET + 0x00)
34*e53470feSOleksandr Tymoshenko #define CPSW_SS_SOFT_RESET		(CPSW_SS_OFFSET + 0x08)
35*e53470feSOleksandr Tymoshenko #define CPSW_SS_STAT_PORT_EN		(CPSW_SS_OFFSET + 0x0C)
36*e53470feSOleksandr Tymoshenko #define CPSW_SS_PTYPE			(CPSW_SS_OFFSET + 0x10)
37*e53470feSOleksandr Tymoshenko 
38*e53470feSOleksandr Tymoshenko #define CPSW_PORT_OFFSET		0x0100
39*e53470feSOleksandr Tymoshenko #define CPSW_PORT_P_TX_PRI_MAP(p)	(CPSW_PORT_OFFSET + 0x118 + ((p-1) * 0x100))
40*e53470feSOleksandr Tymoshenko #define CPSW_PORT_P0_CPDMA_TX_PRI_MAP	(CPSW_PORT_OFFSET + 0x01C)
41*e53470feSOleksandr Tymoshenko #define CPSW_PORT_P0_CPDMA_RX_CH_MAP	(CPSW_PORT_OFFSET + 0x020)
42*e53470feSOleksandr Tymoshenko #define CPSW_PORT_P_SA_LO(p)		(CPSW_PORT_OFFSET + 0x120 + ((p-1) * 0x100))
43*e53470feSOleksandr Tymoshenko #define CPSW_PORT_P_SA_HI(p)		(CPSW_PORT_OFFSET + 0x124 + ((p-1) * 0x100))
44*e53470feSOleksandr Tymoshenko 
45*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_OFFSET		0x0800
46*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_TX_CONTROL		(CPSW_CPDMA_OFFSET + 0x04)
47*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_RX_CONTROL		(CPSW_CPDMA_OFFSET + 0x14)
48*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_SOFT_RESET		(CPSW_CPDMA_OFFSET + 0x1c)
49*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_DMACONTROL		(CPSW_CPDMA_OFFSET + 0x20)
50*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_DMASTATUS		(CPSW_CPDMA_OFFSET + 0x24)
51*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_RX_BUFFER_OFFSET	(CPSW_CPDMA_OFFSET + 0x28)
52*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_TX_INTSTAT_RAW	(CPSW_CPDMA_OFFSET + 0x80)
53*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_TX_INTSTAT_MASKED	(CPSW_CPDMA_OFFSET + 0x84)
54*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_TX_INTMASK_SET	(CPSW_CPDMA_OFFSET + 0x88)
55*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_TX_INTMASK_CLEAR	(CPSW_CPDMA_OFFSET + 0x8C)
56*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_CPDMA_EOI_VECTOR	(CPSW_CPDMA_OFFSET + 0x94)
57*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_RX_INTSTAT_RAW	(CPSW_CPDMA_OFFSET + 0xA0)
58*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_RX_INTSTAT_MASKED	(CPSW_CPDMA_OFFSET + 0xA4)
59*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_RX_INTMASK_SET	(CPSW_CPDMA_OFFSET + 0xA8)
60*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_RX_INTMASK_CLEAR	(CPSW_CPDMA_OFFSET + 0xAc)
61*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_DMA_INTSTAT_RAW	(CPSW_CPDMA_OFFSET + 0xB0)
62*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_DMA_INTSTAT_MASKED	(CPSW_CPDMA_OFFSET + 0xB4)
63*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_DMA_INTMASK_SET	(CPSW_CPDMA_OFFSET + 0xB8)
64*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_DMA_INTMASK_CLEAR	(CPSW_CPDMA_OFFSET + 0xBC)
65*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_RX_FREEBUFFER(p)	(CPSW_CPDMA_OFFSET + 0x0e0 + ((p) * 0x04))
66*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_TX_HDP(p)		(CPSW_CPDMA_OFFSET + 0x200 + ((p) * 0x04))
67*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_RX_HDP(p)		(CPSW_CPDMA_OFFSET + 0x220 + ((p) * 0x04))
68*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_TX_CP(p)		(CPSW_CPDMA_OFFSET + 0x240 + ((p) * 0x04))
69*e53470feSOleksandr Tymoshenko #define CPSW_CPDMA_RX_CP(p)		(CPSW_CPDMA_OFFSET + 0x260 + ((p) * 0x04))
70*e53470feSOleksandr Tymoshenko 
71*e53470feSOleksandr Tymoshenko #define CPSW_CPTS_OFFSET		0x0C00
72*e53470feSOleksandr Tymoshenko 
73*e53470feSOleksandr Tymoshenko #define CPSW_ALE_OFFSET			0x0D00
74*e53470feSOleksandr Tymoshenko #define CPSW_ALE_CONTROL		(CPSW_ALE_OFFSET + 0x08)
75*e53470feSOleksandr Tymoshenko #define CPSW_ALE_TBLCTL			(CPSW_ALE_OFFSET + 0x20)
76*e53470feSOleksandr Tymoshenko #define CPSW_ALE_TBLW2			(CPSW_ALE_OFFSET + 0x34)
77*e53470feSOleksandr Tymoshenko #define CPSW_ALE_TBLW1			(CPSW_ALE_OFFSET + 0x38)
78*e53470feSOleksandr Tymoshenko #define CPSW_ALE_TBLW0			(CPSW_ALE_OFFSET + 0x3C)
79*e53470feSOleksandr Tymoshenko #define CPSW_ALE_PORTCTL(p)		(CPSW_ALE_OFFSET + 0x40 + ((p) * 0x04))
80*e53470feSOleksandr Tymoshenko 
81*e53470feSOleksandr Tymoshenko #define CPSW_SL_OFFSET			0x0D80
82*e53470feSOleksandr Tymoshenko #define CPSW_SL_MACCONTROL(p)		(CPSW_SL_OFFSET + (0x40 * (p)) + 0x04)
83*e53470feSOleksandr Tymoshenko #define CPSW_SL_SOFT_RESET(p)		(CPSW_SL_OFFSET + (0x40 * (p)) + 0x0C)
84*e53470feSOleksandr Tymoshenko #define CPSW_SL_RX_MAXLEN(p)		(CPSW_SL_OFFSET + (0x40 * (p)) + 0x10)
85*e53470feSOleksandr Tymoshenko #define CPSW_SL_RX_PRI_MAP(p)		(CPSW_SL_OFFSET + (0x40 * (p)) + 0x24)
86*e53470feSOleksandr Tymoshenko 
87*e53470feSOleksandr Tymoshenko #define MDIO_OFFSET			0x1000
88*e53470feSOleksandr Tymoshenko #define MDIOCONTROL			(MDIO_OFFSET + 0x04)
89*e53470feSOleksandr Tymoshenko #define MDIOUSERACCESS0			(MDIO_OFFSET + 0x80)
90*e53470feSOleksandr Tymoshenko #define MDIOUSERPHYSEL0			(MDIO_OFFSET + 0x84)
91*e53470feSOleksandr Tymoshenko 
92*e53470feSOleksandr Tymoshenko #define CPSW_WR_OFFSET			0x1200
93*e53470feSOleksandr Tymoshenko #define CPSW_WR_SOFT_RESET		(CPSW_WR_OFFSET + 0x04)
94*e53470feSOleksandr Tymoshenko #define CPSW_WR_CONTROL			(CPSW_WR_OFFSET + 0x08)
95*e53470feSOleksandr Tymoshenko #define CPSW_WR_INT_CONTROL		(CPSW_WR_OFFSET + 0x0c)
96*e53470feSOleksandr Tymoshenko #define CPSW_WR_C_RX_THRESH_EN(p)	(CPSW_WR_OFFSET + (0x10 * (p)) + 0x10)
97*e53470feSOleksandr Tymoshenko #define CPSW_WR_C_RX_EN(p)		(CPSW_WR_OFFSET + (0x10 * (p)) + 0x14)
98*e53470feSOleksandr Tymoshenko #define CPSW_WR_C_TX_EN(p)		(CPSW_WR_OFFSET + (0x10 * (p)) + 0x18)
99*e53470feSOleksandr Tymoshenko #define CPSW_WR_C_MISC_EN(p)		(CPSW_WR_OFFSET + (0x10 * (p)) + 0x1C)
100*e53470feSOleksandr Tymoshenko #define CPSW_WR_C_RX_THRESH_STAT(p)	(CPSW_WR_OFFSET + (0x10 * (p)) + 0x40)
101*e53470feSOleksandr Tymoshenko #define CPSW_WR_C_RX_STAT(p)		(CPSW_WR_OFFSET + (0x10 * (p)) + 0x44)
102*e53470feSOleksandr Tymoshenko #define CPSW_WR_C_TX_STAT(p)		(CPSW_WR_OFFSET + (0x10 * (p)) + 0x48)
103*e53470feSOleksandr Tymoshenko #define CPSW_WR_C_MISC_STAT(p)		(CPSW_WR_OFFSET + (0x10 * (p)) + 0x4C)
104*e53470feSOleksandr Tymoshenko 
105*e53470feSOleksandr Tymoshenko #define CPSW_CPPI_RAM_OFFSET		0x2000
106*e53470feSOleksandr Tymoshenko 
107*e53470feSOleksandr Tymoshenko #endif /*_IF_CPSWREG_H */
108