summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/stm32
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-07 16:04:10 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-07 16:04:10 +0000
commit9397638e24a683c5b60217ea244494b0d2c69e20 (patch)
tree5b83137696b03b5746c536ed0cd3940e22be2e79 /nuttx/arch/arm/src/stm32
parent55454ea9734edb08e0323251b43887dd6704fbd4 (diff)
downloadpx4-nuttx-9397638e24a683c5b60217ea244494b0d2c69e20.tar.gz
px4-nuttx-9397638e24a683c5b60217ea244494b0d2c69e20.tar.bz2
px4-nuttx-9397638e24a683c5b60217ea244494b0d2c69e20.zip
STM32 OTG FS device fix from Petteri Aimonen
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5318 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/stm32')
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_otgfsdev.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c b/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c
index 461d500ad..2d6ca9831 100644
--- a/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c
+++ b/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c
@@ -3900,7 +3900,7 @@ static void stm32_epout_disable(FAR struct stm32_ep_s *privep)
* Name: stm32_epin_disable
*
* Description:
- * Diable an IN endpoint will no longer be used
+ * Disable an IN endpoint when it will no longer be used
*
*******************************************************************************/
@@ -3912,6 +3912,17 @@ static void stm32_epin_disable(FAR struct stm32_ep_s *privep)
usbtrace(TRACE_EPDISABLE, privep->epphy);
+ /* After USB reset, the endpoint will already be deactivated by the
+ * hardware. Trying to disable again will just hang in the wait.
+ */
+
+ regaddr = STM32_OTGFS_DIEPCTL(privep->epphy);
+ regval = stm32_getreg(regaddr);
+ if ((regval & OTGFS_DIEPCTL_USBAEP) == 0)
+ {
+ return;
+ }
+
/* Make sure that there is no pending IPEPNE interrupt (because we are
* to poll this bit below).
*/