Commit 120b5ef2876c3a3aa2addaba0179791ddcbe8b58

Authored by Alex Marginean
Committed by Joe Hershberger
1 parent ff6c6b2d6d

drivers: net: add NXP ENETC ethernet driver

Adds a driver for NXP ENETC ethernet controller currently integrated in
LS1028A.  ENETC is a fairly straight-forward BD ring device and interfaces
are presented as PCI EPs on the SoC ECAM.

Signed-off-by: Catalin Horghidan <catalin.horghidan@nxp.com>
Signed-off-by: Alex Marginean <alexm.osslist@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

Showing 4 changed files with 556 additions and 0 deletions Inline Diff

1 source "drivers/net/phy/Kconfig" 1 source "drivers/net/phy/Kconfig"
2 source "drivers/net/pfe_eth/Kconfig" 2 source "drivers/net/pfe_eth/Kconfig"
3 3
4 config DM_ETH 4 config DM_ETH
5 bool "Enable Driver Model for Ethernet drivers" 5 bool "Enable Driver Model for Ethernet drivers"
6 depends on DM 6 depends on DM
7 help 7 help
8 Enable driver model for Ethernet. 8 Enable driver model for Ethernet.
9 9
10 The eth_*() interface will be implemented by the UCLASS_ETH class 10 The eth_*() interface will be implemented by the UCLASS_ETH class
11 This is currently implemented in net/eth-uclass.c 11 This is currently implemented in net/eth-uclass.c
12 Look in include/net.h for details. 12 Look in include/net.h for details.
13 13
14 config DM_MDIO 14 config DM_MDIO
15 bool "Enable Driver Model for MDIO devices" 15 bool "Enable Driver Model for MDIO devices"
16 depends on DM_ETH && PHYLIB 16 depends on DM_ETH && PHYLIB
17 help 17 help
18 Enable driver model for MDIO devices 18 Enable driver model for MDIO devices
19 19
20 Adds UCLASS_MDIO DM class supporting MDIO buses that are probed as 20 Adds UCLASS_MDIO DM class supporting MDIO buses that are probed as
21 stand-alone devices. Useful in particular for systems that support 21 stand-alone devices. Useful in particular for systems that support
22 DM_ETH and have a stand-alone MDIO hardware block shared by multiple 22 DM_ETH and have a stand-alone MDIO hardware block shared by multiple
23 Ethernet interfaces. 23 Ethernet interfaces.
24 This is currently implemented in net/mdio-uclass.c 24 This is currently implemented in net/mdio-uclass.c
25 Look in include/miiphy.h for details. 25 Look in include/miiphy.h for details.
26 26
27 config DM_MDIO_MUX 27 config DM_MDIO_MUX
28 bool "Enable Driver Model for MDIO MUX devices" 28 bool "Enable Driver Model for MDIO MUX devices"
29 depends on DM_MDIO 29 depends on DM_MDIO
30 help 30 help
31 Enable driver model for MDIO MUX devices 31 Enable driver model for MDIO MUX devices
32 32
33 Adds UCLASS_MDIO_MUX DM class supporting MDIO MUXes. Useful for 33 Adds UCLASS_MDIO_MUX DM class supporting MDIO MUXes. Useful for
34 systems that support DM_MDIO and integrate one or multiple muxes on 34 systems that support DM_MDIO and integrate one or multiple muxes on
35 the MDIO bus. 35 the MDIO bus.
36 This is currently implemented in net/mdio-mux-uclass.c 36 This is currently implemented in net/mdio-mux-uclass.c
37 Look in include/miiphy.h for details. 37 Look in include/miiphy.h for details.
38 38
39 config MDIO_SANDBOX 39 config MDIO_SANDBOX
40 depends on DM_MDIO && SANDBOX 40 depends on DM_MDIO && SANDBOX
41 default y 41 default y
42 bool "Sandbox: Mocked MDIO driver" 42 bool "Sandbox: Mocked MDIO driver"
43 help 43 help
44 This driver implements dummy read/write/reset MDIO functions mimicking 44 This driver implements dummy read/write/reset MDIO functions mimicking
45 a bus with a single PHY. 45 a bus with a single PHY.
46 46
47 This driver is used in for testing in test/dm/mdio.c 47 This driver is used in for testing in test/dm/mdio.c
48 48
49 config MDIO_MUX_SANDBOX 49 config MDIO_MUX_SANDBOX
50 depends on DM_MDIO_MUX && MDIO_SANDBOX 50 depends on DM_MDIO_MUX && MDIO_SANDBOX
51 default y 51 default y
52 bool "Sandbox: Mocked MDIO-MUX driver" 52 bool "Sandbox: Mocked MDIO-MUX driver"
53 help 53 help
54 This driver implements dummy select/deselect ops mimicking a MUX on 54 This driver implements dummy select/deselect ops mimicking a MUX on
55 the MDIO bux. It uses mdio_sandbox driver as parent MDIO. 55 the MDIO bux. It uses mdio_sandbox driver as parent MDIO.
56 56
57 This driver is used for testing in test/dm/mdio.c 57 This driver is used for testing in test/dm/mdio.c
58 58
59 menuconfig NETDEVICES 59 menuconfig NETDEVICES
60 bool "Network device support" 60 bool "Network device support"
61 depends on NET 61 depends on NET
62 default y if DM_ETH 62 default y if DM_ETH
63 help 63 help
64 You must select Y to enable any network device support 64 You must select Y to enable any network device support
65 Generally if you have any networking support this is a given 65 Generally if you have any networking support this is a given
66 66
67 If unsure, say Y 67 If unsure, say Y
68 68
69 if NETDEVICES 69 if NETDEVICES
70 70
71 config PHY_GIGE 71 config PHY_GIGE
72 bool "Enable GbE PHY status parsing and configuration" 72 bool "Enable GbE PHY status parsing and configuration"
73 help 73 help
74 Enables support for parsing the status output and for 74 Enables support for parsing the status output and for
75 configuring GbE PHYs (affects the inner workings of some 75 configuring GbE PHYs (affects the inner workings of some
76 commands and miiphyutil.c). 76 commands and miiphyutil.c).
77 77
78 config AG7XXX 78 config AG7XXX
79 bool "Atheros AG7xxx Ethernet MAC support" 79 bool "Atheros AG7xxx Ethernet MAC support"
80 depends on DM_ETH && ARCH_ATH79 80 depends on DM_ETH && ARCH_ATH79
81 select PHYLIB 81 select PHYLIB
82 help 82 help
83 This driver supports the Atheros AG7xxx Ethernet MAC. This MAC is 83 This driver supports the Atheros AG7xxx Ethernet MAC. This MAC is
84 present in the Atheros AR7xxx, AR9xxx and QCA9xxx MIPS chips. 84 present in the Atheros AR7xxx, AR9xxx and QCA9xxx MIPS chips.
85 85
86 86
87 config ALTERA_TSE 87 config ALTERA_TSE
88 bool "Altera Triple-Speed Ethernet MAC support" 88 bool "Altera Triple-Speed Ethernet MAC support"
89 depends on DM_ETH 89 depends on DM_ETH
90 select PHYLIB 90 select PHYLIB
91 help 91 help
92 This driver supports the Altera Triple-Speed (TSE) Ethernet MAC. 92 This driver supports the Altera Triple-Speed (TSE) Ethernet MAC.
93 Please find details on the "Triple-Speed Ethernet MegaCore Function 93 Please find details on the "Triple-Speed Ethernet MegaCore Function
94 Resource Center" of Altera. 94 Resource Center" of Altera.
95 95
96 config BCM_SF2_ETH 96 config BCM_SF2_ETH
97 bool "Broadcom SF2 (Starfighter2) Ethernet support" 97 bool "Broadcom SF2 (Starfighter2) Ethernet support"
98 select PHYLIB 98 select PHYLIB
99 help 99 help
100 This is an abstract framework which provides a generic interface 100 This is an abstract framework which provides a generic interface
101 to MAC and DMA management for multiple Broadcom SoCs such as 101 to MAC and DMA management for multiple Broadcom SoCs such as
102 Cygnus, NSP and bcm28155_ap platforms. 102 Cygnus, NSP and bcm28155_ap platforms.
103 103
104 config BCM_SF2_ETH_DEFAULT_PORT 104 config BCM_SF2_ETH_DEFAULT_PORT
105 int "Broadcom SF2 (Starfighter2) Ethernet default port number" 105 int "Broadcom SF2 (Starfighter2) Ethernet default port number"
106 depends on BCM_SF2_ETH 106 depends on BCM_SF2_ETH
107 default 0 107 default 0
108 help 108 help
109 Default port number for the Starfighter2 ethernet driver. 109 Default port number for the Starfighter2 ethernet driver.
110 110
111 config BCM_SF2_ETH_GMAC 111 config BCM_SF2_ETH_GMAC
112 bool "Broadcom SF2 (Starfighter2) GMAC Ethernet support" 112 bool "Broadcom SF2 (Starfighter2) GMAC Ethernet support"
113 depends on BCM_SF2_ETH 113 depends on BCM_SF2_ETH
114 help 114 help
115 This flag enables the ethernet support for Broadcom platforms with 115 This flag enables the ethernet support for Broadcom platforms with
116 GMAC such as Cygnus. This driver is based on the framework provided 116 GMAC such as Cygnus. This driver is based on the framework provided
117 by the BCM_SF2_ETH driver. 117 by the BCM_SF2_ETH driver.
118 Say Y to any bcmcygnus based platforms. 118 Say Y to any bcmcygnus based platforms.
119 119
120 config BCM6348_ETH 120 config BCM6348_ETH
121 bool "BCM6348 EMAC support" 121 bool "BCM6348 EMAC support"
122 depends on DM_ETH && ARCH_BMIPS 122 depends on DM_ETH && ARCH_BMIPS
123 select DMA 123 select DMA
124 select DMA_CHANNELS 124 select DMA_CHANNELS
125 select MII 125 select MII
126 select PHYLIB 126 select PHYLIB
127 help 127 help
128 This driver supports the BCM6348 Ethernet MAC. 128 This driver supports the BCM6348 Ethernet MAC.
129 129
130 config BCM6368_ETH 130 config BCM6368_ETH
131 bool "BCM6368 EMAC support" 131 bool "BCM6368 EMAC support"
132 depends on DM_ETH && ARCH_BMIPS 132 depends on DM_ETH && ARCH_BMIPS
133 select DMA 133 select DMA
134 select MII 134 select MII
135 help 135 help
136 This driver supports the BCM6368 Ethernet MAC. 136 This driver supports the BCM6368 Ethernet MAC.
137 137
138 config DWC_ETH_QOS 138 config DWC_ETH_QOS
139 bool "Synopsys DWC Ethernet QOS device support" 139 bool "Synopsys DWC Ethernet QOS device support"
140 depends on DM_ETH 140 depends on DM_ETH
141 select PHYLIB 141 select PHYLIB
142 help 142 help
143 This driver supports the Synopsys Designware Ethernet QOS (Quality 143 This driver supports the Synopsys Designware Ethernet QOS (Quality
144 Of Service) IP block. The IP supports many options for bus type, 144 Of Service) IP block. The IP supports many options for bus type,
145 clocking/reset structure, and feature list. This driver currently 145 clocking/reset structure, and feature list. This driver currently
146 supports the specific configuration used in NVIDIA's Tegra186 chip, 146 supports the specific configuration used in NVIDIA's Tegra186 chip,
147 but should be extensible to other combinations quite easily. 147 but should be extensible to other combinations quite easily.
148 148
149 config E1000 149 config E1000
150 bool "Intel PRO/1000 Gigabit Ethernet support" 150 bool "Intel PRO/1000 Gigabit Ethernet support"
151 help 151 help
152 This driver supports Intel(R) PRO/1000 gigabit ethernet family of 152 This driver supports Intel(R) PRO/1000 gigabit ethernet family of
153 adapters. For more information on how to identify your adapter, go 153 adapters. For more information on how to identify your adapter, go
154 to the Adapter & Driver ID Guide at: 154 to the Adapter & Driver ID Guide at:
155 155
156 <http://support.intel.com/support/network/adapter/pro100/21397.htm> 156 <http://support.intel.com/support/network/adapter/pro100/21397.htm>
157 157
158 config E1000_SPI_GENERIC 158 config E1000_SPI_GENERIC
159 bool "Allow access to the Intel 8257x SPI bus" 159 bool "Allow access to the Intel 8257x SPI bus"
160 depends on E1000 160 depends on E1000
161 help 161 help
162 Allow generic access to the SPI bus on the Intel 8257x, for 162 Allow generic access to the SPI bus on the Intel 8257x, for
163 example with the "sspi" command. 163 example with the "sspi" command.
164 164
165 config E1000_SPI 165 config E1000_SPI
166 bool "Enable SPI bus utility code" 166 bool "Enable SPI bus utility code"
167 depends on E1000 167 depends on E1000
168 help 168 help
169 Utility code for direct access to the SPI bus on Intel 8257x. 169 Utility code for direct access to the SPI bus on Intel 8257x.
170 This does not do anything useful unless you set at least one 170 This does not do anything useful unless you set at least one
171 of CONFIG_CMD_E1000 or CONFIG_E1000_SPI_GENERIC. 171 of CONFIG_CMD_E1000 or CONFIG_E1000_SPI_GENERIC.
172 172
173 config CMD_E1000 173 config CMD_E1000
174 bool "Enable the e1000 command" 174 bool "Enable the e1000 command"
175 depends on E1000 175 depends on E1000
176 help 176 help
177 This enables the 'e1000' management command for E1000 devices. When 177 This enables the 'e1000' management command for E1000 devices. When
178 used on devices with SPI support you can reprogram the EEPROM from 178 used on devices with SPI support you can reprogram the EEPROM from
179 U-Boot. 179 U-Boot.
180 180
181 config ETH_SANDBOX 181 config ETH_SANDBOX
182 depends on DM_ETH && SANDBOX 182 depends on DM_ETH && SANDBOX
183 default y 183 default y
184 bool "Sandbox: Mocked Ethernet driver" 184 bool "Sandbox: Mocked Ethernet driver"
185 help 185 help
186 This driver simply responds with fake ARP replies and ping 186 This driver simply responds with fake ARP replies and ping
187 replies that are used to verify network stack functionality 187 replies that are used to verify network stack functionality
188 188
189 This driver is particularly useful in the test/dm/eth.c tests 189 This driver is particularly useful in the test/dm/eth.c tests
190 190
191 config ETH_SANDBOX_RAW 191 config ETH_SANDBOX_RAW
192 depends on DM_ETH && SANDBOX 192 depends on DM_ETH && SANDBOX
193 default y 193 default y
194 bool "Sandbox: Bridge to Linux Raw Sockets" 194 bool "Sandbox: Bridge to Linux Raw Sockets"
195 help 195 help
196 This driver is a bridge from the bottom of the network stack 196 This driver is a bridge from the bottom of the network stack
197 in U-Boot to the RAW AF_PACKET API in Linux. This allows real 197 in U-Boot to the RAW AF_PACKET API in Linux. This allows real
198 network traffic to be tested from within sandbox. See 198 network traffic to be tested from within sandbox. See
199 board/sandbox/README.sandbox for more details. 199 board/sandbox/README.sandbox for more details.
200 200
201 config ETH_DESIGNWARE 201 config ETH_DESIGNWARE
202 bool "Synopsys Designware Ethernet MAC" 202 bool "Synopsys Designware Ethernet MAC"
203 select PHYLIB 203 select PHYLIB
204 imply ETH_DESIGNWARE_SOCFPGA if ARCH_SOCFPGA 204 imply ETH_DESIGNWARE_SOCFPGA if ARCH_SOCFPGA
205 help 205 help
206 This MAC is present in SoCs from various vendors. It supports 206 This MAC is present in SoCs from various vendors. It supports
207 100Mbit and 1 Gbit operation. You must enable CONFIG_PHYLIB to 207 100Mbit and 1 Gbit operation. You must enable CONFIG_PHYLIB to
208 provide the PHY (physical media interface). 208 provide the PHY (physical media interface).
209 209
210 config ETH_DESIGNWARE_SOCFPGA 210 config ETH_DESIGNWARE_SOCFPGA
211 select REGMAP 211 select REGMAP
212 select SYSCON 212 select SYSCON
213 bool "Altera SoCFPGA extras for Synopsys Designware Ethernet MAC" 213 bool "Altera SoCFPGA extras for Synopsys Designware Ethernet MAC"
214 depends on DM_ETH && ETH_DESIGNWARE 214 depends on DM_ETH && ETH_DESIGNWARE
215 help 215 help
216 The Altera SoCFPGA requires additional configuration of the 216 The Altera SoCFPGA requires additional configuration of the
217 Altera system manager to correctly interface with the PHY. 217 Altera system manager to correctly interface with the PHY.
218 This code handles those SoC specifics. 218 This code handles those SoC specifics.
219 219
220 config ETHOC 220 config ETHOC
221 bool "OpenCores 10/100 Mbps Ethernet MAC" 221 bool "OpenCores 10/100 Mbps Ethernet MAC"
222 help 222 help
223 This MAC is present in OpenRISC and Xtensa XTFPGA boards. 223 This MAC is present in OpenRISC and Xtensa XTFPGA boards.
224 224
225 config FEC_MXC_SHARE_MDIO 225 config FEC_MXC_SHARE_MDIO
226 bool "Share the MDIO bus for FEC controller" 226 bool "Share the MDIO bus for FEC controller"
227 depends on FEC_MXC 227 depends on FEC_MXC
228 228
229 config FEC_MXC_MDIO_BASE 229 config FEC_MXC_MDIO_BASE
230 hex "MDIO base address for the FEC controller" 230 hex "MDIO base address for the FEC controller"
231 depends on FEC_MXC_SHARE_MDIO 231 depends on FEC_MXC_SHARE_MDIO
232 help 232 help
233 This specifies the MDIO registers base address. It is used when 233 This specifies the MDIO registers base address. It is used when
234 two FEC controllers share MDIO bus. 234 two FEC controllers share MDIO bus.
235 235
236 config FEC_MXC 236 config FEC_MXC
237 bool "FEC Ethernet controller" 237 bool "FEC Ethernet controller"
238 depends on MX5 || MX6 || MX7 || IMX8 || VF610 238 depends on MX5 || MX6 || MX7 || IMX8 || VF610
239 help 239 help
240 This driver supports the 10/100 Fast Ethernet controller for 240 This driver supports the 10/100 Fast Ethernet controller for
241 NXP i.MX processors. 241 NXP i.MX processors.
242 242
243 config FMAN_ENET 243 config FMAN_ENET
244 bool "Freescale FMan ethernet support" 244 bool "Freescale FMan ethernet support"
245 depends on ARM || PPC 245 depends on ARM || PPC
246 help 246 help
247 This driver support the Freescale FMan Ethernet controller 247 This driver support the Freescale FMan Ethernet controller
248 248
249 config FTMAC100 249 config FTMAC100
250 bool "Ftmac100 Ethernet Support" 250 bool "Ftmac100 Ethernet Support"
251 help 251 help
252 This MAC is present in Andestech SoCs. 252 This MAC is present in Andestech SoCs.
253 253
254 config FTGMAC100 254 config FTGMAC100
255 bool "Ftgmac100 Ethernet Support" 255 bool "Ftgmac100 Ethernet Support"
256 depends on DM_ETH 256 depends on DM_ETH
257 select PHYLIB 257 select PHYLIB
258 help 258 help
259 This driver supports the Faraday's FTGMAC100 Gigabit SoC 259 This driver supports the Faraday's FTGMAC100 Gigabit SoC
260 Ethernet controller that can be found on Aspeed SoCs (which 260 Ethernet controller that can be found on Aspeed SoCs (which
261 include NCSI). 261 include NCSI).
262 262
263 It is fully compliant with IEEE 802.3 specification for 263 It is fully compliant with IEEE 802.3 specification for
264 10/100 Mbps Ethernet and IEEE 802.3z specification for 1000 264 10/100 Mbps Ethernet and IEEE 802.3z specification for 1000
265 Mbps Ethernet and includes Reduced Media Independent 265 Mbps Ethernet and includes Reduced Media Independent
266 Interface (RMII) and Reduced Gigabit Media Independent 266 Interface (RMII) and Reduced Gigabit Media Independent
267 Interface (RGMII) interfaces. It adopts an AHB bus interface 267 Interface (RGMII) interfaces. It adopts an AHB bus interface
268 and integrates a link list DMA engine with direct M-Bus 268 and integrates a link list DMA engine with direct M-Bus
269 accesses for transmitting and receiving packets. It has 269 accesses for transmitting and receiving packets. It has
270 independent TX/RX fifos, supports half and full duplex (1000 270 independent TX/RX fifos, supports half and full duplex (1000
271 Mbps mode only supports full duplex), flow control for full 271 Mbps mode only supports full duplex), flow control for full
272 duplex and backpressure for half duplex. 272 duplex and backpressure for half duplex.
273 273
274 The FTGMAC100 also implements IP, TCP, UDP checksum offloads 274 The FTGMAC100 also implements IP, TCP, UDP checksum offloads
275 and supports IEEE 802.1Q VLAN tag insertion and removal. It 275 and supports IEEE 802.1Q VLAN tag insertion and removal. It
276 offers high-priority transmit queue for QoS and CoS 276 offers high-priority transmit queue for QoS and CoS
277 applications. 277 applications.
278 278
279 279
280 config MVGBE 280 config MVGBE
281 bool "Marvell Orion5x/Kirkwood network interface support" 281 bool "Marvell Orion5x/Kirkwood network interface support"
282 depends on KIRKWOOD || ORION5X 282 depends on KIRKWOOD || ORION5X
283 select PHYLIB if DM_ETH 283 select PHYLIB if DM_ETH
284 help 284 help
285 This driver supports the network interface units in the 285 This driver supports the network interface units in the
286 Marvell Orion5x and Kirkwood SoCs 286 Marvell Orion5x and Kirkwood SoCs
287 287
288 config MVNETA 288 config MVNETA
289 bool "Marvell Armada XP/385/3700 network interface support" 289 bool "Marvell Armada XP/385/3700 network interface support"
290 depends on ARMADA_XP || ARMADA_38X || ARMADA_3700 290 depends on ARMADA_XP || ARMADA_38X || ARMADA_3700
291 select PHYLIB 291 select PHYLIB
292 help 292 help
293 This driver supports the network interface units in the 293 This driver supports the network interface units in the
294 Marvell ARMADA XP, ARMADA 38X and ARMADA 3700 SoCs 294 Marvell ARMADA XP, ARMADA 38X and ARMADA 3700 SoCs
295 295
296 config MVPP2 296 config MVPP2
297 bool "Marvell Armada 375/7K/8K network interface support" 297 bool "Marvell Armada 375/7K/8K network interface support"
298 depends on ARMADA_375 || ARMADA_8K 298 depends on ARMADA_375 || ARMADA_8K
299 select PHYLIB 299 select PHYLIB
300 help 300 help
301 This driver supports the network interface units in the 301 This driver supports the network interface units in the
302 Marvell ARMADA 375, 7K and 8K SoCs. 302 Marvell ARMADA 375, 7K and 8K SoCs.
303 303
304 config MACB 304 config MACB
305 bool "Cadence MACB/GEM Ethernet Interface" 305 bool "Cadence MACB/GEM Ethernet Interface"
306 depends on DM_ETH 306 depends on DM_ETH
307 select PHYLIB 307 select PHYLIB
308 help 308 help
309 The Cadence MACB ethernet interface is found on many Atmel 309 The Cadence MACB ethernet interface is found on many Atmel
310 AT91 and SAMA5 parts. This driver also supports the Cadence 310 AT91 and SAMA5 parts. This driver also supports the Cadence
311 GEM (Gigabit Ethernet MAC) found in some ARM SoC devices. 311 GEM (Gigabit Ethernet MAC) found in some ARM SoC devices.
312 Say Y to include support for the MACB/GEM chip. 312 Say Y to include support for the MACB/GEM chip.
313 313
314 config MACB_ZYNQ 314 config MACB_ZYNQ
315 bool "Cadence MACB/GEM Ethernet Interface for Xilinx Zynq" 315 bool "Cadence MACB/GEM Ethernet Interface for Xilinx Zynq"
316 depends on MACB 316 depends on MACB
317 help 317 help
318 The Cadence MACB ethernet interface was used on Zynq platform. 318 The Cadence MACB ethernet interface was used on Zynq platform.
319 Say Y to enable support for the MACB/GEM in Zynq chip. 319 Say Y to enable support for the MACB/GEM in Zynq chip.
320 320
321 config MT7628_ETH 321 config MT7628_ETH
322 bool "MediaTek MT7628 Ethernet Interface" 322 bool "MediaTek MT7628 Ethernet Interface"
323 depends on SOC_MT7628 323 depends on SOC_MT7628
324 help 324 help
325 The MediaTek MT7628 ethernet interface is used on MT7628 and 325 The MediaTek MT7628 ethernet interface is used on MT7628 and
326 MT7688 based boards. 326 MT7688 based boards.
327 327
328 config PCH_GBE 328 config PCH_GBE
329 bool "Intel Platform Controller Hub EG20T GMAC driver" 329 bool "Intel Platform Controller Hub EG20T GMAC driver"
330 depends on DM_ETH && DM_PCI 330 depends on DM_ETH && DM_PCI
331 select PHYLIB 331 select PHYLIB
332 help 332 help
333 This MAC is present in Intel Platform Controller Hub EG20T. It 333 This MAC is present in Intel Platform Controller Hub EG20T. It
334 supports 10/100/1000 Mbps operation. 334 supports 10/100/1000 Mbps operation.
335 335
336 config RGMII 336 config RGMII
337 bool "Enable RGMII" 337 bool "Enable RGMII"
338 help 338 help
339 Enable the support of the Reduced Gigabit Media-Independent 339 Enable the support of the Reduced Gigabit Media-Independent
340 Interface (RGMII). 340 Interface (RGMII).
341 341
342 config MII 342 config MII
343 bool "Enable MII" 343 bool "Enable MII"
344 help 344 help
345 Enable support of the Media-Independent Interface (MII) 345 Enable support of the Media-Independent Interface (MII)
346 346
347 config RTL8139 347 config RTL8139
348 bool "Realtek 8139 series Ethernet controller driver" 348 bool "Realtek 8139 series Ethernet controller driver"
349 help 349 help
350 This driver supports Realtek 8139 series fast ethernet family of 350 This driver supports Realtek 8139 series fast ethernet family of
351 PCI chipsets/adapters. 351 PCI chipsets/adapters.
352 352
353 config RTL8169 353 config RTL8169
354 bool "Realtek 8169 series Ethernet controller driver" 354 bool "Realtek 8169 series Ethernet controller driver"
355 help 355 help
356 This driver supports Realtek 8169 series gigabit ethernet family of 356 This driver supports Realtek 8169 series gigabit ethernet family of
357 PCI/PCIe chipsets/adapters. 357 PCI/PCIe chipsets/adapters.
358 358
359 config SMC911X 359 config SMC911X
360 bool "SMSC LAN911x and LAN921x controller driver" 360 bool "SMSC LAN911x and LAN921x controller driver"
361 361
362 if SMC911X 362 if SMC911X
363 363
364 config SMC911X_BASE 364 config SMC911X_BASE
365 hex "SMC911X Base Address" 365 hex "SMC911X Base Address"
366 help 366 help
367 Define this to hold the physical address 367 Define this to hold the physical address
368 of the device (I/O space) 368 of the device (I/O space)
369 369
370 choice 370 choice
371 prompt "SMC911X bus width" 371 prompt "SMC911X bus width"
372 default SMC911X_16_BIT 372 default SMC911X_16_BIT
373 373
374 config SMC911X_32_BIT 374 config SMC911X_32_BIT
375 bool "Enable 32-bit interface" 375 bool "Enable 32-bit interface"
376 376
377 config SMC911X_16_BIT 377 config SMC911X_16_BIT
378 bool "Enable 16-bit interface" 378 bool "Enable 16-bit interface"
379 help 379 help
380 Define this if data bus is 16 bits. If your processor 380 Define this if data bus is 16 bits. If your processor
381 automatically converts one 32 bit word to two 16 bit 381 automatically converts one 32 bit word to two 16 bit
382 words you may also try CONFIG_SMC911X_32_BIT. 382 words you may also try CONFIG_SMC911X_32_BIT.
383 383
384 endchoice 384 endchoice
385 endif #SMC911X 385 endif #SMC911X
386 386
387 config SUN7I_GMAC 387 config SUN7I_GMAC
388 bool "Enable Allwinner GMAC Ethernet support" 388 bool "Enable Allwinner GMAC Ethernet support"
389 help 389 help
390 Enable the support for Sun7i GMAC Ethernet controller 390 Enable the support for Sun7i GMAC Ethernet controller
391 391
392 config SUN7I_GMAC_FORCE_TXERR 392 config SUN7I_GMAC_FORCE_TXERR
393 bool "Force PA17 as gmac function" 393 bool "Force PA17 as gmac function"
394 depends on SUN7I_GMAC 394 depends on SUN7I_GMAC
395 help 395 help
396 Some ethernet phys needs TXERR control. Since the GMAC 396 Some ethernet phys needs TXERR control. Since the GMAC
397 doesn't have such signal, setting PA17 as GMAC function 397 doesn't have such signal, setting PA17 as GMAC function
398 makes the pin output low, which enables data transmission. 398 makes the pin output low, which enables data transmission.
399 399
400 config SUN4I_EMAC 400 config SUN4I_EMAC
401 bool "Allwinner Sun4i Ethernet MAC support" 401 bool "Allwinner Sun4i Ethernet MAC support"
402 depends on DM_ETH 402 depends on DM_ETH
403 select PHYLIB 403 select PHYLIB
404 help 404 help
405 This driver supports the Allwinner based SUN4I Ethernet MAC. 405 This driver supports the Allwinner based SUN4I Ethernet MAC.
406 406
407 config SUN8I_EMAC 407 config SUN8I_EMAC
408 bool "Allwinner Sun8i Ethernet MAC support" 408 bool "Allwinner Sun8i Ethernet MAC support"
409 depends on DM_ETH 409 depends on DM_ETH
410 select PHYLIB 410 select PHYLIB
411 select PHY_GIGE 411 select PHY_GIGE
412 help 412 help
413 This driver supports the Allwinner based SUN8I/SUN50I Ethernet MAC. 413 This driver supports the Allwinner based SUN8I/SUN50I Ethernet MAC.
414 It can be found in H3/A64/A83T based SoCs and compatible with both 414 It can be found in H3/A64/A83T based SoCs and compatible with both
415 External and Internal PHYs. 415 External and Internal PHYs.
416 416
417 config SH_ETHER 417 config SH_ETHER
418 bool "Renesas SH Ethernet MAC" 418 bool "Renesas SH Ethernet MAC"
419 select PHYLIB 419 select PHYLIB
420 help 420 help
421 This driver supports the Ethernet for Renesas SH and ARM SoCs. 421 This driver supports the Ethernet for Renesas SH and ARM SoCs.
422 422
423 source "drivers/net/ti/Kconfig" 423 source "drivers/net/ti/Kconfig"
424 424
425 config XILINX_AXIEMAC 425 config XILINX_AXIEMAC
426 depends on DM_ETH && (MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP) 426 depends on DM_ETH && (MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP)
427 select PHYLIB 427 select PHYLIB
428 select MII 428 select MII
429 bool "Xilinx AXI Ethernet" 429 bool "Xilinx AXI Ethernet"
430 help 430 help
431 This MAC is present in Xilinx Microblaze, Zynq and ZynqMP SoCs. 431 This MAC is present in Xilinx Microblaze, Zynq and ZynqMP SoCs.
432 432
433 config XILINX_EMACLITE 433 config XILINX_EMACLITE
434 depends on DM_ETH && (MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP || MIPS) 434 depends on DM_ETH && (MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP || MIPS)
435 select PHYLIB 435 select PHYLIB
436 select MII 436 select MII
437 bool "Xilinx Ethernetlite" 437 bool "Xilinx Ethernetlite"
438 help 438 help
439 This MAC is present in Xilinx Microblaze, Zynq and ZynqMP SoCs. 439 This MAC is present in Xilinx Microblaze, Zynq and ZynqMP SoCs.
440 440
441 config ZYNQ_GEM 441 config ZYNQ_GEM
442 depends on DM_ETH && (ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL) 442 depends on DM_ETH && (ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL)
443 select PHYLIB 443 select PHYLIB
444 bool "Xilinx Ethernet GEM" 444 bool "Xilinx Ethernet GEM"
445 help 445 help
446 This MAC is present in Xilinx Zynq and ZynqMP SoCs. 446 This MAC is present in Xilinx Zynq and ZynqMP SoCs.
447 447
448 config PIC32_ETH 448 config PIC32_ETH
449 bool "Microchip PIC32 Ethernet Support" 449 bool "Microchip PIC32 Ethernet Support"
450 depends on DM_ETH && MACH_PIC32 450 depends on DM_ETH && MACH_PIC32
451 select PHYLIB 451 select PHYLIB
452 help 452 help
453 This driver implements 10/100 Mbps Ethernet and MAC layer for 453 This driver implements 10/100 Mbps Ethernet and MAC layer for
454 Microchip PIC32 microcontrollers. 454 Microchip PIC32 microcontrollers.
455 455
456 config GMAC_ROCKCHIP 456 config GMAC_ROCKCHIP
457 bool "Rockchip Synopsys Designware Ethernet MAC" 457 bool "Rockchip Synopsys Designware Ethernet MAC"
458 depends on DM_ETH && ETH_DESIGNWARE 458 depends on DM_ETH && ETH_DESIGNWARE
459 help 459 help
460 This driver provides Rockchip SoCs network support based on the 460 This driver provides Rockchip SoCs network support based on the
461 Synopsys Designware driver. 461 Synopsys Designware driver.
462 462
463 config RENESAS_RAVB 463 config RENESAS_RAVB
464 bool "Renesas Ethernet AVB MAC" 464 bool "Renesas Ethernet AVB MAC"
465 depends on DM_ETH && RCAR_GEN3 465 depends on DM_ETH && RCAR_GEN3
466 select PHYLIB 466 select PHYLIB
467 help 467 help
468 This driver implements support for the Ethernet AVB block in 468 This driver implements support for the Ethernet AVB block in
469 Renesas M3 and H3 SoCs. 469 Renesas M3 and H3 SoCs.
470 470
471 config MPC8XX_FEC 471 config MPC8XX_FEC
472 bool "Fast Ethernet Controller on MPC8XX" 472 bool "Fast Ethernet Controller on MPC8XX"
473 depends on MPC8xx 473 depends on MPC8xx
474 select MII 474 select MII
475 help 475 help
476 This driver implements support for the Fast Ethernet Controller 476 This driver implements support for the Fast Ethernet Controller
477 on MPC8XX 477 on MPC8XX
478 478
479 config SNI_AVE 479 config SNI_AVE
480 bool "Socionext AVE Ethernet support" 480 bool "Socionext AVE Ethernet support"
481 depends on DM_ETH && ARCH_UNIPHIER 481 depends on DM_ETH && ARCH_UNIPHIER
482 select PHYLIB 482 select PHYLIB
483 select SYSCON 483 select SYSCON
484 select REGMAP 484 select REGMAP
485 help 485 help
486 This driver implements support for the Socionext AVE Ethernet 486 This driver implements support for the Socionext AVE Ethernet
487 controller, as found on the Socionext UniPhier family. 487 controller, as found on the Socionext UniPhier family.
488 488
489 source "drivers/net/mscc_eswitch/Kconfig" 489 source "drivers/net/mscc_eswitch/Kconfig"
490 490
491 config ETHER_ON_FEC1 491 config ETHER_ON_FEC1
492 bool "FEC1" 492 bool "FEC1"
493 depends on MPC8XX_FEC 493 depends on MPC8XX_FEC
494 default y 494 default y
495 495
496 config FEC1_PHY 496 config FEC1_PHY
497 int "FEC1 PHY" 497 int "FEC1 PHY"
498 depends on ETHER_ON_FEC1 498 depends on ETHER_ON_FEC1
499 default -1 499 default -1
500 help 500 help
501 Define to the hardcoded PHY address which corresponds 501 Define to the hardcoded PHY address which corresponds
502 to the given FEC; i. e. 502 to the given FEC; i. e.
503 #define CONFIG_FEC1_PHY 4 503 #define CONFIG_FEC1_PHY 4
504 means that the PHY with address 4 is connected to FEC1 504 means that the PHY with address 4 is connected to FEC1
505 505
506 When set to -1, means to probe for first available. 506 When set to -1, means to probe for first available.
507 507
508 config PHY_NORXERR 508 config PHY_NORXERR
509 bool "PHY_NORXERR" 509 bool "PHY_NORXERR"
510 depends on ETHER_ON_FEC1 510 depends on ETHER_ON_FEC1
511 default n 511 default n
512 help 512 help
513 The PHY does not have a RXERR line (RMII only). 513 The PHY does not have a RXERR line (RMII only).
514 (so program the FEC to ignore it). 514 (so program the FEC to ignore it).
515 515
516 config ETHER_ON_FEC2 516 config ETHER_ON_FEC2
517 bool "FEC2" 517 bool "FEC2"
518 depends on MPC8XX_FEC && MPC885 518 depends on MPC8XX_FEC && MPC885
519 default y 519 default y
520 520
521 config FEC2_PHY 521 config FEC2_PHY
522 int "FEC2 PHY" 522 int "FEC2 PHY"
523 depends on ETHER_ON_FEC2 523 depends on ETHER_ON_FEC2
524 default -1 524 default -1
525 help 525 help
526 Define to the hardcoded PHY address which corresponds 526 Define to the hardcoded PHY address which corresponds
527 to the given FEC; i. e. 527 to the given FEC; i. e.
528 #define CONFIG_FEC1_PHY 4 528 #define CONFIG_FEC1_PHY 4
529 means that the PHY with address 4 is connected to FEC1 529 means that the PHY with address 4 is connected to FEC1
530 530
531 When set to -1, means to probe for first available. 531 When set to -1, means to probe for first available.
532 532
533 config FEC2_PHY_NORXERR 533 config FEC2_PHY_NORXERR
534 bool "PHY_NORXERR" 534 bool "PHY_NORXERR"
535 depends on ETHER_ON_FEC2 535 depends on ETHER_ON_FEC2
536 default n 536 default n
537 help 537 help
538 The PHY does not have a RXERR line (RMII only). 538 The PHY does not have a RXERR line (RMII only).
539 (so program the FEC to ignore it). 539 (so program the FEC to ignore it).
540 540
541 config SYS_DPAA_QBMAN 541 config SYS_DPAA_QBMAN
542 bool "Device tree fixup for QBMan on freescale SOCs" 542 bool "Device tree fixup for QBMan on freescale SOCs"
543 depends on (ARM || PPC) && !SPL_BUILD 543 depends on (ARM || PPC) && !SPL_BUILD
544 default y if ARCH_B4860 || \ 544 default y if ARCH_B4860 || \
545 ARCH_B4420 || \ 545 ARCH_B4420 || \
546 ARCH_P1023 || \ 546 ARCH_P1023 || \
547 ARCH_P2041 || \ 547 ARCH_P2041 || \
548 ARCH_T1023 || \ 548 ARCH_T1023 || \
549 ARCH_T1024 || \ 549 ARCH_T1024 || \
550 ARCH_T1040 || \ 550 ARCH_T1040 || \
551 ARCH_T1042 || \ 551 ARCH_T1042 || \
552 ARCH_T2080 || \ 552 ARCH_T2080 || \
553 ARCH_T2081 || \ 553 ARCH_T2081 || \
554 ARCH_T4240 || \ 554 ARCH_T4240 || \
555 ARCH_T4160 || \ 555 ARCH_T4160 || \
556 ARCH_P4080 || \ 556 ARCH_P4080 || \
557 ARCH_P3041 || \ 557 ARCH_P3041 || \
558 ARCH_P5040 || \ 558 ARCH_P5040 || \
559 ARCH_P5020 || \ 559 ARCH_P5020 || \
560 ARCH_LS1043A || \ 560 ARCH_LS1043A || \
561 ARCH_LS1046A 561 ARCH_LS1046A
562 help 562 help
563 QBman fixups to allow deep sleep in DPAA 1 SOCs 563 QBman fixups to allow deep sleep in DPAA 1 SOCs
564 564
565 config TSEC_ENET 565 config TSEC_ENET
566 select PHYLIB 566 select PHYLIB
567 bool "Enable Three-Speed Ethernet Controller" 567 bool "Enable Three-Speed Ethernet Controller"
568 help 568 help
569 This driver implements support for the (Enhanced) Three-Speed 569 This driver implements support for the (Enhanced) Three-Speed
570 Ethernet Controller found on Freescale SoCs. 570 Ethernet Controller found on Freescale SoCs.
571 571
572 config MEDIATEK_ETH 572 config MEDIATEK_ETH
573 bool "MediaTek Ethernet GMAC Driver" 573 bool "MediaTek Ethernet GMAC Driver"
574 depends on DM_ETH 574 depends on DM_ETH
575 select PHYLIB 575 select PHYLIB
576 select DM_GPIO 576 select DM_GPIO
577 select DM_RESET 577 select DM_RESET
578 help 578 help
579 This Driver support MediaTek Ethernet GMAC 579 This Driver support MediaTek Ethernet GMAC
580 Say Y to enable support for the MediaTek Ethernet GMAC. 580 Say Y to enable support for the MediaTek Ethernet GMAC.
581 581
582 config HIGMACV300_ETH 582 config HIGMACV300_ETH
583 bool "HiSilicon Gigabit Ethernet Controller" 583 bool "HiSilicon Gigabit Ethernet Controller"
584 depends on DM_ETH 584 depends on DM_ETH
585 select DM_RESET 585 select DM_RESET
586 select PHYLIB 586 select PHYLIB
587 help 587 help
588 This driver supports HIGMACV300 Ethernet controller found on 588 This driver supports HIGMACV300 Ethernet controller found on
589 HiSilicon SoCs. 589 HiSilicon SoCs.
590 590
591 config FSL_ENETC
592 bool "NXP ENETC Ethernet controller"
593 depends on DM_PCI && DM_ETH
594 help
595 This driver supports the NXP ENETC Ethernet controller found on some
596 of the NXP SoCs.
597
591 endif # NETDEVICES 598 endif # NETDEVICES
592 599
drivers/net/Makefile
1 # SPDX-License-Identifier: GPL-2.0+ 1 # SPDX-License-Identifier: GPL-2.0+
2 # 2 #
3 # (C) Copyright 2006 3 # (C) Copyright 2006
4 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. 4 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 5
6 obj-$(CONFIG_ALTERA_TSE) += altera_tse.o 6 obj-$(CONFIG_ALTERA_TSE) += altera_tse.o
7 obj-$(CONFIG_AG7XXX) += ag7xxx.o 7 obj-$(CONFIG_AG7XXX) += ag7xxx.o
8 obj-$(CONFIG_ARMADA100_FEC) += armada100_fec.o 8 obj-$(CONFIG_ARMADA100_FEC) += armada100_fec.o
9 obj-$(CONFIG_BCM6348_ETH) += bcm6348-eth.o 9 obj-$(CONFIG_BCM6348_ETH) += bcm6348-eth.o
10 obj-$(CONFIG_BCM6368_ETH) += bcm6368-eth.o 10 obj-$(CONFIG_BCM6368_ETH) += bcm6368-eth.o
11 obj-$(CONFIG_DRIVER_AT91EMAC) += at91_emac.o 11 obj-$(CONFIG_DRIVER_AT91EMAC) += at91_emac.o
12 obj-$(CONFIG_DRIVER_AX88180) += ax88180.o 12 obj-$(CONFIG_DRIVER_AX88180) += ax88180.o
13 obj-$(CONFIG_BCM_SF2_ETH) += bcm-sf2-eth.o 13 obj-$(CONFIG_BCM_SF2_ETH) += bcm-sf2-eth.o
14 obj-$(CONFIG_BCM_SF2_ETH_GMAC) += bcm-sf2-eth-gmac.o 14 obj-$(CONFIG_BCM_SF2_ETH_GMAC) += bcm-sf2-eth-gmac.o
15 obj-$(CONFIG_CALXEDA_XGMAC) += calxedaxgmac.o 15 obj-$(CONFIG_CALXEDA_XGMAC) += calxedaxgmac.o
16 obj-$(CONFIG_CS8900) += cs8900.o 16 obj-$(CONFIG_CS8900) += cs8900.o
17 obj-$(CONFIG_TULIP) += dc2114x.o 17 obj-$(CONFIG_TULIP) += dc2114x.o
18 obj-$(CONFIG_ETH_DESIGNWARE) += designware.o 18 obj-$(CONFIG_ETH_DESIGNWARE) += designware.o
19 obj-$(CONFIG_ETH_DESIGNWARE_SOCFPGA) += dwmac_socfpga.o 19 obj-$(CONFIG_ETH_DESIGNWARE_SOCFPGA) += dwmac_socfpga.o
20 obj-$(CONFIG_DRIVER_DM9000) += dm9000x.o 20 obj-$(CONFIG_DRIVER_DM9000) += dm9000x.o
21 obj-$(CONFIG_DNET) += dnet.o 21 obj-$(CONFIG_DNET) += dnet.o
22 obj-$(CONFIG_E1000) += e1000.o 22 obj-$(CONFIG_E1000) += e1000.o
23 obj-$(CONFIG_E1000_SPI) += e1000_spi.o 23 obj-$(CONFIG_E1000_SPI) += e1000_spi.o
24 obj-$(CONFIG_EEPRO100) += eepro100.o 24 obj-$(CONFIG_EEPRO100) += eepro100.o
25 obj-$(CONFIG_SUN4I_EMAC) += sunxi_emac.o 25 obj-$(CONFIG_SUN4I_EMAC) += sunxi_emac.o
26 obj-$(CONFIG_SUN8I_EMAC) += sun8i_emac.o 26 obj-$(CONFIG_SUN8I_EMAC) += sun8i_emac.o
27 obj-$(CONFIG_EP93XX) += ep93xx_eth.o 27 obj-$(CONFIG_EP93XX) += ep93xx_eth.o
28 obj-$(CONFIG_ETHOC) += ethoc.o 28 obj-$(CONFIG_ETHOC) += ethoc.o
29 obj-$(CONFIG_FEC_MXC) += fec_mxc.o 29 obj-$(CONFIG_FEC_MXC) += fec_mxc.o
30 obj-$(CONFIG_FSLDMAFEC) += fsl_mcdmafec.o mcfmii.o 30 obj-$(CONFIG_FSLDMAFEC) += fsl_mcdmafec.o mcfmii.o
31 obj-$(CONFIG_FTGMAC100) += ftgmac100.o 31 obj-$(CONFIG_FTGMAC100) += ftgmac100.o
32 obj-$(CONFIG_FTMAC110) += ftmac110.o 32 obj-$(CONFIG_FTMAC110) += ftmac110.o
33 obj-$(CONFIG_FTMAC100) += ftmac100.o 33 obj-$(CONFIG_FTMAC100) += ftmac100.o
34 obj-$(CONFIG_GMAC_ROCKCHIP) += gmac_rockchip.o 34 obj-$(CONFIG_GMAC_ROCKCHIP) += gmac_rockchip.o
35 obj-$(CONFIG_KS8851_MLL) += ks8851_mll.o 35 obj-$(CONFIG_KS8851_MLL) += ks8851_mll.o
36 obj-$(CONFIG_LAN91C96) += lan91c96.o 36 obj-$(CONFIG_LAN91C96) += lan91c96.o
37 obj-$(CONFIG_LPC32XX_ETH) += lpc32xx_eth.o 37 obj-$(CONFIG_LPC32XX_ETH) += lpc32xx_eth.o
38 obj-$(CONFIG_MACB) += macb.o 38 obj-$(CONFIG_MACB) += macb.o
39 obj-$(CONFIG_MCFFEC) += mcffec.o mcfmii.o 39 obj-$(CONFIG_MCFFEC) += mcffec.o mcfmii.o
40 obj-$(CONFIG_MDIO_MUX_SANDBOX) += mdio_mux_sandbox.o 40 obj-$(CONFIG_MDIO_MUX_SANDBOX) += mdio_mux_sandbox.o
41 obj-$(CONFIG_MPC8XX_FEC) += mpc8xx_fec.o 41 obj-$(CONFIG_MPC8XX_FEC) += mpc8xx_fec.o
42 obj-$(CONFIG_MT7628_ETH) += mt7628-eth.o 42 obj-$(CONFIG_MT7628_ETH) += mt7628-eth.o
43 obj-$(CONFIG_MVGBE) += mvgbe.o 43 obj-$(CONFIG_MVGBE) += mvgbe.o
44 obj-$(CONFIG_MVNETA) += mvneta.o 44 obj-$(CONFIG_MVNETA) += mvneta.o
45 obj-$(CONFIG_MVPP2) += mvpp2.o 45 obj-$(CONFIG_MVPP2) += mvpp2.o
46 obj-$(CONFIG_NATSEMI) += natsemi.o 46 obj-$(CONFIG_NATSEMI) += natsemi.o
47 obj-$(CONFIG_DRIVER_NE2000) += ne2000.o ne2000_base.o 47 obj-$(CONFIG_DRIVER_NE2000) += ne2000.o ne2000_base.o
48 obj-$(CONFIG_DRIVER_AX88796L) += ax88796.o ne2000_base.o 48 obj-$(CONFIG_DRIVER_AX88796L) += ax88796.o ne2000_base.o
49 obj-$(CONFIG_NETCONSOLE) += netconsole.o 49 obj-$(CONFIG_NETCONSOLE) += netconsole.o
50 obj-$(CONFIG_NS8382X) += ns8382x.o 50 obj-$(CONFIG_NS8382X) += ns8382x.o
51 obj-$(CONFIG_PCH_GBE) += pch_gbe.o 51 obj-$(CONFIG_PCH_GBE) += pch_gbe.o
52 obj-$(CONFIG_PCNET) += pcnet.o 52 obj-$(CONFIG_PCNET) += pcnet.o
53 obj-$(CONFIG_RTL8139) += rtl8139.o 53 obj-$(CONFIG_RTL8139) += rtl8139.o
54 obj-$(CONFIG_RTL8169) += rtl8169.o 54 obj-$(CONFIG_RTL8169) += rtl8169.o
55 obj-$(CONFIG_ETH_SANDBOX) += sandbox.o 55 obj-$(CONFIG_ETH_SANDBOX) += sandbox.o
56 obj-$(CONFIG_ETH_SANDBOX_RAW) += sandbox-raw.o 56 obj-$(CONFIG_ETH_SANDBOX_RAW) += sandbox-raw.o
57 obj-$(CONFIG_ETH_SANDBOX_RAW) += sandbox-raw-bus.o 57 obj-$(CONFIG_ETH_SANDBOX_RAW) += sandbox-raw-bus.o
58 obj-$(CONFIG_SH_ETHER) += sh_eth.o 58 obj-$(CONFIG_SH_ETHER) += sh_eth.o
59 obj-$(CONFIG_RENESAS_RAVB) += ravb.o 59 obj-$(CONFIG_RENESAS_RAVB) += ravb.o
60 obj-$(CONFIG_SMC91111) += smc91111.o 60 obj-$(CONFIG_SMC91111) += smc91111.o
61 obj-$(CONFIG_SMC911X) += smc911x.o 61 obj-$(CONFIG_SMC911X) += smc911x.o
62 obj-$(CONFIG_TSEC_ENET) += tsec.o fsl_mdio.o 62 obj-$(CONFIG_TSEC_ENET) += tsec.o fsl_mdio.o
63 obj-$(CONFIG_FMAN_ENET) += fsl_mdio.o 63 obj-$(CONFIG_FMAN_ENET) += fsl_mdio.o
64 obj-$(CONFIG_ULI526X) += uli526x.o 64 obj-$(CONFIG_ULI526X) += uli526x.o
65 obj-$(CONFIG_VSC7385_ENET) += vsc7385.o 65 obj-$(CONFIG_VSC7385_ENET) += vsc7385.o
66 obj-$(CONFIG_XILINX_AXIEMAC) += xilinx_axi_emac.o 66 obj-$(CONFIG_XILINX_AXIEMAC) += xilinx_axi_emac.o
67 obj-$(CONFIG_XILINX_EMACLITE) += xilinx_emaclite.o 67 obj-$(CONFIG_XILINX_EMACLITE) += xilinx_emaclite.o
68 obj-$(CONFIG_ZYNQ_GEM) += zynq_gem.o 68 obj-$(CONFIG_ZYNQ_GEM) += zynq_gem.o
69 obj-$(CONFIG_FSL_MC_ENET) += fsl-mc/ 69 obj-$(CONFIG_FSL_MC_ENET) += fsl-mc/
70 obj-$(CONFIG_FSL_MC_ENET) += ldpaa_eth/ 70 obj-$(CONFIG_FSL_MC_ENET) += ldpaa_eth/
71 obj-$(CONFIG_FSL_MEMAC) += fm/memac_phy.o 71 obj-$(CONFIG_FSL_MEMAC) += fm/memac_phy.o
72 obj-$(CONFIG_VSC9953) += vsc9953.o 72 obj-$(CONFIG_VSC9953) += vsc9953.o
73 obj-$(CONFIG_PIC32_ETH) += pic32_mdio.o pic32_eth.o 73 obj-$(CONFIG_PIC32_ETH) += pic32_mdio.o pic32_eth.o
74 obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o 74 obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o
75 obj-$(CONFIG_FSL_PFE) += pfe_eth/ 75 obj-$(CONFIG_FSL_PFE) += pfe_eth/
76 obj-$(CONFIG_SNI_AVE) += sni_ave.o 76 obj-$(CONFIG_SNI_AVE) += sni_ave.o
77 obj-y += ti/ 77 obj-y += ti/
78 obj-$(CONFIG_MEDIATEK_ETH) += mtk_eth.o 78 obj-$(CONFIG_MEDIATEK_ETH) += mtk_eth.o
79 obj-y += mscc_eswitch/ 79 obj-y += mscc_eswitch/
80 obj-$(CONFIG_HIGMACV300_ETH) += higmacv300.o 80 obj-$(CONFIG_HIGMACV300_ETH) += higmacv300.o
81 obj-$(CONFIG_MDIO_SANDBOX) += mdio_sandbox.o 81 obj-$(CONFIG_MDIO_SANDBOX) += mdio_sandbox.o
82 obj-$(CONFIG_FSL_ENETC) += fsl_enetc.o
82 83
drivers/net/fsl_enetc.c
File was created 1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * ENETC ethernet controller driver
4 * Copyright 2017-2019 NXP
5 */
6
7 #include <common.h>
8 #include <dm.h>
9 #include <errno.h>
10 #include <memalign.h>
11 #include <asm/io.h>
12 #include <pci.h>
13
14 #include "fsl_enetc.h"
15
16 /*
17 * Bind the device:
18 * - set a more explicit name on the interface
19 */
20 static int enetc_bind(struct udevice *dev)
21 {
22 char name[16];
23 static int eth_num_devices;
24
25 /*
26 * prefer using PCI function numbers to number interfaces, but these
27 * are only available if dts nodes are present. For PCI they are
28 * optional, handle that case too. Just in case some nodes are present
29 * and some are not, use different naming scheme - enetc-N based on
30 * PCI function # and enetc#N based on interface count
31 */
32 if (ofnode_valid(dev->node))
33 sprintf(name, "enetc-%u", PCI_FUNC(pci_get_devfn(dev)));
34 else
35 sprintf(name, "enetc#%u", eth_num_devices++);
36 device_set_name(dev, name);
37
38 return 0;
39 }
40
41 /*
42 * Probe ENETC driver:
43 * - initialize port and station interface BARs
44 */
45 static int enetc_probe(struct udevice *dev)
46 {
47 struct enetc_priv *priv = dev_get_priv(dev);
48
49 if (ofnode_valid(dev->node) && !ofnode_is_available(dev->node)) {
50 enetc_dbg(dev, "interface disabled\n");
51 return -ENODEV;
52 }
53
54 priv->enetc_txbd = memalign(ENETC_BD_ALIGN,
55 sizeof(struct enetc_tx_bd) * ENETC_BD_CNT);
56 priv->enetc_rxbd = memalign(ENETC_BD_ALIGN,
57 sizeof(union enetc_rx_bd) * ENETC_BD_CNT);
58
59 if (!priv->enetc_txbd || !priv->enetc_rxbd) {
60 /* free should be able to handle NULL, just free all pointers */
61 free(priv->enetc_txbd);
62 free(priv->enetc_rxbd);
63
64 return -ENOMEM;
65 }
66
67 /* initialize register */
68 priv->regs_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0);
69 if (!priv->regs_base) {
70 enetc_dbg(dev, "failed to map BAR0\n");
71 return -EINVAL;
72 }
73 priv->port_regs = priv->regs_base + ENETC_PORT_REGS_OFF;
74
75 dm_pci_clrset_config16(dev, PCI_COMMAND, 0, PCI_COMMAND_MEMORY);
76
77 return 0;
78 }
79
80 /*
81 * Remove the driver from an interface:
82 * - free up allocated memory
83 */
84 static int enetc_remove(struct udevice *dev)
85 {
86 struct enetc_priv *priv = dev_get_priv(dev);
87
88 free(priv->enetc_txbd);
89 free(priv->enetc_rxbd);
90
91 return 0;
92 }
93
94 /* ENETC Port MAC address registers, accepts big-endian format */
95 static void enetc_set_primary_mac_addr(struct enetc_priv *priv, const u8 *addr)
96 {
97 u16 lower = *(const u16 *)(addr + 4);
98 u32 upper = *(const u32 *)addr;
99
100 enetc_write_port(priv, ENETC_PSIPMAR0, upper);
101 enetc_write_port(priv, ENETC_PSIPMAR1, lower);
102 }
103
104 /* Configure port parameters (# of rings, frame size, enable port) */
105 static void enetc_enable_si_port(struct enetc_priv *priv)
106 {
107 u32 val;
108
109 /* set Rx/Tx BDR count */
110 val = ENETC_PSICFGR_SET_TXBDR(ENETC_TX_BDR_CNT);
111 val |= ENETC_PSICFGR_SET_RXBDR(ENETC_RX_BDR_CNT);
112 enetc_write_port(priv, ENETC_PSICFGR(0), val);
113 /* set Rx max frame size */
114 enetc_write_port(priv, ENETC_PM_MAXFRM, ENETC_RX_MAXFRM_SIZE);
115 /* enable MAC port */
116 enetc_write_port(priv, ENETC_PM_CC, ENETC_PM_CC_RX_TX_EN);
117 /* enable port */
118 enetc_write_port(priv, ENETC_PMR, ENETC_PMR_SI0_EN);
119 /* set SI cache policy */
120 enetc_write(priv, ENETC_SICAR0,
121 ENETC_SICAR_RD_CFG | ENETC_SICAR_WR_CFG);
122 /* enable SI */
123 enetc_write(priv, ENETC_SIMR, ENETC_SIMR_EN);
124 }
125
126 /* returns DMA address for a given buffer index */
127 static inline u64 enetc_rxb_address(struct udevice *dev, int i)
128 {
129 return cpu_to_le64(dm_pci_virt_to_mem(dev, net_rx_packets[i]));
130 }
131
132 /*
133 * Setup a single Tx BD Ring (ID = 0):
134 * - set Tx buffer descriptor address
135 * - set the BD count
136 * - initialize the producer and consumer index
137 */
138 static void enetc_setup_tx_bdr(struct udevice *dev)
139 {
140 struct enetc_priv *priv = dev_get_priv(dev);
141 struct bd_ring *tx_bdr = &priv->tx_bdr;
142 u64 tx_bd_add = (u64)priv->enetc_txbd;
143
144 /* used later to advance to the next Tx BD */
145 tx_bdr->bd_count = ENETC_BD_CNT;
146 tx_bdr->next_prod_idx = 0;
147 tx_bdr->next_cons_idx = 0;
148 tx_bdr->cons_idx = priv->regs_base +
149 ENETC_BDR(TX, ENETC_TX_BDR_ID, ENETC_TBCIR);
150 tx_bdr->prod_idx = priv->regs_base +
151 ENETC_BDR(TX, ENETC_TX_BDR_ID, ENETC_TBPIR);
152
153 /* set Tx BD address */
154 enetc_bdr_write(priv, TX, ENETC_TX_BDR_ID, ENETC_TBBAR0,
155 lower_32_bits(tx_bd_add));
156 enetc_bdr_write(priv, TX, ENETC_TX_BDR_ID, ENETC_TBBAR1,
157 upper_32_bits(tx_bd_add));
158 /* set Tx 8 BD count */
159 enetc_bdr_write(priv, TX, ENETC_TX_BDR_ID, ENETC_TBLENR,
160 tx_bdr->bd_count);
161
162 /* reset both producer/consumer indexes */
163 enetc_write_reg(tx_bdr->cons_idx, tx_bdr->next_cons_idx);
164 enetc_write_reg(tx_bdr->prod_idx, tx_bdr->next_prod_idx);
165
166 /* enable TX ring */
167 enetc_bdr_write(priv, TX, ENETC_TX_BDR_ID, ENETC_TBMR, ENETC_TBMR_EN);
168 }
169
170 /*
171 * Setup a single Rx BD Ring (ID = 0):
172 * - set Rx buffer descriptors address (one descriptor per buffer)
173 * - set buffer size as max frame size
174 * - enable Rx ring
175 * - reset consumer and producer indexes
176 * - set buffer for each descriptor
177 */
178 static void enetc_setup_rx_bdr(struct udevice *dev)
179 {
180 struct enetc_priv *priv = dev_get_priv(dev);
181 struct bd_ring *rx_bdr = &priv->rx_bdr;
182 u64 rx_bd_add = (u64)priv->enetc_rxbd;
183 int i;
184
185 /* used later to advance to the next BD produced by ENETC HW */
186 rx_bdr->bd_count = ENETC_BD_CNT;
187 rx_bdr->next_prod_idx = 0;
188 rx_bdr->next_cons_idx = 0;
189 rx_bdr->cons_idx = priv->regs_base +
190 ENETC_BDR(RX, ENETC_RX_BDR_ID, ENETC_RBCIR);
191 rx_bdr->prod_idx = priv->regs_base +
192 ENETC_BDR(RX, ENETC_RX_BDR_ID, ENETC_RBPIR);
193
194 /* set Rx BD address */
195 enetc_bdr_write(priv, RX, ENETC_RX_BDR_ID, ENETC_RBBAR0,
196 lower_32_bits(rx_bd_add));
197 enetc_bdr_write(priv, RX, ENETC_RX_BDR_ID, ENETC_RBBAR1,
198 upper_32_bits(rx_bd_add));
199 /* set Rx BD count (multiple of 8) */
200 enetc_bdr_write(priv, RX, ENETC_RX_BDR_ID, ENETC_RBLENR,
201 rx_bdr->bd_count);
202 /* set Rx buffer size */
203 enetc_bdr_write(priv, RX, ENETC_RX_BDR_ID, ENETC_RBBSR, PKTSIZE_ALIGN);
204
205 /* fill Rx BD */
206 memset(priv->enetc_rxbd, 0,
207 rx_bdr->bd_count * sizeof(union enetc_rx_bd));
208 for (i = 0; i < rx_bdr->bd_count; i++) {
209 priv->enetc_rxbd[i].w.addr = enetc_rxb_address(dev, i);
210 /* each RX buffer must be aligned to 64B */
211 WARN_ON(priv->enetc_rxbd[i].w.addr & (ARCH_DMA_MINALIGN - 1));
212 }
213
214 /* reset producer (ENETC owned) and consumer (SW owned) index */
215 enetc_write_reg(rx_bdr->cons_idx, rx_bdr->next_cons_idx);
216 enetc_write_reg(rx_bdr->prod_idx, rx_bdr->next_prod_idx);
217
218 /* enable Rx ring */
219 enetc_bdr_write(priv, RX, ENETC_RX_BDR_ID, ENETC_RBMR, ENETC_RBMR_EN);
220 }
221
222 /*
223 * Start ENETC interface:
224 * - perform FLR
225 * - enable access to port and SI registers
226 * - set mac address
227 * - setup TX/RX buffer descriptors
228 * - enable Tx/Rx rings
229 */
230 static int enetc_start(struct udevice *dev)
231 {
232 struct eth_pdata *plat = dev_get_platdata(dev);
233 struct enetc_priv *priv = dev_get_priv(dev);
234
235 /* reset and enable the PCI device */
236 dm_pci_flr(dev);
237 dm_pci_clrset_config16(dev, PCI_COMMAND, 0,
238 PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
239
240 if (!is_valid_ethaddr(plat->enetaddr)) {
241 enetc_dbg(dev, "invalid MAC address, generate random ...\n");
242 net_random_ethaddr(plat->enetaddr);
243 }
244 enetc_set_primary_mac_addr(priv, plat->enetaddr);
245
246 enetc_enable_si_port(priv);
247
248 /* setup Tx/Rx buffer descriptors */
249 enetc_setup_tx_bdr(dev);
250 enetc_setup_rx_bdr(dev);
251
252 return 0;
253 }
254
255 /*
256 * Stop the network interface:
257 * - just quiesce it, we can wipe all configuration as _start starts from
258 * scratch each time
259 */
260 static void enetc_stop(struct udevice *dev)
261 {
262 /* FLR is sufficient to quiesce the device */
263 dm_pci_flr(dev);
264 }
265
266 /*
267 * ENETC transmit packet:
268 * - check if Tx BD ring is full
269 * - set buffer/packet address (dma address)
270 * - set final fragment flag
271 * - try while producer index equals consumer index or timeout
272 */
273 static int enetc_send(struct udevice *dev, void *packet, int length)
274 {
275 struct enetc_priv *priv = dev_get_priv(dev);
276 struct bd_ring *txr = &priv->tx_bdr;
277 void *nv_packet = (void *)packet;
278 int tries = ENETC_POLL_TRIES;
279 u32 pi, ci;
280
281 pi = txr->next_prod_idx;
282 ci = enetc_read_reg(txr->cons_idx) & ENETC_BDR_IDX_MASK;
283 /* Tx ring is full when */
284 if (((pi + 1) % txr->bd_count) == ci) {
285 enetc_dbg(dev, "Tx BDR full\n");
286 return -ETIMEDOUT;
287 }
288 enetc_dbg(dev, "TxBD[%d]send: pkt_len=%d, buff @0x%x%08x\n", pi, length,
289 upper_32_bits((u64)nv_packet), lower_32_bits((u64)nv_packet));
290
291 /* prepare Tx BD */
292 memset(&priv->enetc_txbd[pi], 0x0, sizeof(struct enetc_tx_bd));
293 priv->enetc_txbd[pi].addr =
294 cpu_to_le64(dm_pci_virt_to_mem(dev, nv_packet));
295 priv->enetc_txbd[pi].buf_len = cpu_to_le16(length);
296 priv->enetc_txbd[pi].frm_len = cpu_to_le16(length);
297 priv->enetc_txbd[pi].flags = cpu_to_le16(ENETC_TXBD_FLAGS_F);
298 dmb();
299 /* send frame: increment producer index */
300 pi = (pi + 1) % txr->bd_count;
301 txr->next_prod_idx = pi;
302 enetc_write_reg(txr->prod_idx, pi);
303 while ((--tries >= 0) &&
304 (pi != (enetc_read_reg(txr->cons_idx) & ENETC_BDR_IDX_MASK)))
305 udelay(10);
306
307 return tries > 0 ? 0 : -ETIMEDOUT;
308 }
309
310 /*
311 * Receive frame:
312 * - wait for the next BD to get ready bit set
313 * - clean up the descriptor
314 * - move on and indicate to HW that the cleaned BD is available for Rx
315 */
316 static int enetc_recv(struct udevice *dev, int flags, uchar **packetp)
317 {
318 struct enetc_priv *priv = dev_get_priv(dev);
319 struct bd_ring *rxr = &priv->rx_bdr;
320 int tries = ENETC_POLL_TRIES;
321 int pi = rxr->next_prod_idx;
322 int ci = rxr->next_cons_idx;
323 u32 status;
324 int len;
325 u8 rdy;
326
327 do {
328 dmb();
329 status = le32_to_cpu(priv->enetc_rxbd[pi].r.lstatus);
330 /* check if current BD is ready to be consumed */
331 rdy = ENETC_RXBD_STATUS_R(status);
332 } while (--tries >= 0 && !rdy);
333
334 if (!rdy)
335 return -EAGAIN;
336
337 dmb();
338 len = le16_to_cpu(priv->enetc_rxbd[pi].r.buf_len);
339 *packetp = (uchar *)enetc_rxb_address(dev, pi);
340 enetc_dbg(dev, "RxBD[%d]: len=%d err=%d pkt=0x%x%08x\n", pi, len,
341 ENETC_RXBD_STATUS_ERRORS(status),
342 upper_32_bits((u64)*packetp), lower_32_bits((u64)*packetp));
343
344 /* BD clean up and advance to next in ring */
345 memset(&priv->enetc_rxbd[pi], 0, sizeof(union enetc_rx_bd));
346 priv->enetc_rxbd[pi].w.addr = enetc_rxb_address(dev, pi);
347 rxr->next_prod_idx = (pi + 1) % rxr->bd_count;
348 ci = (ci + 1) % rxr->bd_count;
349 rxr->next_cons_idx = ci;
350 dmb();
351 /* free up the slot in the ring for HW */
352 enetc_write_reg(rxr->cons_idx, ci);
353
354 return len;
355 }
356
357 static const struct eth_ops enetc_ops = {
358 .start = enetc_start,
359 .send = enetc_send,
360 .recv = enetc_recv,
361 .stop = enetc_stop,
362 };
363
364 U_BOOT_DRIVER(eth_enetc) = {
365 .name = "enetc_eth",
366 .id = UCLASS_ETH,
367 .bind = enetc_bind,
368 .probe = enetc_probe,
369 .remove = enetc_remove,
370 .ops = &enetc_ops,
371 .priv_auto_alloc_size = sizeof(struct enetc_priv),
372 .platdata_auto_alloc_size = sizeof(struct eth_pdata),
373 };
374
375 static struct pci_device_id enetc_ids[] = {
376 { PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, PCI_DEVICE_ID_ENETC_ETH) },
377 {}
378 };
379
380 U_BOOT_PCI_DEVICE(eth_enetc, enetc_ids);
381
drivers/net/fsl_enetc.h
File was created 1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3 * ENETC ethernet controller driver
4 * Copyright 2017-2019 NXP
5 */
6
7 #ifndef _ENETC_H
8 #define _ENETC_H
9
10 #define enetc_dbg(dev, fmt, args...) debug("%s:" fmt, dev->name, ##args)
11
12 /* PCI function IDs */
13 #define PCI_DEVICE_ID_ENETC_ETH 0xE100
14
15 /* ENETC Ethernet controller registers */
16 /* Station interface register offsets */
17 #define ENETC_SIMR 0x000
18 #define ENETC_SIMR_EN BIT(31)
19 #define ENETC_SICAR0 0x040
20 /* write cache cfg: snoop, no allocate, data & BD coherent */
21 #define ENETC_SICAR_WR_CFG 0x6767
22 /* read cache cfg: coherent copy, look up, don't alloc in cache */
23 #define ENETC_SICAR_RD_CFG 0x27270000
24 #define ENETC_SIROCT 0x300
25 #define ENETC_SIRFRM 0x308
26 #define ENETC_SITOCT 0x320
27 #define ENETC_SITFRM 0x328
28
29 /* Rx/Tx Buffer Descriptor Ring registers */
30 enum enetc_bdr_type {TX, RX};
31 #define ENETC_BDR(type, n, off) (0x8000 + (type) * 0x100 + (n) * 0x200 + (off))
32 #define ENETC_BDR_IDX_MASK 0xffff
33
34 /* Rx BDR reg offsets */
35 #define ENETC_RBMR 0x00
36 #define ENETC_RBMR_EN BIT(31)
37 #define ENETC_RBBSR 0x08
38 /* initial consumer index for Rx BDR */
39 #define ENETC_RBCIR 0x0c
40 #define ENETC_RBBAR0 0x10
41 #define ENETC_RBBAR1 0x14
42 #define ENETC_RBPIR 0x18
43 #define ENETC_RBLENR 0x20
44
45 /* Tx BDR reg offsets */
46 #define ENETC_TBMR 0x00
47 #define ENETC_TBMR_EN BIT(31)
48 #define ENETC_TBBAR0 0x10
49 #define ENETC_TBBAR1 0x14
50 #define ENETC_TBPIR 0x18
51 #define ENETC_TBCIR 0x1c
52 #define ENETC_TBLENR 0x20
53
54 /* Port registers offset */
55 #define ENETC_PORT_REGS_OFF 0x10000
56
57 /* Port registers */
58 #define ENETC_PMR 0x0000
59 #define ENETC_PMR_SI0_EN BIT(16)
60 #define ENETC_PSIPMMR 0x0018
61 #define ENETC_PSIPMAR0 0x0100
62 #define ENETC_PSIPMAR1 0x0104
63 #define ENETC_PSICFGR(n) (0x0940 + (n) * 0x10)
64 #define ENETC_PSICFGR_SET_TXBDR(val) ((val) & 0xff)
65 #define ENETC_PSICFGR_SET_RXBDR(val) (((val) & 0xff) << 16)
66 /* MAC configuration */
67 #define ENETC_PM_CC 0x8008
68 #define ENETC_PM_CC_DEFAULT 0x0810
69 #define ENETC_PM_CC_RX_TX_EN 0x8813
70 #define ENETC_PM_MAXFRM 0x8014
71 #define ENETC_RX_MAXFRM_SIZE PKTSIZE_ALIGN
72
73 /* buffer descriptors count must be multiple of 8 and aligned to 128 bytes */
74 #define ENETC_BD_CNT CONFIG_SYS_RX_ETH_BUFFER
75 #define ENETC_BD_ALIGN 128
76
77 /* single pair of Rx/Tx rings */
78 #define ENETC_RX_BDR_CNT 1
79 #define ENETC_TX_BDR_CNT 1
80 #define ENETC_RX_BDR_ID 0
81 #define ENETC_TX_BDR_ID 0
82
83 /* Tx buffer descriptor */
84 struct enetc_tx_bd {
85 __le64 addr;
86 __le16 buf_len;
87 __le16 frm_len;
88 __le16 err_csum;
89 __le16 flags;
90 };
91
92 #define ENETC_TXBD_FLAGS_F BIT(15)
93 #define ENETC_POLL_TRIES 32000
94
95 /* Rx buffer descriptor */
96 union enetc_rx_bd {
97 /* SW provided BD format */
98 struct {
99 __le64 addr;
100 u8 reserved[8];
101 } w;
102
103 /* ENETC returned BD format */
104 struct {
105 __le16 inet_csum;
106 __le16 parse_summary;
107 __le32 rss_hash;
108 __le16 buf_len;
109 __le16 vlan_opt;
110 union {
111 struct {
112 __le16 flags;
113 __le16 error;
114 };
115 __le32 lstatus;
116 };
117 } r;
118 };
119
120 #define ENETC_RXBD_STATUS_R(status) (((status) >> 30) & 0x1)
121 #define ENETC_RXBD_STATUS_F(status) (((status) >> 31) & 0x1)
122 #define ENETC_RXBD_STATUS_ERRORS(status) (((status) >> 16) & 0xff)
123 #define ENETC_RXBD_STATUS(flags) ((flags) << 16)
124
125 /* Tx/Rx ring info */
126 struct bd_ring {
127 void *cons_idx;
128 void *prod_idx;
129 /* next BD index to use */
130 int next_prod_idx;
131 int next_cons_idx;
132 int bd_count;
133 };
134
135 /* ENETC private structure */
136 struct enetc_priv {
137 struct enetc_tx_bd *enetc_txbd;
138 union enetc_rx_bd *enetc_rxbd;
139
140 void *regs_base; /* base ENETC registers */
141 void *port_regs; /* base ENETC port registers */
142
143 /* Rx/Tx buffer descriptor rings info */
144 struct bd_ring tx_bdr;
145 struct bd_ring rx_bdr;
146 };
147
148 /* register accessors */
149 #define enetc_read_reg(x) readl((x))
150 #define enetc_write_reg(x, val) writel((val), (x))
151 #define enetc_read(priv, off) enetc_read_reg((priv)->regs_base + (off))
152 #define enetc_write(priv, off, v) \
153 enetc_write_reg((priv)->regs_base + (off), v)
154
155 /* port register accessors */
156 #define enetc_port_regs(priv, off) ((priv)->port_regs + (off))
157 #define enetc_read_port(priv, off) \
158 enetc_read_reg(enetc_port_regs((priv), (off)))
159 #define enetc_write_port(priv, off, v) \
160 enetc_write_reg(enetc_port_regs((priv), (off)), v)
161
162 /* BDR register accessors, see ENETC_BDR() */
163 #define enetc_bdr_read(priv, t, n, off) \
164 enetc_read(priv, ENETC_BDR(t, n, off))
165 #define enetc_bdr_write(priv, t, n, off, val) \
166 enetc_write(priv, ENETC_BDR(t, n, off), val)
167
168 #endif /* _ENETC_H */
169