mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
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.
This commit is contained in:
parent
43cb5fabfd
commit
c87ed8eff1
@ -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 |
|
||||
|
Loading…
x
Reference in New Issue
Block a user