SAMA5 OHCI: Fix semaphore handling bug. OHCI is now function by itself again after changes to integrate with EHCI

This commit is contained in:
Gregory Nutt 2013-08-25 08:57:35 -06:00
parent 042abb0856
commit f1a20f49ff
2 changed files with 22 additions and 1 deletions

View File

@ -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).

View File

@ -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)