[0/2] usb/phy: sunxi: Assert reset before deasserting on init

Message ID 20261117-usb-sunxi-reset-fix-v1-0-c2b76e0e84e1@roadbobek.com (mailing list archive)
Headers
Series usb/phy: sunxi: Assert reset before deasserting on init |

Message

Roadbobek via B4 Relay Nov. 17, 2026, 1 p.m. UTC
When a bootloader such as U-Boot (for example with
CONFIG_USB_MUSB_HOST=y) initializes USB host mode and boots Linux
without stopping USB first, both the MUSB controller and USB0 PHY
reset lines are already deasserted when Linux probes them.

Because reset_control_deassert() alone is a no-op on an already
deasserted reset line, stale hardware register state persists across
boot. On Allwinner A33, MUSB stays wedged in a_wait_bcon with
DevCtl=0x99, Power=0xf0, and a frozen Frame counter even across
hot-unplug and replug.

This two-patch series briefly asserts reset before deasserting it in
both drivers so USB starts cleanly regardless of prior bootloader state:

- Patch 1 asserts glue->rst in sunxi_musb_init().
- Patch 2 asserts phy->reset in sun4i_usb_phy_init().

Tested on an Allwinner A33 Q8 tablet (Laser MID-786).

Signed-off-by: Roadbobek <admin@roadbobek.com>
---
Roadbobek (2):
      usb: musb: sunxi: Assert reset before deasserting on init
      phy: sun4i-usb: Assert reset before deasserting in phy init

 drivers/phy/allwinner/phy-sun4i-usb.c | 2 ++
 drivers/usb/musb/sunxi.c              | 3 +++
 2 files changed, 5 insertions(+)
---
base-commit: 666539eecdf4db623f5e3c3e55cf9f2dfad24aa4
change-id: 20261117-usb-sunxi-reset-fix-d1a0001440a9

Best regards,
--  
Roadbobek <admin@roadbobek.com>
  

Comments

Philipp Zabel Nov. 17, 2026, 1:04 p.m. UTC | #1
On Di, 2026-11-17 at 13:00 +0000, Roadbobek via B4 Relay wrote:
> When a bootloader such as U-Boot (for example with
> CONFIG_USB_MUSB_HOST=y) initializes USB host mode and boots Linux
> without stopping USB first, both the MUSB controller and USB0 PHY
> reset lines are already deasserted when Linux probes them.
> 
> Because reset_control_deassert() alone is a no-op on an already
> deasserted reset line, stale hardware register state persists across
> boot. On Allwinner A33, MUSB stays wedged in a_wait_bcon with
> DevCtl=0x99, Power=0xf0, and a frozen Frame counter even across
> hot-unplug and replug.
> 
> This two-patch series briefly asserts reset before deasserting it in
> both drivers so USB starts cleanly regardless of prior bootloader state:
> 
> - Patch 1 asserts glue->rst in sunxi_musb_init().
> - Patch 2 asserts phy->reset in sun4i_usb_phy_init().

While you are at it, could you also replace the
devm_reset_control_get() calls with devm_reset_control_get_exclusive(),
to make it clear the driver requires exclusive access to assert the
resets?

regards
Philipp