USB: add quirks to XHCI

While XHCI is very generic some revisions of chipsets have problems.
On dwc3 <= 3.00a Port Disable does not seem to work so we need to not
enable it.
For that introduce quirks to xhci so that controllers can steer
certain features.  I would hope that this is and remains the only one.

Obtained from:	an old patch mainly debugging other problems
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D35482
This commit is contained in:
Bjoern A. Zeeb 2022-06-14 16:39:31 +00:00
parent 799051e2ca
commit 447c418da0
2 changed files with 9 additions and 1 deletions

View file

@ -3392,7 +3392,8 @@ xhci_roothub_exec(struct usb_device *udev,
XWRITE4(sc, oper, port, v | XHCI_PS_PRC);
break;
case UHF_PORT_ENABLE:
XWRITE4(sc, oper, port, v | XHCI_PS_PED);
if ((sc->sc_quirks & XHCI_QUIRK_DISABLE_PORT_PED) == 0)
XWRITE4(sc, oper, port, v | XHCI_PS_PED);
break;
case UHF_PORT_POWER:
XWRITE4(sc, oper, port, v & ~XHCI_PS_PP);

View file

@ -487,6 +487,10 @@ union xhci_hub_desc {
typedef int (xhci_port_route_t)(device_t, uint32_t, uint32_t);
enum xhci_quirks {
XHCI_QUIRK_DISABLE_PORT_PED = 0x00000001,
};
struct xhci_softc {
struct xhci_hw_softc sc_hw;
/* base device */
@ -563,6 +567,9 @@ struct xhci_softc {
/* vendor string for root HUB */
char sc_vendor[16];
/* XHCI quirks. */
uint32_t sc_quirks;
};
#define XHCI_CMD_LOCK(sc) sx_xlock(&(sc)->sc_cmd_sx)