From 580af16b82c465835801102fe1879f7fffa3296a Mon Sep 17 00:00:00 2001 From: Nicolas Reinecke Date: Mon, 14 Nov 2016 01:33:46 +0100 Subject: usbh: add otg stepping 2 code --- os/hal/ports/STM32/LLD/USBHv1/hal_stm32_otg.h | 4 ++++ os/hal/ports/STM32/LLD/USBHv1/hal_usbh_lld.c | 8 ++++++++ 2 files changed, 12 insertions(+) (limited to 'os/hal/ports') diff --git a/os/hal/ports/STM32/LLD/USBHv1/hal_stm32_otg.h b/os/hal/ports/STM32/LLD/USBHv1/hal_stm32_otg.h index a0594a3..3322e51 100644 --- a/os/hal/ports/STM32/LLD/USBHv1/hal_stm32_otg.h +++ b/os/hal/ports/STM32/LLD/USBHv1/hal_stm32_otg.h @@ -430,12 +430,16 @@ typedef struct { * @name GCCFG register bit definitions * @{ */ +/* Definitions for stepping 1.*/ #define GCCFG_NOVBUSSENS (1U<<21) /**< VBUS sensing disable. */ #define GCCFG_SOFOUTEN (1U<<20) /**< SOF output enable. */ #define GCCFG_VBUSBSEN (1U<<19) /**< Enable the VBUS sensing "B" device. */ #define GCCFG_VBUSASEN (1U<<18) /**< Enable the VBUS sensing "A" device. */ + +/* Definitions for stepping 2.*/ +#define GCCFG_VBDEN (1U<<21) /**< VBUS sensing enable. */ #define GCCFG_PWRDWN (1U<<16) /**< Power down. */ /** @} */ diff --git a/os/hal/ports/STM32/LLD/USBHv1/hal_usbh_lld.c b/os/hal/ports/STM32/LLD/USBHv1/hal_usbh_lld.c index 0618d83..523f14d 100644 --- a/os/hal/ports/STM32/LLD/USBHv1/hal_usbh_lld.c +++ b/os/hal/ports/STM32/LLD/USBHv1/hal_usbh_lld.c @@ -1386,12 +1386,20 @@ static void _usbh_start(USBHDriver *usbh) { otgp->PCGCCTL = 0; /* Internal FS PHY activation.*/ +#if STM32_OTG_STEPPING == 1 #if defined(BOARD_OTG_NOVBUSSENS) otgp->GCCFG = GCCFG_NOVBUSSENS | GCCFG_PWRDWN; #else otgp->GCCFG = GCCFG_PWRDWN; #endif +#elif STM32_OTG_STEPPING == 2 +#if defined(BOARD_OTG_NOVBUSSENS) + otgp->GCCFG = GCCFG_PWRDWN; +#else + otgp->GCCFG = (GCCFG_VBDEN | GCCFG_PWRDWN); +#endif +#endif /* 48MHz 1.1 PHY.*/ otgp->HCFG = HCFG_FSLSS | HCFG_FSLSPCS_48; -- cgit v1.2.3