From bdc7d0523d21d40110d0e3e40ade0b8b02788c86 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 23 Aug 2013 11:26:17 -0600 Subject: [PATCH] SAMA5 EHCI: cosmetic changes --- arch/arm/src/sama5/sam_ehci.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/arch/arm/src/sama5/sam_ehci.c b/arch/arm/src/sama5/sam_ehci.c index 479d03bb97..9a33a1a794 100755 --- a/arch/arm/src/sama5/sam_ehci.c +++ b/arch/arm/src/sama5/sam_ehci.c @@ -1384,22 +1384,31 @@ static void sam_qh_enqueue(struct sam_qh_s *qh) { uintptr_t physaddr; - /* Add the new QH to the head of the asynchronous queue list. */ - /* Attach the old head as the new QH HLP and flush the new QH and its attached - * qTDs to RAM. + /* Set the internal fqp field. When we transverse the the QH list later, + * we need to know the correct place to start because the overlay may no + * longer point to the first qTD entry. + */ + + qh->fqp = qh->hw.overlay.nqp; + (void)sam_qh_dump(qh, NULL, NULL); + + /* Add the new QH to the head of the asynchronous queue list. + * + * First, attach the old head as the new QH HLP and flush the new QH and its + * attached qTDs to RAM. */ qh->hw.hlp = g_asynchead.hw.hlp; sam_qh_flush(qh); - /* Set the new QH as the first QH in the asychronous queue and flush the + /* Then set the new QH as the first QH in the asychronous queue and flush the * modified head to RAM. */ physaddr = (uintptr_t)sam_physramaddr((uintptr_t)qh); g_asynchead.hw.hlp = sam_swap32(physaddr | QH_HLP_TYP_QH); - cp15_coherent_dcache((uintptr_t)&g_asynchead, - (uintptr_t)&g_asynchead + sizeof(struct ehci_qh_s)); + cp15_coherent_dcache((uintptr_t)&g_asynchead.hw, + (uintptr_t)&g_asynchead.hw + sizeof(struct ehci_qh_s)); } /******************************************************************************* @@ -1907,16 +1916,8 @@ static int sam_async_transfer(struct sam_rhport_s *rhport, *flink = sam_swap32(physaddr); } - /* Set the internal fqp field. When we transverse the the QH list later, - * we need to know the correct place to start because the overlay may no - * longer point to the first qTD entry. - */ - - qh->fqp = qh->hw.overlay.nqp; - /* Add the new QH to the head of the asynchronous queue list */ - (void)sam_qh_dump(qh, NULL, NULL); sam_qh_enqueue(qh); /* Release the EHCI semaphore while we wait. Other threads need the