summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nuttx/configs/sama5d4-ek/README.txt45
-rw-r--r--nuttx/configs/sama5d4-ek/nsh/defconfig43
-rw-r--r--nuttx/configs/sama5d4-ek/src/sam_usb.c15
-rw-r--r--nuttx/configs/sama5d4-ek/src/sama5d4-ek.h122
4 files changed, 156 insertions, 69 deletions
diff --git a/nuttx/configs/sama5d4-ek/README.txt b/nuttx/configs/sama5d4-ek/README.txt
index 053f86297..fb1aa1ad6 100644
--- a/nuttx/configs/sama5d4-ek/README.txt
+++ b/nuttx/configs/sama5d4-ek/README.txt
@@ -1580,7 +1580,7 @@ USB Ports
PIO Signal Name Function
---- -------------- -------------------------------------------------------
- PE10 EN5V_USBA VBus power enable (via MN2 power switch) to VBus pin of
+ PE10 USBA_EN5V_PE10 VBus power enable (via MN2 power switch) to VBus pin of
the OTG connector (host)
PE31 USBA_VBUS_PE31 VBus sensing from the VBus pin of the OTG connector (device)
@@ -1589,7 +1589,7 @@ USB Ports
PIO Signal Name Function
---- -------------- -------------------------------------------------------
- PE11 EN5V_USBB VBus power enable (via MN4 power switch). To the A1
+ PE11 USBB_EN5V_PE11 VBus power enable (via MN4 power switch). To the A1
pin of J5 Dual USB A connector
Port C
@@ -1597,15 +1597,15 @@ USB Ports
PIO Signal Name Function
---- -------------- -------------------------------------------------------
- PE12 EN5V_USBC VBus power enable (via MN4 power switch). To the B1
+ PE12 USB_OVCUR_PD9 VBus power enable (via MN4 power switch). To the B1
pin of J5 Dual USB A connector
Both Ports B and C
------------------
- PIO Signal Name Function
- ---- ----------- -------------------------------------------------------
- PE5 OVCUR_USB Combined over-current indication from port A and B
+ PIO Signal Name Function
+ ---- ------------- -------------------------------------------------------
+ PD9 USB_OVCUR_PD9 Combined over-current indication from port A and B
USB High-Speed Device
=====================
@@ -1774,10 +1774,13 @@ USB High-Speed Host
System Type -> USB High Speed Host driver options
CONFIG_SAMA5_EHCI=y : High-speed EHCI support
CONFIG_SAMA5_OHCI=y : Low/full-speed OHCI support
- : Defaults for values probably OK for both
+ : Defaults for values probably OK for both
+ CONFIG_SAMA5_UHPHS_RHPORT1=n : (Reserved for use by USB device)
+ CONFIG_SAMA5_UHPHS_RHPORT2=y : Enable port B
+ CONFIG_SAMA5_UHPHS_RHPORT3=y : Enable port C
+
Device Drivers
CONFIG_USBHOST=y : Enable USB host support
- CONFIG_USBHOST_INT_DISABLE=y : Interrupt endpoints not needed
CONFIG_USBHOST_ISOC_DISABLE=y : Isochronous endpoints not needed
Device Drivers -> USB Host Driver Support
@@ -3452,18 +3455,24 @@ Configurations
TIW0 bus. See the discussion above under "I2C Tool" for detailed
configuration settings.
- 13. The SAMA5D4-EK includes for an AT25 serial DataFlash. That support is
- NOT enabled in this configuration. Support for that serial FLASH can
- be enabled by modifying the NuttX configuration as described above in
- the paragraph entitled "AT25 Serial FLASH".
+ 13. Support the USB low-, high- and full-speed OHCI host driver is enabled
+ enabled with the NuttX configuration file as described in the section
+ above entitled "USB High-Speed Host". Only port B and port C, the
+ larger "Type A" connectors, are enabled; port A (the smaller OTG
+ connector) is reserved for future use with USB device (but could also
+ be configured as a USB host port if desired).
- 14. Support the USB low-, high- and full-speed OHCI host driver can be
- enabled by changing the NuttX configuration file as described in the
- section entitled "USB High-Speed Host" above.
+ Support for Mass Storage Class and USB (Boot) Keyboard class is also
+ enabled.
- 15. Support the USB high-speed USB device driver (UDPHS) can be enabled
- by changing the NuttX configuration file as described above in the
- section entitled "USB High-Speed Device."
+ 14. Support the USB high-speed USB device driver (UDPHS) is not enabled by
+ default but could be enabled by changing the NuttX configuration file as
+ described above in the section entitled "USB High-Speed Device."
+
+ 15. The SAMA5D4-EK includes for an AT25 serial DataFlash. That support is
+ NOT enabled in this configuration. Support for that serial FLASH could
+ be enabled by modifying the NuttX configuration as described above in
+ the paragraph entitled "AT25 Serial FLASH".
16. This example can be configured to exercise the watchdog timer test
(apps/examples/watchdog). See the detailed configuration settings in
diff --git a/nuttx/configs/sama5d4-ek/nsh/defconfig b/nuttx/configs/sama5d4-ek/nsh/defconfig
index 1120c0571..0b88b1841 100644
--- a/nuttx/configs/sama5d4-ek/nsh/defconfig
+++ b/nuttx/configs/sama5d4-ek/nsh/defconfig
@@ -122,6 +122,9 @@ CONFIG_ARMV7A_TOOLCHAIN_CODESOURCERYW=y
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
# CONFIG_NET_MULTICAST is not set
+# CONFIG_USBHOST_BULK_DISABLE is not set
+# CONFIG_USBHOST_INT_DISABLE is not set
+CONFIG_USBHOST_ISOC_DISABLE=y
#
# SAMA5 Configuration Options
@@ -204,7 +207,7 @@ CONFIG_SAMA5_HSMCI0=y
# CONFIG_SAMA5_ADC is not set
# CONFIG_SAMA5_XDMAC0 is not set
CONFIG_SAMA5_XDMAC1=y
-# CONFIG_SAMA5_UHPHS is not set
+CONFIG_SAMA5_UHPHS=y
# CONFIG_SAMA5_UDPHS is not set
CONFIG_SAMA5_EMACB=y
CONFIG_SAMA5_EMAC0=y
@@ -262,6 +265,23 @@ CONFIG_SAMA5_HSMCI0_XDMAC1=y
# CONFIG_SAMA5_HSMCI_WRPROOF is not set
#
+# USB High Speed Host Controller driver (HCD) options
+#
+CONFIG_SAMA5_OHCI=y
+CONFIG_SAMA5_OHCI_NEDS=6
+CONFIG_SAMA5_OHCI_NTDS=9
+CONFIG_SAMA5_OHCI_TDBUFFERS=6
+CONFIG_SAMA5_OHCI_TDBUFSIZE=128
+CONFIG_SAMA5_EHCI=y
+CONFIG_SAMA5_EHCI_NQHS=4
+CONFIG_SAMA5_EHCI_NQTDS=6
+CONFIG_SAMA5_EHCI_BUFSIZE=128
+CONFIG_SAMA5_EHCI_PREALLOCATE=y
+# CONFIG_SAMA5_UHPHS_RHPORT1 is not set
+CONFIG_SAMA5_UHPHS_RHPORT2=y
+CONFIG_SAMA5_UHPHS_RHPORT3=y
+
+#
# External Memory Configuration
#
# CONFIG_SAMA5_EBICS0 is not set
@@ -585,7 +605,21 @@ CONFIG_USART4_2STOP=0
# CONFIG_SERIAL_IFLOWCONTROL is not set
# CONFIG_SERIAL_OFLOWCONTROL is not set
# CONFIG_USBDEV is not set
-# CONFIG_USBHOST is not set
+CONFIG_USBHOST=y
+CONFIG_USBHOST_NPREALLOC=4
+CONFIG_USBHOST_MSC=y
+CONFIG_USBHOST_HIDKBD=y
+CONFIG_HIDKBD_POLLUSEC=100000
+CONFIG_HIDKBD_DEFPRIO=50
+CONFIG_HIDKBD_STACKSIZE=1024
+CONFIG_HIDKBD_BUFSIZE=64
+CONFIG_HIDKBD_NPOLLWAITERS=2
+# CONFIG_HIDKBD_RAWSCANCODES is not set
+# CONFIG_HIDKBD_ALLSCANCODES is not set
+# CONFIG_HIDKBD_NODEBOUNCE is not set
+# CONFIG_USBHOST_HIDMOUSE is not set
+# CONFIG_USBHOST_RTL8187 is not set
+# CONFIG_USBHOST_TRACE is not set
# CONFIG_WIRELESS is not set
#
@@ -695,6 +729,11 @@ CONFIG_NET_STATISTICS=y
CONFIG_NET_ETHERNET=y
#
+# Crypto API
+#
+# CONFIG_CRYPTO is not set
+
+#
# File Systems
#
diff --git a/nuttx/configs/sama5d4-ek/src/sam_usb.c b/nuttx/configs/sama5d4-ek/src/sam_usb.c
index 6b40c7acc..3aa749a03 100644
--- a/nuttx/configs/sama5d4-ek/src/sam_usb.c
+++ b/nuttx/configs/sama5d4-ek/src/sam_usb.c
@@ -284,10 +284,11 @@ void weak_function sam_usbinitialize(void)
sam_configpio(PIO_USBC_VBUS_ENABLE); /* VBUS enable, initially OFF */
#endif
-#if defined(CONFIG_SAMA5_UHPHS_RHPORT2) || defined(CONFIG_SAMA5_UHPHS_RHPORT3)
- /* Configure Port B/C VBUS overrcurrent detection */
+#ifdef HAVE_USBOVCUR
- sam_configpio(PIO_USBBC_VBUS_OVERCURRENT); /* VBUS overcurrent */
+ /* Configure Port B/C VBUS over-current detection */
+
+ sam_configpio(PIO_USBBC_VBUS_OVERCURRENT); /* VBUS over-current */
#endif
#endif /* HAVE_USBHOST */
}
@@ -296,7 +297,7 @@ void weak_function sam_usbinitialize(void)
* Name: sam_usbhost_initialize
*
* Description:
- * Called at application startup time to initialize the USB host functionality.
+ * Called at application start-up time to initialize the USB host functionality.
* This function will start a thread that will monitor for device
* connection/disconnection events.
*
@@ -457,17 +458,17 @@ void sam_usbhost_vbusdrive(int rhport, bool enable)
* Name: sam_setup_overcurrent
*
* Description:
- * Setup to receive an interrupt-level callback if an overcurrent condition is
+ * Setup to receive an interrupt-level callback if an over-current condition is
* detected on port B or C.
*
* REVISIT: Since this is a common signal, we will need to come up with some way
* to inform both EHCI and OHCI drivers when this error occurs.
*
* Input paramter:
- * handler - New overcurrent interrupt handler
+ * handler - New over-current interrupt handler
*
* Returned value:
- * Old overcurrent interrupt handler
+ * Old over-current interrupt handler
*
************************************************************************************/
diff --git a/nuttx/configs/sama5d4-ek/src/sama5d4-ek.h b/nuttx/configs/sama5d4-ek/src/sama5d4-ek.h
index 84f47ef42..b4a9040bb 100644
--- a/nuttx/configs/sama5d4-ek/src/sama5d4-ek.h
+++ b/nuttx/configs/sama5d4-ek/src/sama5d4-ek.h
@@ -60,6 +60,7 @@
#define HAVE_NAND 1
#define HAVE_USBHOST 1
#define HAVE_USBDEV 1
+#define HAVE_USBOVCUR 1
#define HAVE_USBMONITOR 1
#define HAVE_NETWORK 1
@@ -248,6 +249,29 @@
# undef HAVE_USBHOST
#endif
+#if defined(HAVE_USBHOST) && !defined(CONFIG_SAMA5_UHPHS_RHPORT1) && \
+ !defined(CONFIG_SAMA5_UHPHS_RHPORT2) && !defined(CONFIG_SAMA5_UHPHS_RHPORT3)
+# undef HAVE_USBHOST
+# warning No ports defined for USB host
+#endif
+
+#ifndef HAVE_USBHOST
+# undef CONFIG_SAMA5_UHPHS_RHPORT1
+# undef CONFIG_SAMA5_UHPHS_RHPORT2
+# undef CONFIG_SAMA5_UHPHS_RHPORT3
+#endif
+
+/* No overcurrent support if no USB host or no interrupts of PIOD */
+
+#if !defined(HAVE_USBHOST)
+# undef HAVE_USBOVCUR
+#endif
+
+#if defined(HAVE_USBHOST) && !defined(CONFIG_SAMA5_PIOE_IRQ)
+# undef HAVE_USBOVCUR
+# warning CONFIG_SAMA5_PIOE_IRQ need for USB host overcurrent support
+#endif
+
/* Check if we should enable the USB monitor before starting NSH */
#ifndef CONFIG_SYSTEM_USBMONITOR
@@ -372,77 +396,91 @@
PIO_PORT_PIOE | PIO_PIN15)
/* USB Ports ************************************************************************/
-/* The SAMA5D4 series-MB features three USB communication ports:
+/* The SAMA4D4-EK features three USB communication ports:
*
- * 1. Port A Host High Speed (EHCI) and Full Speed (OHCI) multiplexed with
- * USB Device High Speed Micro AB connector, J6
+ * * Port A Host High Speed (EHCI) and Full Speed (OHCI) multiplexed with
+ * USB Device High Speed Micro AB connector, J1
*
- * 2. Port B Host High Speed (EHCI) and Full Speed (OHCI) standard type A
- * connector, J7 upper port
+ * * Port B Host High Speed (EHCI) and Full Speed (OHCI) standard type A
+ * connector, J5 upper port
*
- * 3. Port C Host Full Speed (OHCI) only standard type A connector, J7
- * lower port
+ * * Port C Host Full Speed (OHCI) and Full Speed (OHCI) standard type A
+ * connector, J5 lower port
*
- * The two USB host ports (only) are equipped with 500-mA high-side power
+ * The three USB host ports are equipped with 500-mA high-side power
* switch for self-powered and bus-powered applications.
*
- * The USB device port A (J6) features a VBUS insert detection function.
- *
+ * The USB device port A (J5) features a VBUS insert detection function.
*
* Port A
+ * ------
*
- * PIO Signal Name Function
- * ---- ----------- -------------------------------------------------------
- * PE9 VBUS_SENSE VBus detection
- *
- * Note: No VBus power switch enable on port A. I think that this limits
- * this port to a device port or as a host port for self-powered devices
- * only.
+ * PIO Signal Name Function
+ * ---- -------------- -------------------------------------------------------
+ * PE10 USBA_EN5V_PE10 VBus power enable (via MN2 power switch) to VBus pin of
+ * the OTG connector (host)
+ * PE31 USBA_VBUS_PE31 VBus sensing from the VBus pin of the OTG connector (device)
*/
-#define PIO_USBA_VBUS_SENSE \
+#ifdef CONFIG_SAMA5_UHPHS_RHPORT1
+ #define PIO_USBA_VBUS_ENABLE \
+ (PIO_OUTPUT | PIO_CFG_DEFAULT | PIO_OUTPUT_CLEAR | \
+ PIO_PORT_PIOE | PIO_PIN10)
+#endif
+
+#ifdef HAVE_USBDEV
+# define PIO_USBA_VBUS_SENSE \
(PIO_INPUT | PIO_CFG_PULLUP | PIO_CFG_DEGLITCH | \
- PIO_INT_BOTHEDGES | PIO_PORT_PIOE | PIO_PIN9)
-#define IRQ_USBA_VBUS_SENSE \
- SAM_IRQ_PE9
+ PIO_INT_BOTHEDGES | PIO_PORT_PIOE | PIO_PIN31)
+# define IRQ_USBA_VBUS_SENSE \
+ SAM_IRQ_PE31
+#endif
/* Port B
+ * ------
*
- * PIO Signal Name Function
- * ---- ----------- -------------------------------------------------------
- * PE4 EN5V_USBB VBus power enable (via MN3 AIC1526 Dual USB High-Side
- * Power Switch). To the A1 pin of J7 Dual USB A
- * connector
+ * PIO Signal Name Function
+ * ---- -------------- -------------------------------------------------------
+ * PE11 USBB_EN5V_PE11 VBus power enable (via MN4 power switch). To the A1
+ * pin of J5 Dual USB A connector
*/
-#define PIO_USBB_VBUS_ENABLE \
+#ifdef CONFIG_SAMA5_UHPHS_RHPORT2
+# define PIO_USBB_VBUS_ENABLE \
(PIO_OUTPUT | PIO_CFG_DEFAULT | PIO_OUTPUT_CLEAR | \
- PIO_PORT_PIOE | PIO_PIN4)
+ PIO_PORT_PIOE | PIO_PIN11)
+#endif
/* Port C
+ * ------
*
- * PIO Signal Name Function
- * ---- ----------- -------------------------------------------------------
- * PE3 EN5V_USBC VBus power enable (via MN3 power switch). To the B1
- * pin of J7 Dual USB A connector
+ * PIO Signal Name Function
+ * ---- -------------- -------------------------------------------------------
+ * PE12 USBC_EN5V_PE12 VBus power enable (via MN4 power switch). To the B1
+ * pin of J5 Dual USB A connector
*/
-#define PIO_USBC_VBUS_ENABLE \
+#ifdef CONFIG_SAMA5_UHPHS_RHPORT3
+# define PIO_USBC_VBUS_ENABLE \
(PIO_OUTPUT | PIO_CFG_DEFAULT | PIO_OUTPUT_CLEAR | \
- PIO_PORT_PIOE | PIO_PIN3)
+ PIO_PORT_PIOE | PIO_PIN12)
+#endif
-/* Both Ports B and C
+/* Both Ports B and C
+ * ------------------
*
- * PIO Signal Name Function
- * ---- ----------- -------------------------------------------------------
- * PE5 OVCUR_USB Combined over-current indication from port A and B
+ * PIO Signal Name Function
+ * ---- ------------- -------------------------------------------------------
+ * PD9 USB_OVCUR_PD9 Combined over-current indication from port A and B
*/
-#define PIO_USBBC_VBUS_OVERCURRENT \
+#ifdef HAVE_USBOVCUR
+# define PIO_USBBC_VBUS_OVERCURRENT \
(PIO_INPUT | PIO_CFG_PULLUP | PIO_CFG_DEGLITCH | \
- PIO_INT_BOTHEDGES | PIO_PORT_PIOE | PIO_PIN5)
-#define IRQ_USBBC_VBUS_OVERCURRENT \
- SAM_IRQ_PE5
+ PIO_INT_BOTHEDGES | PIO_PORT_PIOD | PIO_PIN9)
+# define IRQ_USBBC_VBUS_OVERCURRENT \
+ SAM_IRQ_PD9
+#endif
/* Ethernet */