Minor usb-related

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3150 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2010-11-30 19:35:24 +00:00
parent 8b11c7c8f8
commit 5135a804d0
4 changed files with 16 additions and 26 deletions

View File

@ -106,7 +106,7 @@
/* CLKCTRL enable bits */
#define LPC17_CLKCTRL_ENABLES (USBDEV_CLK_DEVCLK|USBDEV_CLK_PORTSELCLK|USBDEV_CLK_AHBCLK)
#define LPC17_CLKCTRL_ENABLES (USBDEV_CLK_DEVCLK|USBDEV_CLK_AHBCLK)
/* Dump GPIO registers */
@ -3153,9 +3153,19 @@ void up_usbinitialize(void)
/* Step 2: Enable clocking on USB (USB PLL clocking was initialized in
* in very low-level clock setup logic (see lpc17_clockconfig.c)). We
* do still need to set up USBCLKCTRL -- see below.
* do still need to set up USBCLKCTRL to enable device and AHB clocking.
*/
lpc17_putreg(LPC17_CLKCTRL_ENABLES, LPC17_USBDEV_CLKCTRL);
/* Then wait for the clocks to be reported as "ON" */
do
{
regval = lpc17_getreg(LPC17_USBDEV_CLKST);
}
while ((regval & LPC17_CLKCTRL_ENABLES) != LPC17_CLKCTRL_ENABLES);
/* Step 3: Configure I/O pins */
usbdev_dumpgpio();
@ -3228,26 +3238,6 @@ void up_usbinitialize(void)
}
}
/* Turn on USB power */
flags = irqsave();
regval = lpc17_getreg(LPC17_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCUSB;
lpc17_putreg(regval, LPC17_SYSCON_PCONP);
irqrestore(flags);
/* Enable device and AHB clocking */
lpc17_putreg(LPC17_CLKCTRL_ENABLES, LPC17_USBDEV_CLKCTRL);
/* And wait for the clocks to be reported as "ON" */
do
{
regval = lpc17_getreg(LPC17_USBDEV_CLKST);
}
while ((regval & LPC17_CLKCTRL_ENABLES) != LPC17_CLKCTRL_ENABLES);
/* Make sure all USB interrupts are disabled and cleared */
lpc17_putreg(0, LPC17_USBDEV_INTEN);

View File

@ -1,7 +1,7 @@
/****************************************************************************
* configs/mcu123-lpc214x/src/up_usbstrg.c
*
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Configure and register the LPC214x MMC/SD SPI block driver.
@ -113,7 +113,7 @@ int usbstrg_archinitialize(void)
message("usbstrg_archinitialize: Initializing SPI port %d\n",
LPC214X_MMCSDSPIPORTNO);
spi = up_spiinitialize(1);
spi = up_spiinitialize(LPC214X_MMCSDSPIPORTNO);
if (!spi)
{
message("usbstrg_archinitialize: Failed to initialize SPI port %d\n",

View File

@ -113,7 +113,7 @@ int usbstrg_archinitialize(void)
message("usbstrg_archinitialize: Initializing SPI port %d\n",
LPC17XX_MMCSDSPIPORTNO);
spi = up_spiinitialize(1);
spi = up_spiinitialize(LPC17XX_MMCSDSPIPORTNO);
if (!spi)
{
message("usbstrg_archinitialize: Failed to initialize SPI port %d\n",

View File

@ -120,7 +120,7 @@ int usbstrg_archinitialize(void)
message("usbstrg_archinitialize: Initializing SPI port %d\n",
LPC17XX_MMCSDSPIPORTNO);
spi = up_spiinitialize(1);
spi = up_spiinitialize(LPC17XX_MMCSDSPIPORTNO);
if (!spi)
{
message("usbstrg_archinitialize: Failed to initialize SPI port %d\n",