Re: [PATCH v2] usb: port: add delay after usb_hub_set_port_power()

From: Xu Yang

Date: Thu Feb 26 2026 - 05:58:43 EST


On Wed, Feb 25, 2026 at 10:17:43AM -0500, Alan Stern wrote:
> >
> > For ports which VBUS are not controlled by PORTSC.PP (always on VBUS
> > regulator or Type-C controlled VBUS), they are still powered on after
> > you disable the ports. This will cause PORTSC.CCS still be set after it.
>
> That is arguably a hardware bug. According to section 11.5.1.2 of the
> USB-2 spec, when a port is in the powered-off state its transmitters and
> receivers are disabled. This implies that it is unable to tell whether
> a device is connected, so PORTSC.CCS should be clear.

Thanks for the information! I'll check the HW behavior with designer.

>
> > When usb_autopm_get_interface() gets called, hub_resume will check CCS
> > bit and check new connection again. So you see new device is reported.
> >
> > Below patch will be a workaround for the issue when you disable the port
> > many times:
> > https://lore.kernel.org/linux-usb/20260223-v6-16-topic-usb-onboard-dev-v5-1-28d3018a8026@xxxxxxxxxxxxxx/
> >
> > However, it will still report new device when you "cat usb1-port1/disable".
> > To fix the issue completely, I guess the usb core needs some sync with the
> > port disabled state.
>
> Another patch on top of the one you mentioned should be straigtforward.
> Feel like writing one? All it has to do is make the hub driver skip
> handling connect-status changes for disabled ports.o

That patchset haven't been merged. I might be able to do this sometime in
the future.

I just have a simple test, to skip handling connect-status changes is easy,
but to make it work again (echo 0 > disable) is problematic because
when usb_autopm_get_interface() is executed the disabled flag is still true
(so the hub will still skip handling connect-status changes) and the port
won't generate connect change event given the HW is buggy.

Thanks,
Xu Yang