31#ifndef _AM335X_ETH_DRIVER_H
32#define _AM335X_ETH_DRIVER_H
38#ifndef AM335X_ETH_TX_BUFFER_COUNT
39 #define AM335X_ETH_TX_BUFFER_COUNT 16
40#elif (AM335X_ETH_TX_BUFFER_COUNT < 1)
41 #error AM335X_ETH_TX_BUFFER_COUNT parameter is not valid
45#ifndef AM335X_ETH_TX_BUFFER_SIZE
46 #define AM335X_ETH_TX_BUFFER_SIZE 1536
47#elif (AM335X_ETH_TX_BUFFER_SIZE != 1536)
48 #error AM335X_ETH_TX_BUFFER_SIZE parameter is not valid
52#ifndef AM335X_ETH_RX_BUFFER_COUNT
53 #define AM335X_ETH_RX_BUFFER_COUNT 16
54#elif (AM335X_ETH_RX_BUFFER_COUNT < 1)
55 #error AM335X_ETH_RX_BUFFER_COUNT parameter is not valid
59#ifndef AM335X_ETH_RX_BUFFER_SIZE
60 #define AM335X_ETH_RX_BUFFER_SIZE 1536
61#elif (AM335X_ETH_RX_BUFFER_SIZE != 1536)
62 #error AM335X_ETH_RX_BUFFER_SIZE parameter is not valid
66#ifndef AM335X_ETH_IRQ_PRIORITY
67 #define AM335X_ETH_IRQ_PRIORITY 1
68#elif (AM335X_ETH_IRQ_PRIORITY < 0)
69 #error AM335X_ETH_IRQ_PRIORITY parameter is not valid
73#ifndef AM335X_ETH_RAM_SECTION
74 #define AM335X_ETH_RAM_SECTION ".ram_no_cache"
78#ifndef AM335X_ETH_RAM_CPPI_SECTION
79 #define AM335X_ETH_RAM_CPPI_SECTION ".ram_cppi"
83#ifndef SYS_INT_3PGSWRXINT0
84 #define SYS_INT_3PGSWRXINT0 41
87#ifndef SYS_INT_3PGSWTXINT0
88 #define SYS_INT_3PGSWTXINT0 42
112#define CM_PER_CPGMAC0_CLKCTRL_R HWREG(SOC_PRCM_REGS + CM_PER_CPGMAC0_CLKCTRL)
113#define CM_PER_CPSW_CLKSTCTRL_R HWREG(SOC_PRCM_REGS + CM_PER_CPSW_CLKSTCTRL)
116#define CONTROL_MAC_ID_LO_R(n) HWREG(SOC_CONTROL_REGS + CONTROL_MAC_ID_LO(n))
117#define CONTROL_MAC_ID_HI_R(n) HWREG(SOC_CONTROL_REGS + CONTROL_MAC_ID_HI(n))
118#define CONTROL_GMII_SEL_R HWREG(SOC_CONTROL_REGS + CONTROL_GMII_SEL)
119#define CONTROL_CONF_GPMC_A_R(n) HWREG(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_A(n))
120#define CONTROL_CONF_MII1_COL_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MII1_COL)
121#define CONTROL_CONF_MII1_CRS_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MII1_CRS)
122#define CONTROL_CONF_MII1_RXERR_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MII1_RXERR)
123#define CONTROL_CONF_MII1_TXEN_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MII1_TXEN)
124#define CONTROL_CONF_MII1_RXDV_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MII1_RXDV)
125#define CONTROL_CONF_MII1_TXD3_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MII1_TXD3)
126#define CONTROL_CONF_MII1_TXD2_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MII1_TXD2)
127#define CONTROL_CONF_MII1_TXD1_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MII1_TXD1)
128#define CONTROL_CONF_MII1_TXD0_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MII1_TXD0)
129#define CONTROL_CONF_MII1_TXCLK_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MII1_TXCLK)
130#define CONTROL_CONF_MII1_RXCLK_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MII1_RXCLK)
131#define CONTROL_CONF_MII1_RXD3_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MII1_RXD3)
132#define CONTROL_CONF_MII1_RXD2_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MII1_RXD2)
133#define CONTROL_CONF_MII1_RXD1_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MII1_RXD1)
134#define CONTROL_CONF_MII1_RXD0_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MII1_RXD0)
135#define CONTROL_CONF_RMII1_REFCLK_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_RMII1_REFCLK)
136#define CONTROL_CONF_MDIO_DATA_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MDIO_DATA)
137#define CONTROL_CONF_MDIO_CLK_R HWREG(SOC_CONTROL_REGS + CONTROL_CONF_MDIO_CLK)
140#define CPSW_ALE_IDVER_R HWREG(SOC_CPSW_ALE_REGS + CPSW_ALE_IDVER)
141#define CPSW_ALE_CTRL_R HWREG(SOC_CPSW_ALE_REGS + CPSW_ALE_CTRL)
142#define CPSW_ALE_PRESCALE_R HWREG(SOC_CPSW_ALE_REGS + CPSW_ALE_PRESCALE)
143#define CPSW_ALE_UNKNOWN_VLAN_R HWREG(SOC_CPSW_ALE_REGS + CPSW_ALE_UNKNOWN_VLAN)
144#define CPSW_ALE_TBLCTL_R HWREG(SOC_CPSW_ALE_REGS + CPSW_ALE_TBLCTL)
145#define CPSW_ALE_TBLW_R(n) HWREG(SOC_CPSW_ALE_REGS + CPSW_ALE_TBLW(n))
146#define CPSW_ALE_PORTCTL_R(n) HWREG(SOC_CPSW_ALE_REGS + CPSW_ALE_PORTCTL(n))
149#define CPSW_CPDMA_TX_IDVER_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_TX_IDVER)
150#define CPSW_CPDMA_TX_CTRL_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_TX_CTRL)
151#define CPSW_CPDMA_TX_TEARDOWN_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_TX_TEARDOWN)
152#define CPSW_CPDMA_RX_IDVER_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_RX_IDVER)
153#define CPSW_CPDMA_RX_CTRL_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_RX_CTRL)
154#define CPSW_CPDMA_RX_TEARDOWN_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_RX_TEARDOWN)
155#define CPSW_CPDMA_SOFT_RESET_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_SOFT_RESET)
156#define CPSW_CPDMA_DMACONTROL_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_DMACONTROL)
157#define CPSW_CPDMA_DMASTATUS_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_DMASTATUS)
158#define CPSW_CPDMA_RX_BUFFER_OFFSET_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_RX_BUFFER_OFFSET)
159#define CPSW_CPDMA_EMCONTROL_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_EMCONTROL)
160#define CPSW_CPDMA_TX_PRI_RATE_R(n) HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_TX_PRI_RATE(n))
161#define CPSW_CPDMA_TX_INTSTAT_RAW_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_TX_INTSTAT_RAW)
162#define CPSW_CPDMA_TX_INTSTAT_MASKED_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_TX_INTSTAT_MASKED)
163#define CPSW_CPDMA_TX_INTMASK_SET_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_TX_INTMASK_SET)
164#define CPSW_CPDMA_TX_INTMASK_CLEAR_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_TX_INTMASK_CLEAR)
165#define CPSW_CPDMA_IN_VECTOR_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_IN_VECTOR)
166#define CPSW_CPDMA_EOI_VECTOR_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_EOI_VECTOR)
167#define CPSW_CPDMA_RX_INTSTAT_RAW_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_RX_INTSTAT_RAW)
168#define CPSW_CPDMA_RX_INTSTAT_MASKED_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_RX_INTSTAT_MASKED)
169#define CPSW_CPDMA_RX_INTMASK_SET_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_RX_INTMASK_SET)
170#define CPSW_CPDMA_RX_INTMASK_CLEAR_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_RX_INTMASK_CLEAR)
171#define CPSW_CPDMA_DMA_INTSTAT_RAW_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_DMA_INTSTAT_RAW)
172#define CPSW_CPDMA_DMA_INTSTAT_MASKED_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_DMA_INTSTAT_MASKED)
173#define CPSW_CPDMA_DMA_INTMASK_SET_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_DMA_INTMASK_SET)
174#define CPSW_CPDMA_DMA_INTMASK_CLEAR_R HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_DMA_INTMASK_CLEAR)
175#define CPSW_CPDMA_RX_PENDTHRESH_R(n) HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_RX_PENDTHRESH(n))
176#define CPSW_CPDMA_RX_FREEBUFFER_R(n) HWREG(SOC_CPSW_CPDMA_REGS + CPSW_CPDMA_RX_FREEBUFFER(n))
177#define CPSW_CPDMA_STATERAM_TX_HDP_R(n) HWREG(SOC_CPSW_CPDMA_REGS + 0x200 + CPSW_CPDMA_STATERAM_TX_HDP(n))
178#define CPSW_CPDMA_STATERAM_RX_HDP_R(n) HWREG(SOC_CPSW_CPDMA_REGS + 0x200 + CPSW_CPDMA_STATERAM_RX_HDP(n))
179#define CPSW_CPDMA_STATERAM_TX_CP_R(n) HWREG(SOC_CPSW_CPDMA_REGS + 0x200 + CPSW_CPDMA_STATERAM_TX_CP(n))
180#define CPSW_CPDMA_STATERAM_RX_CP_R(n) HWREG(SOC_CPSW_CPDMA_REGS + 0x200 + CPSW_CPDMA_STATERAM_RX_CP(n))
183#define CPSW_PORT0_CTRL_R HWREG(SOC_CPSW_PORT_0_REGS + CPSW_PORT_P_CTRL(0))
184#define CPSW_PORT0_MAX_BLKS_R HWREG(SOC_CPSW_PORT_0_REGS + CPSW_PORT_P_MAX_BLKS(0))
185#define CPSW_PORT0_BLK_CNT_R HWREG(SOC_CPSW_PORT_0_REGS + CPSW_PORT_P_BLK_CNT(0))
186#define CPSW_PORT0_TX_IN_CTL_R HWREG(SOC_CPSW_PORT_0_REGS + CPSW_PORT_P_TX_IN_CTL(0))
187#define CPSW_PORT0_VLAN_R HWREG(SOC_CPSW_PORT_0_REGS + CPSW_PORT_P_VLAN(0))
188#define CPSW_PORT0_TX_PRI_MAP_R HWREG(SOC_CPSW_PORT_0_REGS + CPSW_PORT_P_TX_PRI_MAP(0))
189#define CPSW_PORT0_CPDMA_TX_PRI_MAP_R HWREG(SOC_CPSW_PORT_0_REGS + CPSW_PORT_P0_CPDMA_TX_PRI_MAP)
190#define CPSW_PORT0_CPDMA_RX_CH_MAP_R HWREG(SOC_CPSW_PORT_0_REGS + CPSW_PORT_P0_CPDMA_RX_CH_MAP)
191#define CPSW_PORT0_RX_DSCP_PRI_MAP_R(n) HWREG(SOC_CPSW_PORT_0_REGS + CPSW_PORT_P_RX_DSCP_PRI_MAP(0, n))
192#define CPSW_PORT0_TS_SEQ_MTYPE_R HWREG(SOC_CPSW_PORT_0_REGS + CPSW_PORT_P_TS_SEQ_MTYPE(0))
193#define CPSW_PORT0_SA_LO_R HWREG(SOC_CPSW_PORT_0_REGS + CPSW_PORT_P_SA_LO(0))
194#define CPSW_PORT0_SA_HI_R HWREG(SOC_CPSW_PORT_0_REGS + CPSW_PORT_P_SA_HI(0))
195#define CPSW_PORT0_SEND_PERCENT_R HWREG(SOC_CPSW_PORT_0_REGS + CPSW_PORT_P_SEND_PERCENT(0))
197#define CPSW_PORT1_CTRL_R HWREG(SOC_CPSW_PORT_1_REGS + CPSW_PORT_P_CTRL(0))
198#define CPSW_PORT1_MAX_BLKS_R HWREG(SOC_CPSW_PORT_1_REGS + CPSW_PORT_P_MAX_BLKS(0))
199#define CPSW_PORT1_BLK_CNT_R HWREG(SOC_CPSW_PORT_1_REGS + CPSW_PORT_P_BLK_CNT(0))
200#define CPSW_PORT1_TX_IN_CTL_R HWREG(SOC_CPSW_PORT_1_REGS + CPSW_PORT_P_TX_IN_CTL(0))
201#define CPSW_PORT1_VLAN_R HWREG(SOC_CPSW_PORT_1_REGS + CPSW_PORT_P_VLAN(0))
202#define CPSW_PORT1_TX_PRI_MAP_R HWREG(SOC_CPSW_PORT_1_REGS + CPSW_PORT_P_TX_PRI_MAP(0))
203#define CPSW_PORT1_RX_DSCP_PRI_MAP_R(n) HWREG(SOC_CPSW_PORT_1_REGS + CPSW_PORT_P_RX_DSCP_PRI_MAP(0, n))
204#define CPSW_PORT1_TS_SEQ_MTYPE_R HWREG(SOC_CPSW_PORT_1_REGS + CPSW_PORT_P_TS_SEQ_MTYPE(0))
205#define CPSW_PORT1_SA_LO_R HWREG(SOC_CPSW_PORT_1_REGS + CPSW_PORT_P_SA_LO(0))
206#define CPSW_PORT1_SA_HI_R HWREG(SOC_CPSW_PORT_1_REGS + CPSW_PORT_P_SA_HI(0))
207#define CPSW_PORT1_SEND_PERCENT_R HWREG(SOC_CPSW_PORT_1_REGS + CPSW_PORT_P_SEND_PERCENT(0))
209#define CPSW_PORT2_CTRL_R HWREG(SOC_CPSW_PORT_2_REGS + CPSW_PORT_P_CTRL(0))
210#define CPSW_PORT2_MAX_BLKS_R HWREG(SOC_CPSW_PORT_2_REGS + CPSW_PORT_P_MAX_BLKS(0))
211#define CPSW_PORT2_BLK_CNT_R HWREG(SOC_CPSW_PORT_2_REGS + CPSW_PORT_P_BLK_CNT(0))
212#define CPSW_PORT2_TX_IN_CTL_R HWREG(SOC_CPSW_PORT_2_REGS + CPSW_PORT_P_TX_IN_CTL(0))
213#define CPSW_PORT2_VLAN_R HWREG(SOC_CPSW_PORT_2_REGS + CPSW_PORT_P_VLAN(0))
214#define CPSW_PORT2_TX_PRI_MAP_R HWREG(SOC_CPSW_PORT_2_REGS + CPSW_PORT_P_TX_PRI_MAP(0))
215#define CPSW_PORT2_RX_DSCP_PRI_MAP_R(n) HWREG(SOC_CPSW_PORT_2_REGS + CPSW_PORT_P_RX_DSCP_PRI_MAP(0, n))
216#define CPSW_PORT2_TS_SEQ_MTYPE_R HWREG(SOC_CPSW_PORT_2_REGS + CPSW_PORT_P_TS_SEQ_MTYPE(0))
217#define CPSW_PORT2_SA_LO_R HWREG(SOC_CPSW_PORT_2_REGS + CPSW_PORT_P_SA_LO(0))
218#define CPSW_PORT2_SA_HI_R HWREG(SOC_CPSW_PORT_2_REGS + CPSW_PORT_P_SA_HI(0))
219#define CPSW_PORT2_SEND_PERCENT_R HWREG(SOC_CPSW_PORT_2_REGS + CPSW_PORT_P_SEND_PERCENT(0))
222#define CPSW_SL1_IDVER_R HWREG(SOC_CPSW_SLIVER_1_REGS + CPSW_SL_IDVER)
223#define CPSW_SL1_MACCTRL_R HWREG(SOC_CPSW_SLIVER_1_REGS + CPSW_SL_MACCTRL)
224#define CPSW_SL1_MACSTS_R HWREG(SOC_CPSW_SLIVER_1_REGS + CPSW_SL_MACSTS)
225#define CPSW_SL1_SOFT_RESET_R HWREG(SOC_CPSW_SLIVER_1_REGS + CPSW_SL_SOFT_RESET)
226#define CPSW_SL1_RX_MAXLEN_R HWREG(SOC_CPSW_SLIVER_1_REGS + CPSW_SL_RX_MAXLEN)
227#define CPSW_SL1_BOFFTEST_R HWREG(SOC_CPSW_SLIVER_1_REGS + CPSW_SL_BOFFTEST)
228#define CPSW_SL1_RX_PAUSE_R HWREG(SOC_CPSW_SLIVER_1_REGS + CPSW_SL_RX_PAUSE)
229#define CPSW_SL1_TX_PAUSE_R HWREG(SOC_CPSW_SLIVER_1_REGS + CPSW_SL_TX_PAUSE)
230#define CPSW_SL1_EMCTRL_R HWREG(SOC_CPSW_SLIVER_1_REGS + CPSW_SL_EMCTRL)
231#define CPSW_SL1_RX_PRI_MAP_R HWREG(SOC_CPSW_SLIVER_1_REGS + CPSW_SL_RX_PRI_MAP)
232#define CPSW_SL1_TX_GAP_R HWREG(SOC_CPSW_SLIVER_1_REGS + CPSW_SL_TX_GAP)
234#define CPSW_SL2_IDVER_R HWREG(SOC_CPSW_SLIVER_2_REGS + CPSW_SL_IDVER)
235#define CPSW_SL2_MACCTRL_R HWREG(SOC_CPSW_SLIVER_2_REGS + CPSW_SL_MACCTRL)
236#define CPSW_SL2_MACSTS_R HWREG(SOC_CPSW_SLIVER_2_REGS + CPSW_SL_MACSTS)
237#define CPSW_SL2_SOFT_RESET_R HWREG(SOC_CPSW_SLIVER_2_REGS + CPSW_SL_SOFT_RESET)
238#define CPSW_SL2_RX_MAXLEN_R HWREG(SOC_CPSW_SLIVER_2_REGS + CPSW_SL_RX_MAXLEN)
239#define CPSW_SL2_BOFFTEST_R HWREG(SOC_CPSW_SLIVER_2_REGS + CPSW_SL_BOFFTEST)
240#define CPSW_SL2_RX_PAUSE_R HWREG(SOC_CPSW_SLIVER_2_REGS + CPSW_SL_RX_PAUSE)
241#define CPSW_SL2_TX_PAUSE_R HWREG(SOC_CPSW_SLIVER_2_REGS + CPSW_SL_TX_PAUSE)
242#define CPSW_SL2_EMCTRL_R HWREG(SOC_CPSW_SLIVER_2_REGS + CPSW_SL_EMCTRL)
243#define CPSW_SL2_RX_PRI_MAP_R HWREG(SOC_CPSW_SLIVER_2_REGS + CPSW_SL_RX_PRI_MAP)
244#define CPSW_SL2_TX_GAP_R HWREG(SOC_CPSW_SLIVER_2_REGS + CPSW_SL_TX_GAP)
247#define CPSW_SS_ID_VER_R HWREG(SOC_CPSW_SS_REGS + CPSW_SS_ID_VER)
248#define CPSW_SS_CTRL_R HWREG(SOC_CPSW_SS_REGS + CPSW_SS_CTRL)
249#define CPSW_SS_SOFT_RESET_R HWREG(SOC_CPSW_SS_REGS + CPSW_SS_SOFT_RESET)
250#define CPSW_SS_STAT_PORT_EN_R HWREG(SOC_CPSW_SS_REGS + CPSW_SS_STAT_PORT_EN)
251#define CPSW_SS_PTYPE_R HWREG(SOC_CPSW_SS_REGS + CPSW_SS_PTYPE)
252#define CPSW_SS_SOFT_IDLE_R HWREG(SOC_CPSW_SS_REGS + CPSW_SS_SOFT_IDLE)
253#define CPSW_SS_THRU_RATE_R HWREG(SOC_CPSW_SS_REGS + CPSW_SS_THRU_RATE)
254#define CPSW_SS_GAP_THRESH_R HWREG(SOC_CPSW_SS_REGS + CPSW_SS_GAP_THRESH)
255#define CPSW_SS_TX_START_WDS_R HWREG(SOC_CPSW_SS_REGS + CPSW_SS_TX_START_WDS)
256#define CPSW_SS_FLOW_CTRL_R HWREG(SOC_CPSW_SS_REGS + CPSW_SS_FLOW_CTRL)
257#define CPSW_SS_VLAN_LTYPE_R HWREG(SOC_CPSW_SS_REGS + CPSW_SS_VLAN_LTYPE)
258#define CPSW_SS_TS_LTYPE_R HWREG(SOC_CPSW_SS_REGS + CPSW_SS_TS_LTYPE)
259#define CPSW_SS_DLR_LTYPE_R HWREG(SOC_CPSW_SS_REGS + CPSW_SS_DLR_LTYPE)
262#define CPSW_WR_IDVER_R HWREG(SOC_CPSW_WR_REGS + CPSW_WR_IDVER)
263#define CPSW_WR_SOFT_RESET_R HWREG(SOC_CPSW_WR_REGS + CPSW_WR_SOFT_RESET)
264#define CPSW_WR_CTRL_R HWREG(SOC_CPSW_WR_REGS + CPSW_WR_CTRL)
265#define CPSW_WR_INT_CTRL_R HWREG(SOC_CPSW_WR_REGS + CPSW_WR_INT_CTRL)
266#define CPSW_WR_C_RX_THRESH_EN_R(n) HWREG(SOC_CPSW_WR_REGS + CPSW_WR_C_RX_THRESH_EN(n))
267#define CPSW_WR_C_RX_EN_R(n) HWREG(SOC_CPSW_WR_REGS + CPSW_WR_C_RX_EN(n))
268#define CPSW_WR_C_TX_EN_R(n) HWREG(SOC_CPSW_WR_REGS + CPSW_WR_C_TX_EN(n))
269#define CPSW_WR_C_MISC_EN_R(n) HWREG(SOC_CPSW_WR_REGS + CPSW_WR_C_MISC_EN(n))
270#define CPSW_WR_C_RX_THRESH_STAT_R(n) HWREG(SOC_CPSW_WR_REGS + CPSW_WR_C_RX_THRESH_STAT(n))
271#define CPSW_WR_C_RX_STAT_R(n) HWREG(SOC_CPSW_WR_REGS + CPSW_WR_C_RX_STAT(n))
272#define CPSW_WR_C_TX_STAT_R(n) HWREG(SOC_CPSW_WR_REGS + CPSW_WR_C_TX_STAT(n))
273#define CPSW_WR_C_MISC_STAT_R(n) HWREG(SOC_CPSW_WR_REGS + CPSW_WR_C_MISC_STAT(n))
274#define CPSW_WR_C_RX_IMAX_R(n) HWREG(SOC_CPSW_WR_REGS + CPSW_WR_C_RX_IMAX(n))
275#define CPSW_WR_C_TX_IMAX_R(n) HWREG(SOC_CPSW_WR_REGS + CPSW_WR_C_TX_IMAX(n))
276#define CPSW_WR_RGMII_CTL_R HWREG(SOC_CPSW_WR_REGS + CPSW_WR_RGMII_CTL)
279#define MDIO_REVID_R HWREG(SOC_CPSW_MDIO_REGS + MDIO_REVID)
280#define MDIO_CTRL_R HWREG(SOC_CPSW_MDIO_REGS + MDIO_CTRL)
281#define MDIO_ALIVE_R HWREG(SOC_CPSW_MDIO_REGS + MDIO_ALIVE)
282#define MDIO_LINK_R HWREG(SOC_CPSW_MDIO_REGS + MDIO_LINK)
283#define MDIO_LINKINTRAW_R HWREG(SOC_CPSW_MDIO_REGS + MDIO_LINKINTRAW)
284#define MDIO_LINKINTMASKED_R HWREG(SOC_CPSW_MDIO_REGS + MDIO_LINKINTMASKED)
285#define MDIO_USERINTRAW_R HWREG(SOC_CPSW_MDIO_REGS + MDIO_USERINTRAW)
286#define MDIO_USERINTMASKED_R HWREG(SOC_CPSW_MDIO_REGS + MDIO_USERINTMASKED)
287#define MDIO_USERINTMASKSET_R HWREG(SOC_CPSW_MDIO_REGS + MDIO_USERINTMASKSET)
288#define MDIO_USERINTMASKCLEAR_R HWREG(SOC_CPSW_MDIO_REGS + MDIO_USERINTMASKCLEAR)
289#define MDIO_USERACCESS_R(n) HWREG(SOC_CPSW_MDIO_REGS + MDIO_USERACCESS(n))
290#define MDIO_USERPHYSEL_R(n) HWREG(SOC_CPSW_MDIO_REGS + MDIO_USERPHYSEL(n))
293#define CONTROL_GMII_SEL_GMII2_SEL_MII 0x00000000
294#define CONTROL_GMII_SEL_GMII2_SEL_RMII 0x00000004
295#define CONTROL_GMII_SEL_GMII2_SEL_RGMII 0x00000008
296#define CONTROL_GMII_SEL_GMII1_SEL_MII 0x00000000
297#define CONTROL_GMII_SEL_GMII1_SEL_RMII 0x00000001
298#define CONTROL_GMII_SEL_GMII1_SEL_RGMII 0x00000002
301#define CPSW_CPDMA_EOI_VECTOR_RX_THRESH_PULSE 0x00000000
302#define CPSW_CPDMA_EOI_VECTOR_RX_PULSE 0x00000001
303#define CPSW_CPDMA_EOI_VECTOR_TX_PULSE 0x00000002
304#define CPSW_CPDMA_EOI_VECTOR_MISC_PULSE 0x00000003
307#define CPSW_PORT_P_TX_IN_CTL_SEL_DUAL_MAC 0x00010000
310#define CPSW_TX_WORD0_NEXT_DESC_POINTER 0xFFFFFFFF
311#define CPSW_TX_WORD1_BUFFER_POINTER 0xFFFFFFFF
312#define CPSW_TX_WORD2_BUFFER_OFFSET 0xFFFF0000
313#define CPSW_TX_WORD2_BUFFER_LENGTH 0x0000FFFF
314#define CPSW_TX_WORD3_SOP 0x80000000
315#define CPSW_TX_WORD3_EOP 0x40000000
316#define CPSW_TX_WORD3_OWNER 0x20000000
317#define CPSW_TX_WORD3_EOQ 0x10000000
318#define CPSW_TX_WORD3_TDOWN_CMPLT 0x08000000
319#define CPSW_TX_WORD3_PASS_CRC 0x04000000
320#define CPSW_TX_WORD3_TO_PORT_EN 0x00100000
321#define CPSW_TX_WORD3_TO_PORT 0x00030000
322#define CPSW_TX_WORD3_TO_PORT_1 0x00010000
323#define CPSW_TX_WORD3_TO_PORT_2 0x00020000
324#define CPSW_TX_WORD3_PACKET_LENGTH 0x000007FF
327#define CPSW_RX_WORD0_NEXT_DESC_POINTER 0xFFFFFFFF
328#define CPSW_RX_WORD1_BUFFER_POINTER 0xFFFFFFFF
329#define CPSW_RX_WORD2_BUFFER_OFFSET 0x07FF0000
330#define CPSW_RX_WORD2_BUFFER_LENGTH 0x000007FF
331#define CPSW_RX_WORD3_SOP 0x80000000
332#define CPSW_RX_WORD3_EOP 0x40000000
333#define CPSW_RX_WORD3_OWNER 0x20000000
334#define CPSW_RX_WORD3_EOQ 0x10000000
335#define CPSW_RX_WORD3_TDOWN_CMPLT 0x08000000
336#define CPSW_RX_WORD3_PASS_CRC 0x04000000
337#define CPSW_RX_WORD3_LONG 0x02000000
338#define CPSW_RX_WORD3_SHORT 0x01000000
339#define CPSW_RX_WORD3_CONTROL 0x00800000
340#define CPSW_RX_WORD3_OVERRUN 0x00400000
341#define CPSW_RX_WORD3_PKT_ERROR 0x00300000
342#define CPSW_RX_WORD3_RX_VLAN_ENCAP 0x000C0000
343#define CPSW_RX_WORD3_FROM_PORT 0x00030000
344#define CPSW_RX_WORD3_FROM_PORT_1 0x00010000
345#define CPSW_RX_WORD3_FROM_PORT_2 0x00020000
346#define CPSW_RX_WORD3_PACKET_LENGTH 0x000007FF
349#define CPSW_ALE_MAX_ENTRIES 1024
352#define CPSW_ALE_WORD1_ENTRY_TYPE_MASK (3 << 28)
353#define CPSW_ALE_WORD1_ENTRY_TYPE_FREE (0 << 28)
354#define CPSW_ALE_WORD1_ENTRY_TYPE_ADDR (1 << 28)
355#define CPSW_ALE_WORD1_ENTRY_TYPE_VLAN (2 << 28)
356#define CPSW_ALE_WORD1_ENTRY_TYPE_VLAN_ADDR (3 << 28)
357#define CPSW_ALE_WORD1_MULTICAST (1 << 8)
360#define CPSW_ALE_WORD2_DLR_UNICAST (1 << 5)
361#define CPSW_ALE_WORD2_PORT_NUMBER_MASK (3 << 2)
362#define CPSW_ALE_WORD2_PORT_NUMBER(n) ((n) << 2)
363#define CPSW_ALE_WORD2_BLOCK (1 << 1)
364#define CPSW_ALE_WORD2_SECURE (1 << 0)
365#define CPSW_ALE_WORD1_UNICAST_TYPE_MASK (3 << 30)
366#define CPSW_ALE_WORD1_UNICAST_TYPE(n) ((n) << 30)
369#define CPSW_ALE_WORD2_PORT_MASK_MASK (3 << 2)
370#define CPSW_ALE_WORD2_PORT_MASK(n) ((n) << 2)
371#define CPSW_ALE_WORD2_SUPER (1 << 1)
372#define CPSW_ALE_WORD1_MCAST_FWD_STATE_MASK (3 << 30)
373#define CPSW_ALE_WORD1_MCAST_FWD_STATE(n) ((n) << 30)
376#define CPSW_ALE_WORD1_VLAN_ID_MASK (4095 << 16)
377#define CPSW_ALE_WORD1_VLAN_ID(n) ((n) << 16)
378#define CPSW_ALE_WORD0_FORCE_UNTAG_EGRESS_MASK (7 << 24)
379#define CPSW_ALE_WORD0_FORCE_UNTAG_EGRESS(n) ((n) << 24)
380#define CPSW_ALE_WORD0_REG_MCAST_FLOOD_MASK (7 << 16)
381#define CPSW_ALE_WORD0_REG_MCAST_FLOOD(n) ((n) << 16)
382#define CPSW_ALE_WORD0_UNREG_MCAST_FLOOD_MASK (7 << 8)
383#define CPSW_ALE_WORD0_UNREG_MCAST_FLOOD(n) ((n) << 8)
384#define CPSW_ALE_WORD0_VLAN_MEMBER_LIST_MASK (7 << 0)
385#define CPSW_ALE_WORD0_VLAN_MEMBER_LIST(n) ((n) << 0)
436extern const NicDriver am335xEthPort1Driver;
437extern const NicDriver am335xEthPort2Driver;
440error_t am335xEthInitPort1(NetInterface *interface);
441error_t am335xEthInitPort2(NetInterface *interface);
442void am335xEthInitInstance(NetInterface *interface);
443void am335xEthInitGpio(NetInterface *interface);
444void am335xEthInitBufferDesc(NetInterface *interface);
446void am335xEthTick(NetInterface *interface);
448void am335xEthEnableIrq(NetInterface *interface);
449void am335xEthDisableIrq(NetInterface *interface);
450void am335xEthTxIrqHandler(
void);
451void am335xEthRxIrqHandler(
void);
452void am335xEthEventHandler(NetInterface *interface);
454error_t am335xEthSendPacketPort1(NetInterface *interface,
455 const NetBuffer *buffer,
size_t offset, NetTxAncillary *ancillary);
457error_t am335xEthSendPacketPort2(NetInterface *interface,
458 const NetBuffer *buffer,
size_t offset, NetTxAncillary *ancillary);
460error_t am335xEthUpdateMacAddrFilter(NetInterface *interface);
461error_t am335xEthUpdateMacConfig(NetInterface *interface);
463void am335xEthWritePhyReg(uint8_t opcode, uint8_t phyAddr,
464 uint8_t regAddr, uint16_t data);
466uint16_t am335xEthReadPhyReg(uint8_t opcode, uint8_t phyAddr,
469void am335xEthWriteEntry(uint_t index,
const Am335xAleEntry *entry);
472uint_t am335xEthFindFreeEntry(
void);
473uint_t am335xEthFindVlanEntry(uint_t vlanId);
474uint_t am335xEthFindVlanAddrEntry(uint_t vlanId, MacAddr *macAddr);
476error_t am335xEthAddVlanEntry(uint_t port, uint_t vlanId);
477error_t am335xEthAddVlanAddrEntry(uint_t port, uint_t vlanId, MacAddr *macAddr);
478error_t am335xEthDeleteVlanAddrEntry(uint_t port, uint_t vlanId, MacAddr *macAddr);
struct _Am335xTxBufferDesc Am335xTxBufferDesc
TX buffer descriptor.
struct _Am335xRxBufferDesc Am335xRxBufferDesc
RX buffer descriptor.
error_t
Error codes.
Definition error.h:43
Network interface controller abstraction layer.
ALE table entry.
Definition am335x_eth_driver.h:398
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89
NIC driver.
Definition nic.h:283
RX buffer descriptor.
Definition am335x_eth_driver.h:425
TX buffer descriptor.
Definition am335x_eth_driver.h:410