diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-08-25 08:57:35 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-08-25 08:57:35 -0600 |
commit | b1482777e08ffb43c5e695bb0b756169bda09382 (patch) | |
tree | 5602ed026f377680426854da97f759cccb5b4d0a | |
parent | 6421955438db710068cd183201e3be9b8e0b9c97 (diff) | |
download | nuttx-b1482777e08ffb43c5e695bb0b756169bda09382.tar.gz nuttx-b1482777e08ffb43c5e695bb0b756169bda09382.tar.bz2 nuttx-b1482777e08ffb43c5e695bb0b756169bda09382.zip |
SAMA5 OHCI: Fix semaphore handling bug. OHCI is now function by itself again after changes to integrate with EHCI
-rw-r--r-- | nuttx/ChangeLog | 3 | ||||
-rw-r--r-- | nuttx/arch/arm/src/sama5/sam_ohci.c | 20 |
2 files changed, 22 insertions, 1 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 97e278028..7a82c230d 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -5443,4 +5443,7 @@ logic (2013-8-24). * net/uip/uip_arp.c: Correct backward condition in netmask task. From Max Holtzberg (2013-8-25). + * arch/arm/src/sama5/sam_ohci.c: SAMA5 OHCI is again functional by + itself after all of the changes to integrate with EHCI. (2013-8-25). + diff --git a/nuttx/arch/arm/src/sama5/sam_ohci.c b/nuttx/arch/arm/src/sama5/sam_ohci.c index 290db8157..ea6f94ddb 100644 --- a/nuttx/arch/arm/src/sama5/sam_ohci.c +++ b/nuttx/arch/arm/src/sama5/sam_ohci.c @@ -1661,7 +1661,19 @@ static int sam_ctrltd(struct sam_rhport_s *rhport, uint32_t dirpid, regval |= OHCI_CMDST_CLF; sam_putreg(regval, SAM_USBHOST_CMDST); - /* Wait for the Writeback Done Head interrupt. Loop to handle any false + /* Release the OHCI semaphore while we wait. Other threads need the + * opportunity to access the EHCI resources while we wait. + * + * REVISIT: Is this safe? NO. This is a bug and needs rethinking. + * We need to lock all of the port-resources (not EHCI common) until + * the transfer is complete. But we can't use the common OHCI exclsem + * or we will deadlock while waiting (because the working thread that + * wakes this thread up needs the exclsem). + */ +#warning REVISIT + sam_givesem(&g_ohci.exclsem); + + /* Wait for the Writeback Done Head interrupt Loop to handle any false * alarm semaphore counts. */ @@ -1670,6 +1682,12 @@ static int sam_ctrltd(struct sam_rhport_s *rhport, uint32_t dirpid, sam_takesem(&eplist->wdhsem); } + /* Re-aquire the ECHI semaphore. The caller expects to be holding + * this upon return. + */ + + sam_takesem(&g_ohci.exclsem); + /* Check the TD completion status bits */ if (edctrl->tdstatus == TD_CC_NOERROR) |