usb-designware: allow setting FDMOD bit to force device mode
rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
| Newsgroups | gmane.comp.systems.archos.rockbox.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 5dd2756b149c19032d310584249de6edfbd65907 Author: Aidan MacDonald <[email protected]> Date: Thu Jan 8 00:32:48 2026 +0000 usb-designware: allow setting FDMOD bit to force device mode If the PHY doesn't correctly report the ID pin state, then the DWC2 core may operate in host mode by default. Defining USB_DW_FORCE_DEVICE_MODE in the target config will set the FDMOD bit in the GUSBCFG register to force the core into device mode regardless of what the PHY reports. Change-Id: If2391aaa4a7c65ba6c90dd56074faeb3ed1ac2ca diff --git a/firmware/drivers/usb-designware.c b/firmware/drivers/usb-designware.c index d892b91efb..7078a571ac 100644 --- a/firmware/drivers/usb-designware.c +++ b/firmware/drivers/usb-designware.c @@ -87,6 +87,12 @@ #define USB_DW_TOUTCAL 0 #endif +#ifdef USB_DW_FORCE_DEVICE_MODE +#define USB_DW_FORCED_MODE FDMOD +#else +#define USB_DW_FORCED_MODE 0 +#endif + #define GET_DTXFNUM(ep) ((DWC_DIEPCTL(ep)>>22) & 0xf) #define USB_DW_NUM_DIRS 2 @@ -1417,7 +1423,7 @@ static void usb_dw_init(void) */ int USB_DW_TURNAROUND = (c->phytype == DWC_PHYTYPE_UTMI_16) ? 5 : 9; #endif - uint32_t gusbcfg = c->phytype|TRDT(USB_DW_TURNAROUND)|USB_DW_TOUTCAL; + uint32_t gusbcfg = c->phytype|TRDT(USB_DW_TURNAROUND)|USB_DW_TOUTCAL|USB_DW_FORCED_MODE; DWC_GUSBCFG = gusbcfg; /* Reset the whole USB core */ -- rockbox-cvs mailing list [email protected] https://lists.haxx.se/mailman/listinfo/rockbox-cvs