Skip to content

uboot: inject per-board ETH PHY reset GPIO from thingino.json - #1539

Open
WLTB-Gino wants to merge 2 commits into
themactep:masterfrom
WLTB-Gino:fix/uboot-eth-phy-reset
Open

uboot: inject per-board ETH PHY reset GPIO from thingino.json#1539
WLTB-Gino wants to merge 2 commits into
themactep:masterfrom
WLTB-Gino:fix/uboot-eth-phy-reset

Conversation

@WLTB-Gino

Copy link
Copy Markdown
Contributor

The problem

The 2026.07 dwmac_ingenic driver takes the wired-Ethernet PHY reset line from the gmac DT node's ingenic,reset-gpio property. The per-SoC .dtsi can only carry the ISVP reference default (PB28, active-low) - right for the reference board and wrong for most cameras, and there was no per-board override mechanism. Boards whose reset pin differs (e.g. the Jooan Q3R, GPIO 64 / GPC0) never had their line driven: the reset only happens when the property is present, so the PHY comes out of a prior boot in whatever state the last user left it.

Meanwhile the board carried its pin via the legacy CONFIG_GPIO_PHY_RESET make opts + local patch - a mechanism that is dead on the 2026.07 tree (CONFIG_GPIO_PHY_RESET doesn't exist there), so the knob silently stopped working when U-Boot moved to 2026.07.

Boards with no reset line wired at all are NOT supposed to get a random GPIO driven: the upstream driver added an MDIO BMCR soft-reset fallback exactly for them, and a GPIO pointing at an unrelated pin would actively break them. So the injector only acts when the board declares the key.

The change

inject-uboot-eth-dt.sh (in the pattern of inject-uboot-audio-dt.sh): when the board's thingino.json declares gpio.eth_phy_reset (object {pin, active_low}, or a bare int = active-low), rewrite the gmac node's ingenic,reset-gpio in the board's U-Boot leaf .dts at build time. Boards without the key (or without a GMAC node) are left untouched, so every other board is unaffected.

Also:

  • the legacy CONFIG_GPIO_PHY_RESET make opts are gated to the 2013.07 tree they belong to (no behavior change - they were already no-ops on 2026.07)
  • the kconfig symbols are depends on BR2_THINGINO_UBOOT_VERSION_2013_07, so a future board cannot pick the dead knobs again
  • jooan_q3r declares gpio.eth_phy_reset {pin: 64, active_low: true} and drops the dead defconfig lines + local patch

Testing

  • shellcheck + shfmt clean; pre-commit hooks pass
  • injector exercised standalone on a synthetic leaf: object form → &gpc 0 1, bare int → &gpb 28 1, no key → no-op, no gmac node → clean exit
  • not device-tested: needs a Q3R (or another wired-Ethernet board) build + boot to confirm the PHY reset line waveform and link coming up

Real-world validation on hardware is welcome - if someone with a Q3R could build and confirm the RMII link behaves, that would close the loop.

WLTB Gino added 2 commits August 24, 2026 11:54
The 2026.07 dwmac_ingenic driver takes the wired-Ethernet PHY reset
line from the gmac DT node's ingenic,reset-gpio property, which the
per-SoC .dtsi can only carry as the ISVP reference default (PB28,
active-low) - right for the reference board and wrong for most
cameras. Boards whose reset pin differs had no way to override it, so
the driver never toggled their line and some PHYs came out of a prior
boot without a completed reset (intermittent RMII link). Boards with
no line wired at all depend on the driver's MDIO BMCR soft-reset
fallback, so a GPIO pointing at an unrelated pin would actively break
them.

Add inject-uboot-eth-dt.sh, in the pattern of inject-uboot-audio-dt.sh:
when the board's thingino.json declares gpio.eth_phy_reset (object
{pin, active_low}, or a bare int meaning active-low), rewrite the gmac
node's ingenic,reset-gpio to that pin/polarity in the board's U-Boot
leaf .dts at build time. Boards without the key (or without a GMAC
node) are left untouched.

Also gate the legacy CONFIG_GPIO_PHY_RESET make opts to the 2013.07
tree they belong to (the 2026.07 tree has no such config), and mark
the corresponding kconfig symbols depends on the 2013.07 version
choice, so a future board cannot pick the dead knobs again.
The Q3R resets its Ethernet PHY through GPIO 64 (GPC0), active-low.
The board used to carry that via the legacy 2013.07-only
CONFIG_GPIO_PHY_RESET make opts plus a local U-Boot patch - both dead
on the 2026.07 tree, so the line was never driven and the PHY came up
flaky. Declare it as gpio.eth_phy_reset in thingino.json, which the
new injector turns into ingenic,reset-gpio = <&gpc 0 GPIO_ACTIVE_LOW>
in the board's U-Boot device tree, and drop the dead defconfig lines
and patch.
@themactep

Copy link
Copy Markdown
Owner

no, we should not mix a userland config into uboot configuration. we need a per-camera dtsi fragments that would define these settings.

@jmertic

jmertic commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

ok @themactep - is there a pattern I could see to replicate what you are suggesting? Happy to take a stab at this.

@themactep

Copy link
Copy Markdown
Owner

You need to coordinate with @gtxaspec on that, he is working on changes to dts right now.

@gtxaspec

Copy link
Copy Markdown
Collaborator

I've got some changes in progress, i'll touch base here when ready @jmertic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants