Add USBDEV power/pin configuration

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2745 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2010-06-13 21:03:15 +00:00
parent 222305f861
commit 2b587ee7a8
3 changed files with 29 additions and 9 deletions

View File

@ -296,7 +296,7 @@
#define GPIO_MCPWM_MCOB2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29)
#define GPIO_PCAP1p1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29)
#define GPIO_MAT0p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29)
#define GPIO_VBUS (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN30)
#define GPIO_USB_VBUS (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN30)
#define GPIO_AD0p4 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN30)
#define GPIO_SSP1_SCK_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN31)
#define GPIO_AD0p5 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN31)

View File

@ -621,7 +621,7 @@ static inline void lpc17_uart0config(uint8_t clkdiv)
flags = irqsave();
regval = getreg32(LPC17_SYSCON_PCONP);
regval |= ~SYSCON_PCONP_PCUART0;
regval |= SYSCON_PCONP_PCUART0;
putreg32(regval, LPC17_SYSCON_PCONP);
/* Step 2: Enable clocking on UART */
@ -649,7 +649,7 @@ static inline void lpc17_uart1config(uint8_t clkdiv)
flags = irqsave();
regval = getreg32(LPC17_SYSCON_PCONP);
regval |= ~SYSCON_PCONP_PCUART1;
regval |= SYSCON_PCONP_PCUART1;
putreg32(regval, LPC17_SYSCON_PCONP);
/* Step 2: Enable clocking on UART */
@ -713,7 +713,7 @@ static inline void lpc17_uart3config(uint8_t clkdiv)
flags = irqsave();
regval = getreg32(LPC17_SYSCON_PCONP);
regval |= ~SYSCON_PCONP_PCUART3;
regval |= SYSCON_PCONP_PCUART3;
putreg32(regval, LPC17_SYSCON_PCONP);
/* Step 2: Enable clocking on UART */

View File

@ -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 */