From ce376ed9e145fe7b9c0215e93bfebf0893ecf7b3 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 7 Mar 2013 01:52:30 +0000 Subject: More LPC1788 changes from Rommel Marcelo + a few kernel build fixes git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5715 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/configs/open1788/include/board.h | 58 +++++++++++++++++------------ nuttx/configs/open1788/src/lpc17_nsh.c | 7 +--- nuttx/configs/open1788/src/lpc17_userleds.c | 2 +- 3 files changed, 36 insertions(+), 31 deletions(-) (limited to 'nuttx/configs/open1788') diff --git a/nuttx/configs/open1788/include/board.h b/nuttx/configs/open1788/include/board.h index 5ed6b1a45..7991d3c09 100644 --- a/nuttx/configs/open1788/include/board.h +++ b/nuttx/configs/open1788/include/board.h @@ -142,34 +142,28 @@ #define ETH_MCFG_CLKSEL_DIV ETH_MCFG_CLKSEL_DIV20 -/* SDIO dividers. Note that slower clocking is required when DMA is disabled +/* SDIO dividers. Note that slower clocking is required when DMA is disabled * in order to avoid RX overrun/TX underrun errors due to delayed responses - * to service FIFOs in interrupt driven mode. These values have not been - * tuned!!! - * - * SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(118+2)=400 KHz + * to service FIFOs in interrupt driven mode. + * SDCARD_CLOCK=PCLK/(2*(SDCARD_CLKDIV+1)) */ - -#define SDCARD_INIT_CLKDIV (118 << SDCARD_CLOCK_CLKDIV_SHIFT) -/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(1+2)=16 MHz - * DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)=12 MHz - */ +#define SDCARD_SLOW_CLKDIV 74 /* 400Khz */ +#define SDCARD_INIT_CLKDIV (BOARD_PCLK_FREQUENCY/(2*(SDCARD_SLOW_CLKDIV+1))) + +#define SDCARD_NORMAL_CLKDIV 1 /* DMA ON: SDCARD_CLOCK=15MHz */ +#define SDCARD_SLOW_CLKDIV 2 /* DMA OFF: SDCARD_CLOCK=10MHz */ #ifdef CONFIG_SDIO_DMA -# define SDCARD_MMCXFR_CLKDIV (1 << SDCARD_CLOCK_CLKDIV_SHIFT) +# define SDCARD_MMCXFR_CLKDIV (BOARD_PCLK_FREQUENCY/(2*(SDCARD_NORMAL_CLKDIV+1))) #else -# define SDCARD_MMCXFR_CLKDIV (2 << SDCARD_CLOCK_CLKDIV_SHIFT) +# define SDCARD_MMCXFR_CLKDIV (BOARD_PCLK_FREQUENCY/(2*(SDCARD_SLOW_CLKDIV+1))) #endif -/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(1+2)=16 MHz - * DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)=12 MHz - */ - #ifdef CONFIG_SDIO_DMA -# define SDCARD_SDXFR_CLKDIV (1 << SDCARD_CLOCK_CLKDIV_SHIFT) +# define SDCARD_SDXFR_CLKDIV (BOARD_PCLK_FREQUENCY/(2*(SDCARD_NORMAL_CLKDIV+1))) #else -# define SDCARD_SDXFR_CLKDIV (2 << SDCARD_CLOCK_CLKDIV_SHIFT) +# define SDCARD_SDXFR_CLKDIV (BOARD_PCLK_FREQUENCY/(2*(SDCARD_SLOW_CLKDIV+1))) #endif /* Set EMC delay values: @@ -288,15 +282,31 @@ /* Alternate pin selections *********************************************************/ +/* UART0: + * + * TX --- Connected to P0[2] + * RX --- Connected to P0[3] + */ + #define GPIO_UART0_TXD GPIO_UART0_TXD_2 #define GPIO_UART0_RXD GPIO_UART0_RXD_2 -#define GPIO_SD_DAT0 GPIO_SD_DAT0_1 /* REVISIT */ -#define GPIO_SD_DAT1 GPIO_SD_DAT1_1 -#define GPIO_SD_DAT2 GPIO_SD_DAT2_1 -#define GPIO_SD_DAT3 GPIO_SD_DAT3_1 -#define GPIO_SD_CLK GPIO_SD_CLK_1 -#define GPIO_SD_CMD GPIO_SD_CMD_1 +/* MCI-SDIO: + * + * D0 --- Connected to P1[6] + * D1 --- Connected to P2[11] + * D2 --- Connected to P2[12] + * D3 --- Connected to P2[13] + * CLK--- Connected to P1[2] + * CMD--- Connected to P1[3] + */ + +#define GPIO_SD_DAT0 GPIO_SD_DAT0_2 +#define GPIO_SD_DAT1 GPIO_SD_DAT1_2 +#define GPIO_SD_DAT2 GPIO_SD_DAT2_2 +#define GPIO_SD_DAT3 GPIO_SD_DAT3_2 +#define GPIO_SD_CLK GPIO_SD_CLK_2 +#define GPIO_SD_CMD GPIO_SD_CMD_2 /************************************************************************************ * Public Types diff --git a/nuttx/configs/open1788/src/lpc17_nsh.c b/nuttx/configs/open1788/src/lpc17_nsh.c index 85165b220..a8b95a6d1 100644 --- a/nuttx/configs/open1788/src/lpc17_nsh.c +++ b/nuttx/configs/open1788/src/lpc17_nsh.c @@ -202,11 +202,6 @@ static int nsh_sdinitialize(void) FAR struct sdio_dev_s *sdio; int ret; - /* Enable power to the SD/MMC via a GPIO. LOW enables SD/MMC. */ - - lpc17_gpiowrite(OPEN1788_MMC_PWR, false); -#warning "This is wrong" - /* First, get an instance of the SDIO interface */ sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); @@ -225,7 +220,7 @@ static int nsh_sdinitialize(void) message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); return ret; } - + /* Then let's guess and say that there is a card in the slot. I need to check to * see if the STM3240G-EVAL board supports a GPIO to detect if there is a card in * the slot. diff --git a/nuttx/configs/open1788/src/lpc17_userleds.c b/nuttx/configs/open1788/src/lpc17_userleds.c index bf0300e25..08ad837b3 100644 --- a/nuttx/configs/open1788/src/lpc17_userleds.c +++ b/nuttx/configs/open1788/src/lpc17_userleds.c @@ -89,7 +89,7 @@ ****************************************************************************/ /* This array maps an LED number to GPIO pin configuration */ -static uint32_t g_ledcfg[BOARD_NLEDS] = +static uint32_t g_ledcfg[BOARD_NLEDS] = { GPIO_LED1, GPIO_LED2, GPIO_LED3, GPIO_LED4 }; -- cgit v1.2.3