summaryrefslogtreecommitdiff
path: root/nuttx/configs
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-03-25 15:56:10 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-03-25 15:56:10 -0600
commit7e4cf33f7b3ee60f1651368d51564a3eabe8e1b6 (patch)
tree5fe95a0d95a5be8b346be776641350191962e9a1 /nuttx/configs
parent7cee9b355dd78ba26982373eaf8f05fc8297ffc0 (diff)
downloadpx4-nuttx-7e4cf33f7b3ee60f1651368d51564a3eabe8e1b6.tar.gz
px4-nuttx-7e4cf33f7b3ee60f1651368d51564a3eabe8e1b6.tar.bz2
px4-nuttx-7e4cf33f7b3ee60f1651368d51564a3eabe8e1b6.zip
SAMV7 USB: more updates
Diffstat (limited to 'nuttx/configs')
-rw-r--r--nuttx/configs/samv71-xult/src/sam_boot.c29
-rw-r--r--nuttx/configs/samv71-xult/src/sam_usbdev.c19
-rw-r--r--nuttx/configs/samv71-xult/src/samv71-xult.h31
3 files changed, 60 insertions, 19 deletions
diff --git a/nuttx/configs/samv71-xult/src/sam_boot.c b/nuttx/configs/samv71-xult/src/sam_boot.c
index cac045071..0a19fb6c0 100644
--- a/nuttx/configs/samv71-xult/src/sam_boot.c
+++ b/nuttx/configs/samv71-xult/src/sam_boot.c
@@ -79,27 +79,24 @@ void sam_boardinitialize(void)
sam_sdram_config();
#endif
- /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
- * sam_spiinitialize() has been brought into the link.
- */
-
#ifdef CONFIG_SAMV7_SPI
- if (sam_spiinitialize)
- {
- sam_spiinitialize();
- }
+ /* Configure SPI chip selects if SPI has been enabled */
+
+ sam_spiinitialize();
#endif
- /* Configure board resources to support networking if the 1) networking is enabled,
- * 2) the EMAC module is enabled, and 2) the weak function sam_netinitialize()
- * has been brought into the build.
- */
+#ifdef HAVE_USB
+ /* Setup USB-related GPIO pins for the SAMV71-XULT board. */
+
+ sam_usbinitialize();
+#endif
#ifdef HAVE_NETWORK
- if (sam_netinitialize)
- {
- sam_netinitialize();
- }
+ /* Configure board resources to support networking if the 1) networking is
+ * enabled, and 2) the EMAC module is enabled
+ */
+
+ sam_netinitialize();
#endif
/* Configure on-board LEDs if LED support has been selected. */
diff --git a/nuttx/configs/samv71-xult/src/sam_usbdev.c b/nuttx/configs/samv71-xult/src/sam_usbdev.c
index 2fb906f80..1e8173790 100644
--- a/nuttx/configs/samv71-xult/src/sam_usbdev.c
+++ b/nuttx/configs/samv71-xult/src/sam_usbdev.c
@@ -48,6 +48,7 @@
#include <nuttx/usb/usbdev_trace.h>
#include "up_arch.h"
+#include "sam_gpio.h"
#include "samv71-xult.h"
/************************************************************************************
@@ -63,6 +64,24 @@
************************************************************************************/
/************************************************************************************
+ * Name: sam_usbinitialize
+ *
+ * Description:
+ * Called from stm32_boardinitialize very early in initialization to setup USB-
+ * related GPIO pins for the SAMV71-XULT board.
+ *
+ ************************************************************************************/
+
+void sam_usbinitialize(void)
+{
+ /* Initialize the VBUS enable signal to HI output in any event so that, by
+ * default, VBUS power is not provided at the USB connector.
+ */
+
+ sam_configgpio(GPIO_VBUSON);
+}
+
+/************************************************************************************
* Name: sam_usbsuspend
*
* Description:
diff --git a/nuttx/configs/samv71-xult/src/samv71-xult.h b/nuttx/configs/samv71-xult/src/samv71-xult.h
index 28ac66dfb..873972ffd 100644
--- a/nuttx/configs/samv71-xult/src/samv71-xult.h
+++ b/nuttx/configs/samv71-xult/src/samv71-xult.h
@@ -41,7 +41,6 @@
************************************************************************************/
#include <nuttx/config.h>
-#include <nuttx/compiler.h>
#include <stdint.h>
#include <stdbool.h>
@@ -56,6 +55,7 @@
#define HAVE_HSMCI 1
#define HAVE_AUTOMOUNTER 1
+#define HAVE_USB 1
#define HAVE_USBDEV 1
#define HAVE_USBMONITOR 1
#define HAVE_NETWORK 1
@@ -145,6 +145,7 @@
*/
#if !defined(CONFIG_SAMV7_UDP) || !defined(CONFIG_USBDEV)
+# undef HAVE_USB
# undef HAVE_USBDEV
#endif
@@ -296,6 +297,17 @@
GPIO_INT_BOTHEDGES | GPIO_PORT_PIOD | GPIO_PIN18)
#define IRQ_MCI0_CD SAM_IRQ_PD18
+/* USB Host
+ *
+ * The SAM V71 Xplained Ultra has a Micro-USB connector for use with the SAM V71
+ * USB module labeled as TARGET USB on the kit. In USB host mode VBUS voltage is
+ * provided by the kit and has to be enabled by setting the "VBUS Host Enable"
+ * pin (PC16) low.
+ */
+
+#define GPIO_VBUSON (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \
+ GPIO_PORT_PIOC | GPIO_PIN16)
+
/* SPI Chip Selects
* to be provided
*/
@@ -358,7 +370,7 @@ int sam_bringup(void);
*
************************************************************************************/
-void weak_function sam_spiinitialize(void);
+void sam_spiinitialize(void);
/************************************************************************************
* Name: sam_hsmci_initialize
@@ -375,6 +387,19 @@ int sam_hsmci_initialize(int slot, int minor);
#endif
/************************************************************************************
+ * Name: sam_usbinitialize
+ *
+ * Description:
+ * Called from stm32_boardinitialize very early in initialization to setup USB-
+ * related GPIO pins for the SAMV71-XULT board.
+ *
+ ************************************************************************************/
+
+#ifdef HAVE_USB
+void sam_usbinitialize(void);
+#endif
+
+/************************************************************************************
* Name: sam_netinitialize
*
* Description:
@@ -383,7 +408,7 @@ int sam_hsmci_initialize(int slot, int minor);
************************************************************************************/
#ifdef HAVE_NETWORK
-void weak_function sam_netinitialize(void);
+void sam_netinitialize(void);
#endif
/************************************************************************************