no-OS
adin1110.h
Go to the documentation of this file.
1 /******************************************************************************
2  * @file adin1110.h
3  * @brief Header file of the ADIN1110 driver.
4  * @author Ciprian Regus (ciprian.regus@analog.com)
5 ********************************************************************************
6  * Copyright 2023(c) Analog Devices, Inc.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * 3. Neither the name of Analog Devices, Inc. nor the names of its
19  * contributors may be used to endorse or promote products derived from this
20  * software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR
23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
25  * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
28  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *******************************************************************************/
33 
34 #ifndef _ADIN1110_H
35 #define _ADIN1110_H
36 
37 #include <stdbool.h>
38 #include "no_os_spi.h"
39 #include "no_os_gpio.h"
40 #include "no_os_util.h"
41 
42 #define ADIN1110_BUFF_LEN 1530
43 #define ADIN1110_ETH_ALEN 6
44 #define ADIN1110_ETHERTYPE_LEN 2
45 #define ADIN1110_ETH_HDR_LEN 14
46 #define ADIN1110_ADDR_FILT_LEN 16
47 
48 #define ADIN1110_FCS_LEN 4
49 #define ADIN1110_MAC_LEN 6
50 
51 #define ADIN1110_ADDR_MASK NO_OS_GENMASK(12, 0)
52 #define ADIN1110_RD_FRAME_SIZE 7
53 #define ADIN1110_WR_FRAME_SIZE 6
54 #define ADIN1110_RD_HDR_SIZE 3
55 #define ADIN1110_WR_HDR_SIZE 2
56 #define ADIN1110_PHY_ID_REG 1
57 
58 #define ADIN1110_PHY_ID 0x0283BC91
59 #define ADIN2111_PHY_ID 0x0283BCA1
60 
61 #define ADIN1110_PORTS 1
62 #define ADIN2111_PORTS 2
63 
64 #define ADIN1110_CD_MASK NO_OS_BIT(15)
65 #define ADIN1110_RW_MASK NO_OS_BIT(13)
66 
67 #define ADIN1110_SOFT_RST_REG 0x3C
68 #define ADIN1110_RESET_REG 0x03
69 #define ADIN1110_SWRESET NO_OS_BIT(0)
70 #define ADIN1110_SWRESET_KEY1 0x4F1C
71 #define ADIN1110_SWRESET_KEY2 0xC1F4
72 #define ADIN1110_SWRELEASE_KEY1 0x6F1A
73 #define ADIN1110_SWRELEASE_KEY2 0xA1F6
74 
75 #define ADIN1110_SPI_CD NO_OS_BIT(7)
76 #define ADIN1110_SPI_RW NO_OS_BIT(5)
77 
78 #define ADIN1110_CONFIG1_REG 0x04
79 #define ADIN1110_CONFIG1_SYNC NO_OS_BIT(15)
80 
81 #define ADIN1110_CONFIG2_REG 0x06
82 #define ADIN2111_P2_FWD_UNK2HOST_MASK NO_OS_BIT(12)
83 #define ADIN2111_PORT_CUT_THRU_EN NO_OS_BIT(11)
84 #define ADIN1110_CRC_APPEND NO_OS_BIT(5)
85 #define ADIN1110_FWD_UNK2HOST_MASK NO_OS_BIT(2)
86 
87 #define ADIN1110_STATUS0_REG 0x08
88 #define ADIN1110_STATUS0_TXPE_MASK NO_OS_BIT(0)
89 #define ADIN1110_RESETC_MASK NO_OS_BIT(6)
90 
91 #define ADIN1110_STATUS1_REG 0x09
92 #define ADIN1110_LINK_STATE_MASK NO_OS_BIT(0)
93 #define ADIN2111_P2_RX_RDY NO_OS_BIT(17)
94 #define ADIN1110_SPI_ERR NO_OS_BIT(10)
95 #define ADIN1110_RX_RDY NO_OS_BIT(4)
96 
97 #define ADIN1110_IMASK1_REG 0x0D
98 #define ADIN2111_RX_RDY_IRQ NO_OS_BIT(17)
99 #define ADIN1110_SPI_ERR_IRQ NO_OS_BIT(10)
100 #define ADIN1110_RX_RDY_IRQ NO_OS_BIT(4)
101 #define ADIN1110_TX_RDY_IRQ NO_OS_BIT(3)
102 
103 #define ADIN1110_MDIOACC(x) (0x20 + (x))
104 #define ADIN1110_MDIO_TRDONE NO_OS_BIT(31)
105 #define ADIN1110_MDIO_TAERR NO_OS_BIT(30)
106 #define ADIN1110_MDIO_ST NO_OS_GENMASK(29, 28)
107 #define ADIN1110_MDIO_OP NO_OS_GENMASK(27, 26)
108 #define ADIN1110_MDIO_PRTAD NO_OS_GENMASK(25, 21)
109 #define ADIN1110_MDIO_DEVAD NO_OS_GENMASK(20, 16)
110 #define ADIN1110_MDIO_DATA NO_OS_GENMASK(15, 0)
111 
112 #define ADIN1110_MMD_ACR_DEVAD_MASK NO_OS_GENMASK(4, 0)
113 #define ADIN1110_MMD_ACR_FUNCTION_MASK NO_OS_GENMASK(15, 14)
114 #define ADIN1110_MMD_ACCESS_MASK NO_OS_GENMASK(15, 0)
115 #define ADIN1110_MMD_ACCESS_CTRL_REG 0x0D
116 #define ADIN1110_MMD_ACCESS_REG 0x0E
117 
118 #define ADIN1110_MI_SFT_PD_MASK NO_OS_BIT(11)
119 #define ADIN1110_MDIO_PHY_ID(x) ((x) + 1)
120 #define ADIN1110_MI_CONTROL_REG 0x0
121 
122 #define ADIN1110_CRSM_SFT_PD_CNTRL_REG 0x8812
123 #define ADIN1110_CRSM_SFT_PD_MASK NO_OS_BIT(0)
124 
125 #define ADIN1110_TX_FSIZE_REG 0x30
126 #define ADIN1110_TX_REG 0x31
127 #define ADIN1110_TX_SPACE_REG 0x32
128 
129 #define ADIN1110_FIFO_CLR_REG 0x36
130 #define ADIN1110_FIFO_CLR_RX_MASK NO_OS_BIT(0)
131 #define ADIN1110_FIFO_CLR_TX_MASK NO_OS_BIT(1)
132 
133 #define ADIN1110_MAC_RST_STATUS_REG 0x3B
134 
135 #define ADIN2111_MAC_ADDR_APPLY2PORT2 NO_OS_BIT(31)
136 #define ADIN1110_MAC_ADDR_APPLY2PORT NO_OS_BIT(30)
137 #define ADIN2111_MAC_ADDR_TO_OTHER_PORT NO_OS_BIT(17)
138 #define ADIN1110_MAC_ADDR_TO_HOST NO_OS_BIT(16)
139 
140 #define ADIN1110_MAC_ADDR_FILT_UPR_REG(x) (0x50 + 2 * (x))
141 #define ADIN1110_MAC_ADDR_FILT_LWR_REG(x) (0x51 + 2 * (x))
142 
143 #define ADIN1110_MAC_ADDR_UPR_MASK NO_OS_GENMASK(15, 0)
144 #define ADIN1110_MAC_ADDR_LWR_MASK NO_OS_GENMASK(31, 0)
145 
146 #define ADIN1110_MAC_ADDR_MASK_UPR_REG 0x70
147 #define ADIN1110_MAC_ADDR_MASK_LWR_REG 0x71
148 
149 #define ADIN1110_RX_FRM_CNT_REG 0xA0
150 #define ADIN1110_RX_CRC_ERR_CNT_REG 0xA4
151 #define ADIN1110_RX_ALGN_ERR_CNT_REG 0xA5
152 #define ADIN1110_RX_LS_ERR_CNT_REG 0xA6
153 #define ADIN1110_RX_PHY_ERR_CNT_REG 0xA7
154 #define ADIN1110_TX_FRM_CNT_REG 0xA8
155 #define ADIN1110_TX_BCAST_CNT_REG 0xA9
156 #define ADIN1110_TX_MCAST_CNT_REG 0xAA
157 #define ADIN1110_TX_UCAST_CNT_REG 0xAB
158 #define ADIN1110_RX_BCAST_CNT_REG 0xA1
159 #define ADIN1110_RX_MCAST_CNT_REG 0xA2
160 #define ADIN1110_RX_UCAST_CNT_REG 0xA3
161 
162 #define ADIN1110_RX_DROP_FULL_CNT_REG 0xAC
163 #define ADIN1110_RX_DROP_FILT_CNT_REG 0xAD
164 
165 #define ADIN1110_RX_FSIZE_REG 0x90
166 #define ADIN1110_RX_REG 0x91
167 
168 #define ADIN2111_RX_P2_FSIZE_REG 0xC0
169 #define ADIN2111_RX_P2_REG 0xC1
170 
171 #define ADIN1110_CLEAR_STATUS0 0xFFF
172 
173 /* MDIO_OP codes */
174 #define ADIN1110_MDIO_OP_ADDR 0x0
175 #define ADIN1110_MDIO_OP_WR 0x1
176 #define ADIN1110_MDIO_OP_RD 0x3
177 
178 #define ADIN1110_WR_HEADER_LEN 2
179 #define ADIN1110_FRAME_HEADER_LEN 2
180 #define ADIN1110_RD_HEADER_LEN 3
181 #define ADIN1110_REG_LEN 4
182 #define ADIN1110_CRC_LEN 1
183 #define ADIN1110_FEC_LEN 4
184 
185 #define ADIN_MAC_MULTICAST_ADDR_SLOT 0
186 #define ADIN_MAC_BROADCAST_ADDR_SLOT 1
187 #define ADIN_MAC_P1_ADDR_SLOT 2
188 #define ADIN_MAC_P2_ADDR_SLOT 3
189 #define ADIN_MAC_FDB_ADDR_SLOT 4
190 
197 };
198 
209 };
210 
220 };
221 
226  uint32_t len;
229  uint8_t ethertype[2];
230  uint8_t *payload;
231 };
232 
233 /* Reset both the MAC and PHY. */
234 int adin1110_sw_reset(struct adin1110_desc *);
235 
236 /* Update a register's value based on a mask */
237 int adin1110_reg_update(struct adin1110_desc *, uint16_t, uint32_t, uint32_t);
238 
239 /* Write a register's value */
240 int adin1110_reg_write(struct adin1110_desc *, uint16_t, uint32_t);
241 
242 /* Read a register's value */
243 int adin1110_reg_read(struct adin1110_desc *, uint16_t, uint32_t *);
244 
245 /* Write a frame to the TX FIFO */
246 int adin1110_write_fifo(struct adin1110_desc *, uint32_t,
247  struct adin1110_eth_buff *);
248 
249 /* Read a frame from the RX FIFO */
250 int adin1110_read_fifo(struct adin1110_desc *, uint32_t,
251  struct adin1110_eth_buff *);
252 
253 /* Write a PHY register using clause 22 */
254 int adin1110_mdio_write(struct adin1110_desc *, uint32_t, uint32_t, uint16_t);
255 
256 /* Read a PHY register using clause 22 */
257 int adin1110_mdio_read(struct adin1110_desc *, uint32_t, uint32_t, uint16_t *);
258 
259 /* Write a PHY register using clause 45 */
260 int adin1110_mdio_write_c45(struct adin1110_desc *, uint32_t, uint32_t,
261  uint32_t,
262  uint16_t);
263 
264 /* Read a PHY register using clause 45 */
265 int adin1110_mdio_read_c45(struct adin1110_desc *, uint32_t, uint32_t, uint16_t,
266  uint16_t *);
267 
268 /* Get the link state for a given port */
269 int adin1110_link_state(struct adin1110_desc *, uint32_t *);
270 
271 /* Set a port in promiscuous mode. All MAC filters are dropped */
272 int adin1110_set_promisc(struct adin1110_desc *, uint32_t, bool);
273 
274 /*
275  * Set a MAC filter. The frames with destination MAC addresses matching this will be
276  * forwarded to the host.
277  */
278 int adin1110_set_mac_addr(struct adin1110_desc *desc,
279  uint8_t mac_address[ADIN1110_ETH_ALEN]);
280 
281 /* Enable/disable the forwarding (to host) of broadcast frames */
282 int adin1110_broadcast_filter(struct adin1110_desc *, bool);
283 
284 /* Reset the MAC device */
285 int adin1110_mac_reset(struct adin1110_desc *);
286 
287 /* Reset the PHY device */
288 int adin1110_phy_reset(struct adin1110_desc *);
289 
290 /* Initialize the device */
291 int adin1110_init(struct adin1110_desc **, struct adin1110_init_param *);
292 
293 /* Free a device descriptor */
294 int adin1110_remove(struct adin1110_desc *);
295 
296 #endif
ADIN1110_SPI_RW
#define ADIN1110_SPI_RW
Definition: adin1110.h:76
ADIN1110_RX_REG
#define ADIN1110_RX_REG
Definition: adin1110.h:166
ADIN1110_MDIO_PRTAD
#define ADIN1110_MDIO_PRTAD
Definition: adin1110.h:108
ADIN1110_FRAME_HEADER_LEN
#define ADIN1110_FRAME_HEADER_LEN
Definition: adin1110.h:179
no_os_put_unaligned_be16
void no_os_put_unaligned_be16(uint16_t val, uint8_t *buf)
adin1110_desc::comm_desc
struct no_os_spi_desc * comm_desc
Definition: adin1110.h:204
ADIN1110_MAC_ADDR_FILT_UPR_REG
#define ADIN1110_MAC_ADDR_FILT_UPR_REG(x)
Definition: adin1110.h:140
no_os_alloc.h
ADIN1110_ETH_HDR_LEN
#define ADIN1110_ETH_HDR_LEN
Definition: adin1110.h:45
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
ADIN2111
@ ADIN2111
Definition: adin1110.h:196
ADIN1110_TX_REG
#define ADIN1110_TX_REG
Definition: adin1110.h:126
ADIN1110_CONFIG1_SYNC
#define ADIN1110_CONFIG1_SYNC
Definition: adin1110.h:79
adin1110_broadcast_filter
int adin1110_broadcast_filter(struct adin1110_desc *, bool)
Set/clear a broadcast filter. By enabling this, broadcast frames will be forwarded to the host.
Definition: adin1110.c:470
ADIN1110_WR_HEADER_LEN
#define ADIN1110_WR_HEADER_LEN
Definition: adin1110.h:178
ADIN1110_REG_LEN
#define ADIN1110_REG_LEN
Definition: adin1110.h:181
ADIN1110_CRSM_SFT_PD_MASK
#define ADIN1110_CRSM_SFT_PD_MASK
Definition: adin1110.h:123
adin1110_eth_buff::mac_dest
uint8_t mac_dest[ADIN1110_ETH_ALEN]
Definition: adin1110.h:227
ADIN1110_TX_SPACE_REG
#define ADIN1110_TX_SPACE_REG
Definition: adin1110.h:127
ADIN1110_MAC_ADDR_TO_HOST
#define ADIN1110_MAC_ADDR_TO_HOST
Definition: adin1110.h:138
ADIN1110_SWRESET_KEY1
#define ADIN1110_SWRESET_KEY1
Definition: adin1110.h:70
ADIN1110_CRC_LEN
#define ADIN1110_CRC_LEN
Definition: adin1110.h:182
adin1110_clear_mac_addr
int adin1110_clear_mac_addr(struct adin1110_desc *desc, uint8_t mac_address[ADIN1110_ETH_ALEN])
Drop a MAC address filter.
Definition: adin1110.c:424
no_os_spi.h
Header file of SPI Interface.
ADIN1110_MDIO_PHY_ID
#define ADIN1110_MDIO_PHY_ID(x)
Definition: adin1110.h:119
adin1110_eth_buff::payload
uint8_t * payload
Definition: adin1110.h:230
adin1110_chip_id
adin1110_chip_id
The chips supported by this driver.
Definition: adin1110.h:194
ADIN1110_RD_HEADER_LEN
#define ADIN1110_RD_HEADER_LEN
Definition: adin1110.h:180
adin1110_reg_read
int adin1110_reg_read(struct adin1110_desc *desc, uint16_t addr, uint32_t *data)
Read a register's value.
Definition: adin1110.c:108
adin1110_set_mac_addr
int adin1110_set_mac_addr(struct adin1110_desc *desc, uint8_t mac_address[ADIN1110_ETH_ALEN])
Set a MAC address destination filter, frames who's DA doesn't match are dropped.
Definition: adin1110.c:376
adin1110_read_fifo
int adin1110_read_fifo(struct adin1110_desc *, uint32_t, struct adin1110_eth_buff *)
Read a frame from the RX FIFO.
Definition: adin1110.c:561
no_os_spi_msg
Definition: no_os_spi.h:100
no_os_delay.h
Header file of Delay functions.
ADIN1110_CONFIG2_REG
#define ADIN1110_CONFIG2_REG
Definition: adin1110.h:81
ADIN1110_SWRELEASE_KEY2
#define ADIN1110_SWRELEASE_KEY2
Definition: adin1110.h:73
adin1110_reg_update
int adin1110_reg_update(struct adin1110_desc *, uint16_t, uint32_t, uint32_t)
Update a register's value based on a mask.
Definition: adin1110.c:158
_adin1110_priv::phy_id
uint32_t phy_id
Definition: adin1110.c:50
adin1110_init_param
Initialization parameter for the device descriptor.
Definition: adin1110.h:214
ADIN1110_MAC_LEN
#define ADIN1110_MAC_LEN
Definition: adin1110.h:49
adin1110_mac_reset
int adin1110_mac_reset(struct adin1110_desc *)
Reset the MAC device.
Definition: adin1110.c:634
ADIN1110_FCS_LEN
#define ADIN1110_FCS_LEN
Definition: adin1110.h:48
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
ADIN1110_PHY_ID
#define ADIN1110_PHY_ID
Definition: adin1110.h:58
adin1110_init_param::mac_address
uint8_t mac_address[ADIN1110_ETH_ALEN]
Definition: adin1110.h:218
adin1110_init
int adin1110_init(struct adin1110_desc **desc, struct adin1110_init_param *param)
Initialize the device.
Definition: adin1110.c:848
ADIN1110_ADDR_MASK
#define ADIN1110_ADDR_MASK
Definition: adin1110.h:51
adin1110_desc::chip_type
enum adin1110_chip_id chip_type
Definition: adin1110.h:203
adin1110_phy_reset
int adin1110_phy_reset(struct adin1110_desc *desc)
Reset the PHY device.
Definition: adin1110.c:692
adin1110_read_fifo
int adin1110_read_fifo(struct adin1110_desc *desc, uint32_t port, struct adin1110_eth_buff *eth_buff)
Read a frame from the RX FIFO.
Definition: adin1110.c:561
adin1110_eth_buff::ethertype
uint8_t ethertype[2]
Definition: adin1110.h:229
_adin1110_priv::num_ports
uint32_t num_ports
Definition: adin1110.c:51
ADIN1110_MDIO_OP_ADDR
#define ADIN1110_MDIO_OP_ADDR
Definition: adin1110.h:174
NO_OS_DECLARE_CRC8_TABLE
NO_OS_DECLARE_CRC8_TABLE(_crc_table)
ADIN1110_MAC_ADDR_UPR_MASK
#define ADIN1110_MAC_ADDR_UPR_MASK
Definition: adin1110.h:143
ADIN2111_RX_RDY_IRQ
#define ADIN2111_RX_RDY_IRQ
Definition: adin1110.h:98
adin1110_reg_update
int adin1110_reg_update(struct adin1110_desc *desc, uint16_t addr, uint32_t mask, uint32_t data)
Update a register's value based on a mask.
Definition: adin1110.c:158
ADIN1110_STATUS1_REG
#define ADIN1110_STATUS1_REG
Definition: adin1110.h:91
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:115
no_os_spi_msg::tx_buff
uint8_t * tx_buff
Definition: no_os_spi.h:102
ADIN1110_ADDR_FILT_LEN
#define ADIN1110_ADDR_FILT_LEN
Definition: adin1110.h:46
ADIN1110_PHY_ID_REG
#define ADIN1110_PHY_ID_REG
Definition: adin1110.h:56
adin1110_write_fifo
int adin1110_write_fifo(struct adin1110_desc *, uint32_t, struct adin1110_eth_buff *)
Write a frame to the TX FIFO.
Definition: adin1110.c:489
adin1110.h
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
adin1110_set_mac_addr
int adin1110_set_mac_addr(struct adin1110_desc *desc, uint8_t mac_address[ADIN1110_ETH_ALEN])
Set a MAC address destination filter, frames who's DA doesn't match are dropped.
Definition: adin1110.c:376
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
ADIN1110
@ ADIN1110
Definition: adin1110.h:195
ADIN1110_IMASK1_REG
#define ADIN1110_IMASK1_REG
Definition: adin1110.h:97
ADIN2111_PHY_ID
#define ADIN2111_PHY_ID
Definition: adin1110.h:59
adin1110_mdio_read_c45
int adin1110_mdio_read_c45(struct adin1110_desc *, uint32_t, uint32_t, uint16_t, uint16_t *)
Read a PHY register using clause 45.
Definition: adin1110.c:320
adin1110_mdio_write_c45
int adin1110_mdio_write_c45(struct adin1110_desc *, uint32_t, uint32_t, uint32_t, uint16_t)
Write a PHY register using clause 45.
Definition: adin1110.c:262
ADIN1110_MDIO_OP_RD
#define ADIN1110_MDIO_OP_RD
Definition: adin1110.h:176
ADIN2111_RX_P2_FSIZE_REG
#define ADIN2111_RX_P2_FSIZE_REG
Definition: adin1110.h:168
ADIN1110_FEC_LEN
#define ADIN1110_FEC_LEN
Definition: adin1110.h:183
ADIN1110_SPI_ERR_IRQ
#define ADIN1110_SPI_ERR_IRQ
Definition: adin1110.h:99
no_os_crc8_populate_msb
void no_os_crc8_populate_msb(uint8_t *table, const uint8_t polynomial)
no_os_put_unaligned_be32
void no_os_put_unaligned_be32(uint32_t val, uint8_t *buf)
ADIN2111_RX_P2_REG
#define ADIN2111_RX_P2_REG
Definition: adin1110.h:169
adin1110_remove
int adin1110_remove(struct adin1110_desc *desc)
Free a device descriptor.
Definition: adin1110.c:936
adin1110_desc::data
uint8_t data[ADIN1110_BUFF_LEN]
Definition: adin1110.h:206
ADIN1110_MDIO_OP
#define ADIN1110_MDIO_OP
Definition: adin1110.h:107
ADIN1110_RW_MASK
#define ADIN1110_RW_MASK
Definition: adin1110.h:65
adin1110_phy_reset
int adin1110_phy_reset(struct adin1110_desc *)
Reset the PHY device.
Definition: adin1110.c:692
ADIN1110_MDIO_OP_WR
#define ADIN1110_MDIO_OP_WR
Definition: adin1110.h:175
ADIN1110_MDIO_DATA
#define ADIN1110_MDIO_DATA
Definition: adin1110.h:110
adin1110_sw_reset
int adin1110_sw_reset(struct adin1110_desc *desc)
Reset both the MAC and PHY.
Definition: adin1110.c:728
ADIN1110_MAC_ADDR_APPLY2PORT
#define ADIN1110_MAC_ADDR_APPLY2PORT
Definition: adin1110.h:136
adin1110_eth_buff::len
uint32_t len
Definition: adin1110.h:226
ADIN1110_SOFT_RST_REG
#define ADIN1110_SOFT_RST_REG
Definition: adin1110.h:67
ADIN1110_RX_RDY_IRQ
#define ADIN1110_RX_RDY_IRQ
Definition: adin1110.h:100
adin1110_link_state
int adin1110_link_state(struct adin1110_desc *desc, uint32_t *state)
Reset both the MAC and PHY.
Definition: adin1110.c:739
no_os_gpio_remove
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:104
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
ADIN1110_STATUS0_REG
#define ADIN1110_STATUS0_REG
Definition: adin1110.h:87
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
ADIN1110_RX_FSIZE_REG
#define ADIN1110_RX_FSIZE_REG
Definition: adin1110.h:165
ADIN1110_CRC_POLYNOMIAL
#define ADIN1110_CRC_POLYNOMIAL
Definition: adin1110.c:45
adin1110_reg_write
int adin1110_reg_write(struct adin1110_desc *, uint16_t, uint32_t)
Write a register's value.
Definition: adin1110.c:72
adin1110_desc::reset_gpio
struct no_os_gpio_desc * reset_gpio
Definition: adin1110.h:207
ADIN1110_SPI_CD
#define ADIN1110_SPI_CD
Definition: adin1110.h:75
no_os_spi_transfer
int32_t no_os_spi_transfer(struct no_os_spi_desc *desc, struct no_os_spi_msg *msgs, uint32_t len)
Iterate over head list and send all spi messages.
Definition: no_os_spi.c:185
no_os_spi_msg::bytes_number
uint32_t bytes_number
Definition: no_os_spi.h:106
adin1110_mdio_write_c45
int adin1110_mdio_write_c45(struct adin1110_desc *desc, uint32_t phy_id, uint32_t dev_id, uint32_t reg, uint16_t data)
Write a PHY register using clause 45.
Definition: adin1110.c:262
adin1110_write_fifo
int adin1110_write_fifo(struct adin1110_desc *desc, uint32_t port, struct adin1110_eth_buff *eth_buff)
Write a frame to the TX FIFO.
Definition: adin1110.c:489
adin1110_broadcast_filter
int adin1110_broadcast_filter(struct adin1110_desc *desc, bool enabled)
Set/clear a broadcast filter. By enabling this, broadcast frames will be forwarded to the host.
Definition: adin1110.c:470
adin1110_reg_read
int adin1110_reg_read(struct adin1110_desc *, uint16_t, uint32_t *)
Read a register's value.
Definition: adin1110.c:108
adin1110_mac_reset
int adin1110_mac_reset(struct adin1110_desc *desc)
Reset the MAC device.
Definition: adin1110.c:634
ADIN1110_MAC_ADDR_FILT_LWR_REG
#define ADIN1110_MAC_ADDR_FILT_LWR_REG(x)
Definition: adin1110.h:141
no_os_field_get
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
ADIN1110_WR_FRAME_SIZE
#define ADIN1110_WR_FRAME_SIZE
Definition: adin1110.h:53
ADIN2111_P2_FWD_UNK2HOST_MASK
#define ADIN2111_P2_FWD_UNK2HOST_MASK
Definition: adin1110.h:82
adin1110_eth_buff
Buffer structure used for frame RX and TX transactions.
Definition: adin1110.h:225
ADIN2111_MAC_ADDR_APPLY2PORT2
#define ADIN2111_MAC_ADDR_APPLY2PORT2
Definition: adin1110.h:135
no_os_crc8
uint8_t no_os_crc8(const uint8_t *table, const uint8_t *pdata, size_t nbytes, uint8_t crc)
_adin1110_priv
Definition: adin1110.c:49
adin1110_init_param::comm_param
struct no_os_spi_init_param comm_param
Definition: adin1110.h:216
adin1110_reg_write
int adin1110_reg_write(struct adin1110_desc *desc, uint16_t addr, uint32_t data)
Write a register's value.
Definition: adin1110.c:72
ADIN1110_MDIO_ST
#define ADIN1110_MDIO_ST
Definition: adin1110.h:106
adin1110_remove
int adin1110_remove(struct adin1110_desc *)
Free a device descriptor.
Definition: adin1110.c:936
ADIN1110_MAC_RST_STATUS_REG
#define ADIN1110_MAC_RST_STATUS_REG
Definition: adin1110.h:133
adin1110_init
int adin1110_init(struct adin1110_desc **, struct adin1110_init_param *)
Initialize the device.
Definition: adin1110.c:848
adin1110_init_param::chip_type
enum adin1110_chip_id chip_type
Definition: adin1110.h:215
ADIN1110_TX_RDY_IRQ
#define ADIN1110_TX_RDY_IRQ
Definition: adin1110.h:101
adin1110_mdio_read_c45
int adin1110_mdio_read_c45(struct adin1110_desc *desc, uint32_t phy_id, uint32_t dev_id, uint16_t reg, uint16_t *data)
Read a PHY register using clause 45.
Definition: adin1110.c:320
adin1110_set_promisc
int adin1110_set_promisc(struct adin1110_desc *, uint32_t, bool)
Set a port in promiscuous mode. All MAC filters are dropped.
Definition: adin1110.c:759
adin1110_mdio_write
int adin1110_mdio_write(struct adin1110_desc *desc, uint32_t phy_id, uint32_t reg, uint16_t data)
Write a PHY register using clause 22.
Definition: adin1110.c:222
no_os_gpio_set_value
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:197
no_os_get_unaligned_be32
uint32_t no_os_get_unaligned_be32(uint8_t *buf)
ADIN1110_BUFF_LEN
#define ADIN1110_BUFF_LEN
Definition: adin1110.h:42
adin1110_link_state
int adin1110_link_state(struct adin1110_desc *, uint32_t *)
Reset both the MAC and PHY.
Definition: adin1110.c:739
ADIN1110_CONFIG1_REG
#define ADIN1110_CONFIG1_REG
Definition: adin1110.h:78
adin1110_desc
ADIN1110 device descriptor.
Definition: adin1110.h:202
no_os_align
#define no_os_align(x, align)
Definition: no_os_util.h:121
ADIN1110_TX_FSIZE_REG
#define ADIN1110_TX_FSIZE_REG
Definition: adin1110.h:125
ADIN1110_MDIO_DEVAD
#define ADIN1110_MDIO_DEVAD
Definition: adin1110.h:109
ADIN1110_SWRESET_KEY2
#define ADIN1110_SWRESET_KEY2
Definition: adin1110.h:71
ADIN1110_MDIO_TRDONE
#define ADIN1110_MDIO_TRDONE
Definition: adin1110.h:104
adin1110_desc::mac_address
uint8_t mac_address[ADIN1110_ETH_ALEN]
Definition: adin1110.h:205
ADIN1110_SWRELEASE_KEY1
#define ADIN1110_SWRELEASE_KEY1
Definition: adin1110.h:72
ADIN1110_CRSM_SFT_PD_CNTRL_REG
#define ADIN1110_CRSM_SFT_PD_CNTRL_REG
Definition: adin1110.h:122
no_os_spi_remove
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:116
adin1110_mdio_read
int adin1110_mdio_read(struct adin1110_desc *, uint32_t, uint32_t, uint16_t *)
Read a PHY register using clause 22.
Definition: adin1110.c:182
no_os_gpio.h
Header file of GPIO Interface.
ADIN1110_LINK_STATE_MASK
#define ADIN1110_LINK_STATE_MASK
Definition: adin1110.h:92
adin1110_set_promisc
int adin1110_set_promisc(struct adin1110_desc *desc, uint32_t port, bool promisc)
Set a port in promiscuous mode. All MAC filters are dropped.
Definition: adin1110.c:759
adin1110_sw_reset
int adin1110_sw_reset(struct adin1110_desc *)
Reset both the MAC and PHY.
Definition: adin1110.c:728
ADIN1110_CRC_APPEND
#define ADIN1110_CRC_APPEND
Definition: adin1110.h:84
no_os_spi_init
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:52
adin1110_eth_buff::mac_source
uint8_t mac_source[ADIN1110_ETH_ALEN]
Definition: adin1110.h:228
no_os_get_unaligned_be16
uint16_t no_os_get_unaligned_be16(uint8_t *buf)
ADIN1110_CD_MASK
#define ADIN1110_CD_MASK
Definition: adin1110.h:64
adin1110_mdio_write
int adin1110_mdio_write(struct adin1110_desc *, uint32_t, uint32_t, uint16_t)
Write a PHY register using clause 22.
Definition: adin1110.c:222
adin1110_init_param::reset_param
struct no_os_gpio_init_param reset_param
Definition: adin1110.h:217
no_os_util.h
Header file of utility functions.
ADIN1110_WR_HDR_SIZE
#define ADIN1110_WR_HDR_SIZE
Definition: adin1110.h:55
ADIN1110_FWD_UNK2HOST_MASK
#define ADIN1110_FWD_UNK2HOST_MASK
Definition: adin1110.h:85
ADIN1110_RESET_REG
#define ADIN1110_RESET_REG
Definition: adin1110.h:68
adin1110_init_param::append_crc
bool append_crc
Definition: adin1110.h:219
ADIN1110_RESETC_MASK
#define ADIN1110_RESETC_MASK
Definition: adin1110.h:89
ADIN1110_ETH_ALEN
#define ADIN1110_ETH_ALEN
Definition: adin1110.h:43
ADIN1110_MDIOACC
#define ADIN1110_MDIOACC(x)
Definition: adin1110.h:103
no_os_gpio_direction_output
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:147
dev_id
dev_id
Definition: ad9361.h:3328
no_os_crc8.h
Header file of CRC-8 computation.
adin1110_desc::append_crc
bool append_crc
Definition: adin1110.h:208
errno.h
Error macro definition for ARM Compiler.
adin1110_mdio_read
int adin1110_mdio_read(struct adin1110_desc *desc, uint32_t phy_id, uint32_t reg, uint16_t *data)
Read a PHY register using clause 22.
Definition: adin1110.c:182
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
no_os_gpio_get_optional
int32_t no_os_gpio_get_optional(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Get the value of an optional GPIO.
Definition: no_os_gpio.c:75