Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zynq-mpsoc: add support for ethernet #15720

Merged
merged 2 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions arch/arm64/src/zynq-mpsoc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,139 @@ config ZYNQ_MPSOC_UART1
---help---
Select to enable support for UART1.

config ZYNQ_ENET
bool "Ethernet"
default n
select ARCH_HAVE_PHY
select ARCH_HAVE_NETDEV_STATISTICS

endmenu # XILINX ZYNQ_MPSOC Peripheral Selection

menu "Ethernet Configuration"
depends on ZYNQ_ENET

choice
prompt "ZYNQ Ethernet Interface"
default ZYNQ_ENET4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does ENET4 is default instead of ENET1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because GMAC3 belong to PS of ZYNQ MPSOC, GMAC0~GMAC2 may depends on PL of ZYNQ MPSOC

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whats more, ZCU111 board use GMAC3

depends on ZYNQ_ENET

config ZYNQ_ENET1
bool "ENET 1"

config ZYNQ_ENET2
bool "ENET 2"

config ZYNQ_ENET3
bool "ENET 3"

config ZYNQ_ENET4
bool "ENET 4"

endchoice # ZYNQ Ethernet Interface

config ZYNQ_GMAC_NRXBUFFERS
int "Number of RX buffers"
default 16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a upper limit for those 128 bytes blocks? If so, please include a range i.e. 1 to 32

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done! thanks for your review

range 16 256
---help---
GMAC buffer memory is segmented into 128 byte units (not
configurable). This setting provides the number of such 128 byte
units used for reception. This is also equal to the number of RX
descriptors that will be allocated. The selected value must be an
even power of 2.

config ZYNQ_GMAC_NTXBUFFERS
int "Number of TX buffers"
default 8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

range 8 256
---help---
GMAC buffer memory is segmented into full Ethernet packets (size
NET_BUFSIZE bytes). This setting provides the number of such packets
that can be in flight. This is also equal to the number of TX
descriptors that will be allocated.

config ZYNQ_GMAC_PREALLOCATE
bool "Preallocate buffers"
default n
---help---
Buffer and descriptor may either be allocated from the memory
pool or pre-allocated to lie in .bss. This option selects pre-
allocated buffer memory.

config ZYNQ_GMAC_NBC
bool "No Broadcast"
default n
---help---
when set to logic one, frames addressed to the broadcast address of
all ones will not be accepted.

config ZYNQ_GMAC_PHYADDR
int "PHY address"
default 1
---help---
The 5-bit address of the PHY on the board. Default: 1

config ZYNQ_ENET_PHYINIT
bool "Board-specific PHY Initialization for ENET"
default y
---help---
Some boards require specialized initialization of the PHY before it
can be used. This may include such things as configuring GPIOs,
resetting the PHY, etc. If CONFIG_ZYNQ_ENET_PHYINIT is defined in
the configuration then the board specific logic must provide
zynq_phy_boardinitialize(); The ZYNQ ENET driver will call this
function one time before it first uses the PHY.

config ZYNQ_GMAC_AUTONEG
bool "Use autonegotiation"
default y
---help---
Use PHY autonegotiation to determine speed and mode

if !ZYNQ_GMAC_AUTONEG

config ZYNQ_GMAC_ETHFD
bool "Full duplex"
default n
---help---
If ZYNQ_GMAC_AUTONEG is not defined, then this may be defined to
select full duplex mode. Default: half-duplex

choice
prompt "GMAC Speed"
default ZYNQ_GMAC_ETH100MBPS
---help---
If autonegotiation is not used, then you must select the fixed speed
of the PHY

config ZYNQ_GMAC_ETH10MBPS
bool "10 Mbps"
---help---
If ZYNQ_GMAC_AUTONEG is not defined, then this may be defined to select 10 MBps
speed. Default: 100 Mbps

config ZYNQ_GMAC_ETH100MBPS
bool "100 Mbps"
---help---
If ZYNQ_GMAC_AUTONEG is not defined, then this may be defined to select 100 MBps
speed. Default: 100 Mbps

config ZYNQ_GMAC_ETH1000MBPS
bool "1000 Mbps"
---help---
If ZYNQ_GMAC_AUTONEG is not defined, then this may be defined to select 1000 MBps
speed. Default: 100 Mbps

endchoice # GMAC speed
endif # !ZYNQ_GMAC_AUTONEG

config ZYNQ_GMAC_REGDEBUG
bool "Register-Level Debug"
default n
depends on DEBUG_NET_INFO
---help---
Enable very low-level register access debug. Depends on CONFIG_DEBUG_NET_INFO.

endmenu # ZYNQ_ENET

endif # ARCH_CHIP_ZYNQ_MPSOC
4 changes: 4 additions & 0 deletions arch/arm64/src/zynq-mpsoc/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ CHIP_CSRCS = zynq_boot.c zynq_serial.c zynq_mio.c zynq_timer.c zynq_pll.c
ifeq ($(CONFIG_ARCH_EARLY_PRINT),y)
CHIP_ASRCS = zynq_lowputc.S
endif

ifeq ($(CONFIG_ZYNQ_ENET),y)
CHIP_CSRCS += zynq_enet.c
endif
Loading