From 34804c8ee7470d3fe65c7596be936d9f40cf4eb4 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 20 Sep 2013 15:22:09 -0600 Subject: [PATCH] SAMA5 OHCI: Fix some problems with D-Cache coherency and physical addressing related to interrupt endpoints --- ChangeLog | 4 ++++ arch/arm/src/sama5/sam_ohci.c | 7 ++++++- configs/sama5d3x-ek/README.txt | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3069484d9d..6ab09c760f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5606,3 +5606,7 @@ to provide prettier ps command output. src/sam_usb.c: Use more descriptive task names when starting the EHCI and OHCI monitor tasks (2013-9-20). + * arch/arm/src/sama5/sam_ohci.c: Fix a place where DMA-related data + needed to be flushed to data cache; Fix another where a virual address + was being used in a register where a physical address was required + (2013-9-20). diff --git a/arch/arm/src/sama5/sam_ohci.c b/arch/arm/src/sama5/sam_ohci.c index 8d82573032..8c6907ba6f 100644 --- a/arch/arm/src/sama5/sam_ohci.c +++ b/arch/arm/src/sama5/sam_ohci.c @@ -3108,6 +3108,7 @@ static void sam_disconnect(FAR struct usbhost_driver_s *drvr) FAR struct usbhost_connection_s *sam_ohci_initialize(int controller) { + uintptr_t physaddr; uint32_t regval; uint8_t *buffer; irqstate_t flags; @@ -3192,6 +3193,9 @@ FAR struct usbhost_connection_s *sam_ohci_initialize(int controller) memset((void*)&g_hcca, 0, sizeof(struct ohci_hcca_s)); + cp15_clean_dcache((uint32_t)&g_hcca, + (uint32_t)&g_hcca + sizeof(struct ohci_hcca_s)); + /* Initialize user-configurable EDs */ for (i = 0; i < SAMA5_OHCI_NEDS; i++) @@ -3274,7 +3278,8 @@ FAR struct usbhost_connection_s *sam_ohci_initialize(int controller) /* Set HCCA base address */ - sam_putreg((uint32_t)&g_hcca, SAM_USBHOST_HCCA); + physaddr = sam_physramaddr((uintptr_t)&g_hcca); + sam_putreg(physaddr, SAM_USBHOST_HCCA); /* Clear pending interrupts */ diff --git a/configs/sama5d3x-ek/README.txt b/configs/sama5d3x-ek/README.txt index dc82042755..bc8b5a6314 100644 --- a/configs/sama5d3x-ek/README.txt +++ b/configs/sama5d3x-ek/README.txt @@ -1220,6 +1220,22 @@ Configurations -rw-rw-rw- 1503 sz-1.log -rw-rw-rw- 613 .bashrc + Or, if a (supported) USB keyboard is connected, a /dev/kbda device + will appear: + + nsh> ls /dev + /dev: + console + kbda + mtdblock0 + null + ttyS0 + + /dev/kbda is a read-only serial device. Reading from /dev/kbda will + get keyboard input as ASCII data (other encodings are possible): + + nsh> cat /dev/kbda + The following features are *not* enabled in the demo configuration but might be of some use to you: