Add optional ZynqMP PHY init over GEM MDIO#829
Open
dgarske wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in mechanism for ZynqMP targets to perform early Ethernet PHY register initialization via the Cadence GEM MDIO management interface, allowing wolfBoot to replace the “U-Boot pre-init” role on boards that require it before the OS starts.
Changes:
- Introduces a configurable PHY init step table and minimal GEM MDIO read/write helpers, executed from
hal_init()when enabled. - Documents the feature and adds commented enablement/override examples in ZynqMP config templates.
- Extends CI reusable workflow inputs to allow passing extra CFLAGS, and adds a build job that compiles with the PHY-init flag enabled.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
hal/zynq.h |
Adds GEM MDIO/PHY-init configuration macros and default step sequence behind WOLFBOOT_ZYNQMP_PHY_INIT. |
hal/zynq.c |
Implements the minimal MDIO engine and runs the configurable init sequence during hal_init(). |
docs/Targets.md |
Documents how to enable/configure the optional ZynqMP PHY init feature. |
config/examples/zynqmp.config |
Adds commented example flags/overrides for enabling PHY init. |
config/examples/zynqmp_sdcard.config |
Adds commented example flags/overrides for enabling PHY init (sdcard config). |
.github/workflows/test-configs.yml |
Adds a CI job that builds ZynqMP with WOLFBOOT_ZYNQMP_PHY_INIT enabled. |
.github/workflows/test-build-aarch64.yml |
Adds an extra-cflags input and appends it into .config during CI builds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+436
to
+439
| * "mii"/"mw" commands) can configure the PHY before the OS starts. Every | ||
| * magic value below is behind an #ifndef so a board can override it from | ||
| * CFLAGS_EXTRA. Register layout mirrors the Cadence GEM in wolfIP | ||
| * (src/port/amd/common/gem_regs.h). */ |
Comment on lines
+1697
to
+1700
| /* Enable the MDIO management port with a safe MDC divisor. */ | ||
| GEM_NWCFG = (GEM_NWCFG & ~(0x7UL << GEM_NWCFG_MDCDIV_SHIFT)) | ||
| | ((uint32_t)ZYNQMP_GEM_MDC_DIV << GEM_NWCFG_MDCDIV_SHIFT); | ||
| GEM_NWCTRL |= GEM_NWCTRL_MDEN; |
Comment on lines
+1682
to
+1685
| /* Run the configurable PHY init sequence (default: the board's U-Boot flow). | ||
| * Best-effort: MDIO errors are reported but never block boot. */ | ||
| void zynq_phy_init(void) | ||
| { |
Comment on lines
93
to
+98
| - name: Select config | ||
| run: | | ||
| cp ${{inputs.config-file}} .config | ||
| if [ -n "${{inputs.extra-cflags}}" ]; then | ||
| echo "CFLAGS_EXTRA+=${{inputs.extra-cflags}}" >> .config | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets wolfBoot configure the Ethernet PHY on ZynqMP boards where U-Boot would normally do it (via
mii/mw) before the OS runs. wolfBoot has no network stack, so this drives only the GEM MDIO management plane -- enough to replay a board's PHY register sequence and leave the PHY ready for the OS.CFLAGS_EXTRA+=-DWOLFBOOT_ZYNQMP_PHY_INIT(off by default; commented example inconfig/examples/zynqmp.config).hal_init(): brings up MDIO, then walks a configurable{op, arg0, arg1}step table (GPIO poke / MDIO write / MDIO read). Best-effort -- errors are logged, never block boot.0x0Eon GEM3 plus a PL AXI-GPIO reset at0x80060000. All values overridable fromCFLAGS_EXTRA:ZYNQMP_GEM_BASE,ZYNQMP_PHY_ADDR,ZYNQMP_PHY_GPIO_ADDR(0skips the poke),ZYNQMP_GEM_MDC_DIV,ZYNQMP_PHY_INIT_STEPS.