aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-02-19 21:26:39 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-02-19 21:26:39 +0000
commit70396f662803b858d1bccabf15e4f727aba057bc (patch)
tree720900e7bb8e8c8d67d6a314e0caada93d0c57ff /os/hal/platforms/STM32
parent3f2f6885cf7a0e4bd29458d6be5fb393e102ea60 (diff)
downloadChibiOS-70396f662803b858d1bccabf15e4f727aba057bc.tar.gz
ChibiOS-70396f662803b858d1bccabf15e4f727aba057bc.tar.bz2
ChibiOS-70396f662803b858d1bccabf15e4f727aba057bc.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5283 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32')
-rw-r--r--os/hal/platforms/STM32/OTGv1/stm32_otg.h2
-rw-r--r--os/hal/platforms/STM32/OTGv1/usb_lld.c85
-rw-r--r--os/hal/platforms/STM32/OTGv1/usb_lld.h14
3 files changed, 16 insertions, 85 deletions
diff --git a/os/hal/platforms/STM32/OTGv1/stm32_otg.h b/os/hal/platforms/STM32/OTGv1/stm32_otg.h
index 9a28c7f08..842ec80ea 100644
--- a/os/hal/platforms/STM32/OTGv1/stm32_otg.h
+++ b/os/hal/platforms/STM32/OTGv1/stm32_otg.h
@@ -238,7 +238,6 @@ typedef struct {
#define GUSBCFG_CTXPKT (1U<<31) /**< Corrupt Tx packet. */
#define GUSBCFG_FDMOD (1U<<30) /**< Force Device Mode. */
#define GUSBCFG_FHMOD (1U<<29) /**< Force Host Mode. */
-#define GUSBCFG_ULPIEVBUSD (1U<<20) /**< ULPI External VBUS Drive */
#define GUSBCFG_TRDT_MASK (15U<<10) /**< USB Turnaround time field
mask. */
#define GUSBCFG_TRDT(n) ((n)<<10) /**< USB Turnaround time field
@@ -680,7 +679,6 @@ typedef struct {
#define DSTS_ENUMSPD_MASK (3U<<1) /**< Enumerated speed mask. */
#define DSTS_ENUMSPD_FS_48 (3U<<1) /**< Full speed (PHY clock is
running at 48 MHz). */
-#define DSTS_ENUMSPD_HS_480 (0U<<1) /**< High speed */
#define DSTS_SUSPSTS (1U<<0) /**< Suspend status. */
/** @} */
diff --git a/os/hal/platforms/STM32/OTGv1/usb_lld.c b/os/hal/platforms/STM32/OTGv1/usb_lld.c
index 0ee3a563f..1bb29beae 100644
--- a/os/hal/platforms/STM32/OTGv1/usb_lld.c
+++ b/os/hal/platforms/STM32/OTGv1/usb_lld.c
@@ -37,8 +37,7 @@
/* Driver local definitions. */
/*===========================================================================*/
-#define TRDT_VALUE 5
-#define TRDT_HS_VALUE 9
+#define TRDT_VALUE 5
/*===========================================================================*/
/* Driver exported variables. */
@@ -606,28 +605,11 @@ static void otg_epout_handler(USBDriver *usbp, usbep_t ep) {
*/
static void usb_lld_serve_interrupt(USBDriver *usbp) {
stm32_otg_t *otgp = usbp->otg;
- uint32_t sts, src, dsts_enumspd;
+ uint32_t sts, src;
sts = otgp->GINTSTS & otgp->GINTMSK;
- /* Writing 1's to this register clears those respective interrupt flags.*/
otgp->GINTSTS = sts;
- if (sts & GINTSTS_WKUPINT) {
- /* If clocks are gated off, turn them back on (may be the case if coming out
- of suspend mode).*/
- if (otgp->PCGCCTL & (PCGCCTL_STPPCLK | PCGCCTL_GATEHCLK)) {
- /* Set to zero to un-gate the USB core clocks.*/
- otgp->PCGCCTL &= ~(PCGCCTL_STPPCLK | PCGCCTL_GATEHCLK);
- }
-
- /* Clear the Remote Wake-up Signaling */
- otgp->DCTL |= DCTL_RWUSIG;
- }
-
- if (sts & GINTSTS_USBSUSP) {
- /* Implement suspend mode.*/
- }
-
/* Reset interrupt handling.*/
if (sts & GINTSTS_USBRST) {
_usb_reset(usbp);
@@ -636,13 +618,7 @@ static void usb_lld_serve_interrupt(USBDriver *usbp) {
/* Enumeration done.*/
if (sts & GINTSTS_ENUMDNE) {
- /* Full or High speed timing selection */
- dsts_enumspd = (otgp->DSTS & DSTS_ENUMSPD_MASK);
- if( dsts_enumspd == DSTS_ENUMSPD_HS_480 ) {
- otgp->GUSBCFG = (otgp->GUSBCFG & ~(GUSBCFG_TRDT_MASK)) | GUSBCFG_TRDT(TRDT_HS_VALUE);
- } else {
- otgp->GUSBCFG = (otgp->GUSBCFG & ~(GUSBCFG_TRDT_MASK)) | GUSBCFG_TRDT(TRDT_VALUE);
- }
+ (void)otgp->DSTS;
}
/* SOF interrupt handling.*/
@@ -882,13 +858,6 @@ void usb_lld_start(USBDriver *usbp) {
#if STM32_USB_USE_OTG2
if (&USBD2 == usbp) {
/* OTG HS clock enable and reset.*/
-#if STM32_USE_USB_OTG2_ULPI
- rccEnableAHB1((RCC_AHB1ENR_GPIOAEN | RCC_AHB1ENR_GPIOBEN |
- RCC_AHB1ENR_GPIOCEN | RCC_AHB1ENR_GPIOHEN |
- RCC_AHB1ENR_GPIOIEN),
- FALSE);
- rccEnableAHB1(RCC_AHB1ENR_OTGHSULPIEN, FALSE);
-#endif
rccEnableOTG_HS(FALSE);
rccResetOTG_HS();
@@ -909,36 +878,18 @@ void usb_lld_start(USBDriver *usbp) {
usbp);
/* - Forced device mode.
- - USB turn-around time = TRDT_VALUE.*/
-#if STM32_USE_USB_OTG2_ULPI
- /* High speed ULPI PHY */
- otgp->GUSBCFG = GUSBCFG_FDMOD | GUSBCFG_TRDT(TRDT_VALUE) | GUSBCFG_SRPCAP | GUSBCFG_HNPCAP;
-#else
- /* - Full Speed 1.1 PHY.*/
+ - USB turn-around time = TRDT_VALUE.
+ - Full Speed 1.1 PHY.*/
otgp->GUSBCFG = GUSBCFG_FDMOD | GUSBCFG_TRDT(TRDT_VALUE) | GUSBCFG_PHYSEL;
-#endif
-#if STM32_USE_USB_OTG2_HS
- /* USB 2.0 High Speed PHY.*/
- otgp->DCFG = 0x02200000 | DCFG_DSPD_HS;
-#else
/* 48MHz 1.1 PHY.*/
otgp->DCFG = 0x02200000 | DCFG_DSPD_FS11;
-#endif
/* PHY enabled.*/
otgp->PCGCCTL = 0;
- if (&USBD2 == usbp) {
-#if STM32_USE_USB_OTG2_ULPI
- otgp->GCCFG = 0;
-#else
- otgp->GCCFG = GCCFG_VBUSASEN | GCCFG_VBUSBSEN | GCCFG_PWRDWN;
-#endif
- } else {
- /* Internal FS PHY activation.*/
- otgp->GCCFG = GCCFG_VBUSASEN | GCCFG_VBUSBSEN | GCCFG_PWRDWN;
- }
+ /* Internal FS PHY activation.*/
+ otgp->GCCFG = GCCFG_VBUSASEN | GCCFG_VBUSBSEN | GCCFG_PWRDWN;
/* Soft core reset.*/
otg_core_reset(usbp);
@@ -954,13 +905,12 @@ void usb_lld_start(USBDriver *usbp) {
otgp->DIEPMSK = 0;
otgp->DOEPMSK = 0;
otgp->DAINTMSK = 0;
- if (usbp->config->sof_cb == NULL) {
- otgp->GINTMSK = GINTMSK_ENUMDNEM | GINTMSK_USBRSTM | GINTMSK_USBSUSPM |
- GINTMSK_ESUSPM | GINTMSK_SRQM | GINTMSK_WKUM;
- } else {
- otgp->GINTMSK = GINTMSK_ENUMDNEM | GINTMSK_USBRSTM | GINTMSK_USBSUSPM |
- GINTMSK_ESUSPM | GINTMSK_SRQM | GINTMSK_WKUM | GINTMSK_SOFM;
- }
+ if (usbp->config->sof_cb == NULL)
+ otgp->GINTMSK = GINTMSK_ENUMDNEM | GINTMSK_USBRSTM /*| GINTMSK_USBSUSPM |
+ GINTMSK_ESUSPM |*/;
+ else
+ otgp->GINTMSK = GINTMSK_ENUMDNEM | GINTMSK_USBRSTM /*| GINTMSK_USBSUSPM |
+ GINTMSK_ESUSPM */ | GINTMSK_SOFM;
otgp->GINTSTS = 0xFFFFFFFF; /* Clears all pending IRQs, if any. */
/* Global interrupts enable.*/
@@ -987,20 +937,17 @@ void usb_lld_stop(USBDriver *usbp) {
otgp->GAHBCFG = 0;
otgp->GCCFG = 0;
-#if STM32_USB_USE_OTG1
+#if STM32_USB_USE_USB1
if (&USBD1 == usbp) {
nvicDisableVector(STM32_OTG1_NUMBER);
rccDisableOTG1(FALSE);
}
#endif
-#if STM32_USB_USE_OTG2
+#if STM32_USB_USE_USB2
if (&USBD2 == usbp) {
nvicDisableVector(STM32_OTG2_NUMBER);
- rccDisableOTG_HS(FALSE);
-#if STM32_USE_USB_OTG2_ULPI
- rccDisableAHB1(RCC_AHB1ENR_OTGHSULPIEN, FALSE);
-#endif
+ rccDisableOTG2(FALSE);
}
#endif
}
diff --git a/os/hal/platforms/STM32/OTGv1/usb_lld.h b/os/hal/platforms/STM32/OTGv1/usb_lld.h
index 77b8d27aa..1ab3c0f0c 100644
--- a/os/hal/platforms/STM32/OTGv1/usb_lld.h
+++ b/os/hal/platforms/STM32/OTGv1/usb_lld.h
@@ -74,20 +74,6 @@
#endif
/**
- * @brief High Speed support for OTG-HS.
- */
-#if !defined(STM32_USE_USB_OTG2_HS) || defined(__DOXYGEN__)
-#define STM32_USE_USB_OTG2_HS FALSE
-#endif
-
-/**
- * @brief ULPI support for OTG-HS.
- */
-#if !defined(STM32_USE_USB_OTG2_ULPI) || defined(__DOXYGEN__)
-#define STM32_USE_USB_OTG2_ULPI FALSE
-#endif
-
-/**
* @brief OTG1 interrupt priority level setting.
*/
#if !defined(STM32_USB_OTG1_IRQ_PRIORITY) || defined(__DOXYGEN__)