diff options
| author | Jacob Potter <[email protected]> | 2020-10-18 16:55:14 -0600 |
|---|---|---|
| committer | Jacob Potter <[email protected]> | 2020-10-18 17:01:17 -0600 |
| commit | c87ed8eff1ac1305f69dd83144890f5a6f752a6f (patch) | |
| tree | 6fbe0a68264e513274d34b537885c7eaf8d1eb02 /src | |
| parent | 43cb5fabfd6d0fca749e9512cc2061deab0adafd (diff) | |
Allow use of internal FS PHY on OTG_HS interface
Some ST parts (like STM32F74xxx / STM32F75xxx) allow the USB_OTG_HS core to be used with
either an external high-speed ULPI PHY or an internal full-speed-only (12mbps) PHY. Currently
the code assumes than an ULPI PHY is used unless the chip has an internal high-speed PHY
(`#if defined(USB_HS_PHYC)`), with no provision to use the internal FS PHY.
Diffstat (limited to 'src')
| -rw-r--r-- | src/portable/st/synopsys/dcd_synopsys.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/portable/st/synopsys/dcd_synopsys.c b/src/portable/st/synopsys/dcd_synopsys.c index ca306ff8f..11678857c 100644 --- a/src/portable/st/synopsys/dcd_synopsys.c +++ b/src/portable/st/synopsys/dcd_synopsys.c @@ -416,7 +416,9 @@ void dcd_init (uint8_t rhport) if ( rhport == 1 ) { // On selected MCUs HS port1 can be used with external PHY via ULPI interface - +#if defined(TUD_OPT_SYNOPSYS_FS_PHY) + usb_otg->GUSBCFG |= USB_OTG_GUSBCFG_PHYSEL; +#else // deactivate internal PHY usb_otg->GCCFG &= ~USB_OTG_GCCFG_PWRDWN; @@ -425,6 +427,7 @@ void dcd_init (uint8_t rhport) // Select default internal VBUS Indicator and Drive for ULPI usb_otg->GUSBCFG &= ~(USB_OTG_GUSBCFG_ULPIEVBUSD | USB_OTG_GUSBCFG_ULPIEVBUSI); +#endif #if defined(USB_HS_PHYC) // Highspeed with embedded UTMI PHYC @@ -467,8 +470,13 @@ void dcd_init (uint8_t rhport) set_speed(rhport, TUD_OPT_HIGH_SPEED ? TUSB_SPEED_HIGH : TUSB_SPEED_FULL); - // Enable internal USB transceiver. + // Enable internal USB transceiver. Unconditional if using FS PHY on HS core. +#if defined(TUD_OPT_SYNOPSYS_FS_PHY) + usb_otg->GCCFG |= USB_OTG_GCCFG_PWRDWN; +#else if ( rhport == 0 ) usb_otg->GCCFG |= USB_OTG_GCCFG_PWRDWN; +#endif + usb_otg->GINTMSK |= USB_OTG_GINTMSK_USBRST | USB_OTG_GINTMSK_ENUMDNEM | USB_OTG_GINTMSK_USBSUSPM | USB_OTG_GINTMSK_WUIM | |
