summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-06-13 21:03:15 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-06-13 21:03:15 +0000
commitf7cfd2458804716e11b43190f42ce6b1b74b8e94 (patch)
tree2e00cf7a31479eed790d87702224a16deea2ee78 /nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c
parenteaa1d21a966ad397b565bb824d14e15b78af2f38 (diff)
downloadpx4-nuttx-f7cfd2458804716e11b43190f42ce6b1b74b8e94.tar.gz
px4-nuttx-f7cfd2458804716e11b43190f42ce6b1b74b8e94.tar.bz2
px4-nuttx-f7cfd2458804716e11b43190f42ce6b1b74b8e94.zip
Add USBDEV power/pin configuration
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2745 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c')
-rwxr-xr-xnuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c b/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c
index f1bd5e23f..29a5490e6 100755
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c
@@ -3069,11 +3069,8 @@ static int lpc17_pullup(struct usbdev_s *dev, bool enable)
* Initialize USB hardware.
*
* Assumptions:
- * - This function is called very early in the initialization sequence
- * - PLL and GIO pin initialization is not performed here but should been in
- * the low-level boot logic: PLL1 must be configured for operation at 48MHz
- * and P0.23 and PO.31 in PINSEL1 must be configured for Vbus and USB connect
- * LED.
+ * This function is called very early in the initialization sequence in order
+ * to initialize the USB device functionality.
*
*******************************************************************************/
@@ -3085,9 +3082,32 @@ void up_usbinitialize(void)
usbtrace(TRACE_DEVINIT, 0);
+ uint32_t regval;
+ irqstate_t flags;
+
+ /* Step 1: Enable power by setting PCUSB in the PCONP register */
+
+ flags = irqsave();
+ regval = getreg32(LPC17_SYSCON_PCONP);
+ regval |= SYSCON_PCONP_PCUSB;
+ putreg32(regval, LPC17_SYSCON_PCONP);
+
+ /* Step 2: Enable clocking on UART (USB clocking was initialized in very
+ * low-level clock setup logic (see lpc17_clockconfig.c)
+ */
+
+ /* Step 3: Configure I/O pins */
+
+ lpc17_configgpio(GPIO_USB_VBUS); /* VBUS status input */
+ lpc17_configgpio(GPIO_USB_CONNECT); /* SoftConnect control signal */
+ lpc17_configgpio(GPIO_USB_UPLED); /* GoodLink LED control signal */
+ lpc17_configgpio(GPIO_USB_DP); /* Positive differential data */
+ lpc17_configgpio(GPIO_USB_DM); /* Negative differential data */
+
/* Disable USB interrupts */
lpc17_putreg(0, LPC17_USBDEV_INTST);
+ irqrestore(flags);
/* Initialize the device state structure */