diff --git a/ChangeLog b/ChangeLog index 97e278028c..7a82c230d5 100644 --- a/ChangeLog +++ b/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/arch/arm/src/sama5/sam_ohci.c b/arch/arm/src/sama5/sam_ohci.c index 290db81577..ea6f94ddb6 100644 --- a/arch/arm/src/sama5/sam_ohci.c +++ b/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)