31#ifndef _AM64X_ETH_DRIVER_H
32#define _AM64X_ETH_DRIVER_H
53#define CPSW_ALE_MAX_ENTRIES 512
56#define CPSW_ALE_WORD1_ENTRY_TYPE_MASK (3 << 28)
57#define CPSW_ALE_WORD1_ENTRY_TYPE_FREE (0 << 28)
58#define CPSW_ALE_WORD1_ENTRY_TYPE_ADDR (1 << 28)
59#define CPSW_ALE_WORD1_ENTRY_TYPE_VLAN (2 << 28)
60#define CPSW_ALE_WORD1_ENTRY_TYPE_VLAN_ADDR (3 << 28)
61#define CPSW_ALE_WORD1_MULTICAST (1 << 8)
64#define CPSW_ALE_WORD2_TRUNK (1 << 4)
65#define CPSW_ALE_WORD2_PORT_NUMBER_MASK (3 << 2)
66#define CPSW_ALE_WORD2_PORT_NUMBER(n) ((n) << 2)
67#define CPSW_ALE_WORD2_BLOCK (1 << 1)
68#define CPSW_ALE_WORD2_SECURE (1 << 0)
69#define CPSW_ALE_WORD1_UNICAST_TYPE_MASK (3 << 30)
70#define CPSW_ALE_WORD1_UNICAST_TYPE(n) ((n) << 30)
73#define CPSW_ALE_WORD2_PORT_MASK_MASK (3 << 2)
74#define CPSW_ALE_WORD2_PORT_MASK(n) ((n) << 2)
75#define CPSW_ALE_WORD2_SUPER (1 << 1)
76#define CPSW_ALE_WORD1_MCAST_FWD_STATE_MASK (3 << 30)
77#define CPSW_ALE_WORD1_MCAST_FWD_STATE(n) ((n) << 30)
80#define CPSW_ALE_WORD2_NO_LEARN_MASK_MASK (7 << 2)
81#define CPSW_ALE_WORD2_NO_LEARN_MASK(n) ((n) << 2)
82#define CPSW_ALE_WORD2_VLAN_FORCE_INGRESS_CHECK (7 << 1)
83#define CPSW_ALE_WORD1_VLAN_ID_MASK (4095 << 16)
84#define CPSW_ALE_WORD1_VLAN_ID(n) ((n) << 16)
85#define CPSW_ALE_WORD1_NOFRAG (1 << 15)
86#define CPSW_ALE_WORD1_REG_MCAST_FLOOD_INDEX_MASK (7 << 4)
87#define CPSW_ALE_WORD1_REG_MCAST_FLOOD_INDEX(n) ((n) << 4)
88#define CPSW_ALE_WORD0_FORCE_UNTAG_EGRESS_MASK (7 << 24)
89#define CPSW_ALE_WORD0_FORCE_UNTAG_EGRESS(n) ((n) << 24)
90#define CPSW_ALE_WORD0_LMTNXTHDR (1 << 23)
91#define CPSW_ALE_WORD0_UREGMSK_MASK (7 << 12)
92#define CPSW_ALE_WORD0_UREGMSK(n) ((n) << 12)
93#define CPSW_ALE_WORD0_VLAN_MEMBER_LIST_MASK (7 << 0)
94#define CPSW_ALE_WORD0_VLAN_MEMBER_LIST(n) ((n) << 0)
149extern const NicDriver am64xEthPort1Driver;
150extern const NicDriver am64xEthPort2Driver;
153error_t am64xEthInitPort1(NetInterface *interface);
154error_t am64xEthInitPort2(NetInterface *interface);
155void am64xEthInitInstance(NetInterface *interface);
156void am64xEthInitGpio(NetInterface *interface);
158void am64xEthTick(NetInterface *interface);
160void am64xEthEnableIrq(NetInterface *interface);
161void am64xEthDisableIrq(NetInterface *interface);
162void am64xEthRxIrqHandler(
void *arg);
163void am64xEthEventHandler(NetInterface *interface);
165error_t am64xEthSendPacket(NetInterface *interface,
166 const NetBuffer *buffer,
size_t offset, NetTxAncillary *ancillary);
168error_t am64xEthUpdateMacAddrFilter(NetInterface *interface);
169error_t am64xEthUpdateMacConfig(NetInterface *interface);
171void am64xEthWritePhyReg(uint8_t opcode, uint8_t phyAddr,
172 uint8_t regAddr, uint16_t data);
174uint16_t am64xEthReadPhyReg(uint8_t opcode, uint8_t phyAddr,
177void am64xEthWriteEntry(uint_t index,
const Am64xAleEntry *entry);
180uint_t am64xEthFindFreeEntry(
void);
181uint_t am64xEthFindVlanEntry(uint_t vlanId);
182uint_t am64xEthFindVlanAddrEntry(uint_t vlanId, MacAddr *macAddr);
184error_t am64xEthAddVlanEntry(uint_t port, uint_t vlanId);
185error_t am64xEthAddVlanAddrEntry(uint_t port, uint_t vlanId, MacAddr *macAddr);
186error_t am64xEthDeleteVlanAddrEntry(uint_t port, uint_t vlanId, MacAddr *macAddr);
error_t
Error codes.
Definition error.h:43
Network interface controller abstraction layer.
ALE table entry.
Definition am64x_eth_driver.h:107
Enhanced RX DMA descriptor.
Definition am64x_eth_driver.h:136
Enhanced TX DMA descriptor.
Definition am64x_eth_driver.h:119
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89
NIC driver.
Definition nic.h:283