From 51355efa04f319b4691ad71409ce7304bd1ff685 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 19 Sep 2013 10:52:33 -0600 Subject: SAMA5 EHCI: Fix bits being clobbered in PORTSC on hand-off to OHCI. OHCI: Fix some more trace configuration issues. Both: Don't muck with SFR port selection bits once they have been initialized --- nuttx/arch/arm/src/sama5/sam_ehci.c | 13 ++++++++----- nuttx/arch/arm/src/sama5/sam_ohci.c | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/nuttx/arch/arm/src/sama5/sam_ehci.c b/nuttx/arch/arm/src/sama5/sam_ehci.c index aa2b55c94..bbe7dee1d 100755 --- a/nuttx/arch/arm/src/sama5/sam_ehci.c +++ b/nuttx/arch/arm/src/sama5/sam_ehci.c @@ -580,7 +580,7 @@ static uint32_t sam_swap32(uint32_t value) static void sam_printreg(volatile uint32_t *regaddr, uint32_t regval, bool iswrite) { - lldbg("%p%s%08x\n", regaddr, iswrite ? "<-" : "->", regval); + lldbg("%08x%s%08x\n", (uintptr_t)regaddr, iswrite ? "<-" : "->", regval); } #endif @@ -2699,10 +2699,11 @@ static inline void sam_portsc_bottomhalf(void) } /* Clear all pending port interrupt sources by writing a '1' to the - * corresponding bit in the PORTSC register. + * corresponding bit in the PORTSC register. In addition, we need + * to preserve the values of all R/W bits (RO bits don't matter) */ - sam_putreg(portsc & EHCI_PORTSC_ALLINTS, &HCOR->portsc[rhpndx]); + sam_putreg(portsc, &HCOR->portsc[rhpndx]); } } @@ -3144,7 +3145,7 @@ static int sam_enumerate(FAR struct usbhost_connection_s *conn, int rhpndx) regval |= EHCI_PORTSC_OWNER; sam_putreg(regval, &HCOR->portsc[rhpndx]); -#ifdef CONFIG_SAMA5_OHCI +#if 0 /* #ifdef CONFIG_SAMA5_OHCI */ /* Give the port to the OHCI controller. Zero is the reset value for * all ports; one makes the corresponding port available to OHCI. */ @@ -3156,6 +3157,7 @@ static int sam_enumerate(FAR struct usbhost_connection_s *conn, int rhpndx) /* And return a failure */ + rhport->connected = false; return -EPERM; } else @@ -3264,7 +3266,7 @@ static int sam_enumerate(FAR struct usbhost_connection_s *conn, int rhpndx) regval |= EHCI_PORTSC_OWNER; sam_putreg(regval, &HCOR->portsc[rhpndx]); -#ifdef CONFIG_SAMA5_OHCI +#if 0 /* #ifdef CONFIG_SAMA5_OHCI */ /* Give the port to the OHCI controller. Zero is the reset value for * all ports; one makes the corresponding port available to OHCI. */ @@ -3276,6 +3278,7 @@ static int sam_enumerate(FAR struct usbhost_connection_s *conn, int rhpndx) /* And return a failure */ + rhport->connected = false; return -EPERM; } diff --git a/nuttx/arch/arm/src/sama5/sam_ohci.c b/nuttx/arch/arm/src/sama5/sam_ohci.c index 0fe396a7c..8d8257303 100644 --- a/nuttx/arch/arm/src/sama5/sam_ohci.c +++ b/nuttx/arch/arm/src/sama5/sam_ohci.c @@ -1928,7 +1928,7 @@ static void sam_wdh_bottomhalf(void) ed->tdstatus = (td->hw.ctrl & GTD_STATUS_CC_MASK) >> GTD_STATUS_CC_SHIFT; -#if defined(CONFIG_DEBUG_USB) || defined(CONFIG_USBHOST_TRACE) +#ifdef HAVE_USBHOST_TRACE if (ed->tdstatus != TD_CC_NOERROR) { /* The transfer failed for some reason... dump some diagnostic info. */ @@ -2078,7 +2078,7 @@ static int sam_wait(FAR struct usbhost_connection_s *conn, for (rhpndx = 0; rhpndx < SAM_OHCI_NRHPORT; rhpndx++) { -#ifdef CONFIG_SAMA5_EHCI +#if 0 /* #ifdef CONFIG_SAMA5_EHCI */ /* If a device is no longer connected, return the port to the EHCI * controller. Zero is the reset value for all ports; one makes * the corresponding port available to OHCI. -- cgit v1.2.3