From e0251cf96666b1096ca0aa539d6fba785809e412 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 4 Jun 2016 14:25:28 +0000 Subject: Handling different STM32 OTG variants through registry. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9569 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c | 14 +++++++++++--- os/hal/ports/STM32/LLD/OTGv1/stm32_otg.h | 4 ++++ 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'os/hal/ports/STM32/LLD/OTGv1') diff --git a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c index 33dc0a9bd..e4dc04c7c 100644 --- a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c +++ b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c @@ -38,9 +38,7 @@ #define EP0_MAX_INSIZE 64 #define EP0_MAX_OUTSIZE 64 -#if defined(STM32F7XX) -#define GCCFG_INIT_VALUE GCCFG_PWRDWN -#else +#if STM32_OTG_STEPPING == 1 #if defined(BOARD_OTG_NOVBUSSENS) #define GCCFG_INIT_VALUE (GCCFG_NOVBUSSENS | GCCFG_VBUSASEN | \ GCCFG_VBUSBSEN | GCCFG_PWRDWN) @@ -48,6 +46,16 @@ #define GCCFG_INIT_VALUE (GCCFG_VBUSASEN | GCCFG_VBUSBSEN | \ GCCFG_PWRDWN) #endif + +#elif STM32_OTG_STEPPING == 2 +#if defined(BOARD_OTG_NOVBUSSENS) +#define GCCFG_INIT_VALUE GCCFG_PWRDWN +#else +#define GCCFG_INIT_VALUE (GCCFG_VBDEN | GCCFG_PWRDWN) +#endif + +#else +#error "unsupported STM32_OTG_STEPPING" #endif /*===========================================================================*/ diff --git a/os/hal/ports/STM32/LLD/OTGv1/stm32_otg.h b/os/hal/ports/STM32/LLD/OTGv1/stm32_otg.h index c50226079..82c843083 100644 --- a/os/hal/ports/STM32/LLD/OTGv1/stm32_otg.h +++ b/os/hal/ports/STM32/LLD/OTGv1/stm32_otg.h @@ -429,12 +429,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. */ /** @} */ -- cgit v1.2.3