aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2016-06-04 14:25:28 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2016-06-04 14:25:28 +0000
commite0251cf96666b1096ca0aa539d6fba785809e412 (patch)
tree8afebf38acc7d911d1e213be85957932f6826b8d /os
parentec871b0ef13545688ddd140520bb49baacb4283a (diff)
downloadChibiOS-e0251cf96666b1096ca0aa539d6fba785809e412.tar.gz
ChibiOS-e0251cf96666b1096ca0aa539d6fba785809e412.tar.bz2
ChibiOS-e0251cf96666b1096ca0aa539d6fba785809e412.zip
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
Diffstat (limited to 'os')
-rw-r--r--os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c14
-rw-r--r--os/hal/ports/STM32/LLD/OTGv1/stm32_otg.h4
2 files changed, 15 insertions, 3 deletions
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. */
/** @} */