Merged in david_s5/nuttx/upstream_kinetis (pull request #256)

Kinetis:Allow Board to add Pullups on SDHC lines

Approved-by: Gregory Nutt
This commit is contained in:
David Sidrane 2017-03-09 15:34:12 +00:00 committed by Gregory Nutt
commit c8efeecfda
3 changed files with 37 additions and 9 deletions

View File

@ -92,6 +92,18 @@
# undef CONFIG_SDIO_XFRDEBUG # undef CONFIG_SDIO_XFRDEBUG
#endif #endif
/* Enable pull-up resistors
*
* Kinetis does not have pullups on all their development boards
* So allow the the board config to enable them.
*/
#if defined(BOARD_SDHC_ENABLE_PULLUPS)
# define BOARD_SDHC_PULLUP_ENABLE _PIN_INPUT_PULLUP
#else
# define BOARD_SDHC_PULLUP_ENABLE 0
#endif
/* SDCLK frequencies corresponding to various modes of operation. These /* SDCLK frequencies corresponding to various modes of operation. These
* values may be provided in either the NuttX configuration file or in * values may be provided in either the NuttX configuration file or in
* the board.h file * the board.h file
@ -2844,29 +2856,29 @@ FAR struct sdio_dev_s *sdhc_initialize(int slotno)
#ifndef CONFIG_SDIO_MUXBUS #ifndef CONFIG_SDIO_MUXBUS
/* Data width 1, 4 or 8 */ /* Data width 1, 4 or 8 */
kinetis_pinconfig(PIN_SDHC0_D0); kinetis_pinconfig(PIN_SDHC0_D0 | BOARD_SDHC_PULLUP_ENABLE);
/* Data width 4 or 8 */ /* Data width 4 or 8 */
#ifndef CONFIG_KINETIS_SDHC_WIDTH_D1_ONLY #ifndef CONFIG_KINETIS_SDHC_WIDTH_D1_ONLY
kinetis_pinconfig(PIN_SDHC0_D1); kinetis_pinconfig(PIN_SDHC0_D1 | BOARD_SDHC_PULLUP_ENABLE);
kinetis_pinconfig(PIN_SDHC0_D2); kinetis_pinconfig(PIN_SDHC0_D2 | BOARD_SDHC_PULLUP_ENABLE);
kinetis_pinconfig(PIN_SDHC0_D3); kinetis_pinconfig(PIN_SDHC0_D3 | BOARD_SDHC_PULLUP_ENABLE);
/* Data width 8 (not supported) */ /* Data width 8 (not supported) */
#if 0 #if 0
kinetis_pinconfig(PIN_SDHC0_D4); kinetis_pinconfig(PIN_SDHC0_D4 | BOARD_SDHC_PULLUP_ENABLE);
kinetis_pinconfig(PIN_SDHC0_D5); kinetis_pinconfig(PIN_SDHC0_D5 | BOARD_SDHC_PULLUP_ENABLE);
kinetis_pinconfig(PIN_SDHC0_D6); kinetis_pinconfig(PIN_SDHC0_D6 | BOARD_SDHC_PULLUP_ENABLE);
kinetis_pinconfig(PIN_SDHC0_D7); kinetis_pinconfig(PIN_SDHC0_D7 | BOARD_SDHC_PULLUP_ENABLE);
#endif #endif
#endif #endif
/* Clocking and CMD pins (all data widths) */ /* Clocking and CMD pins (all data widths) */
kinetis_pinconfig(PIN_SDHC0_DCLK); kinetis_pinconfig(PIN_SDHC0_DCLK);
kinetis_pinconfig(PIN_SDHC0_CMD); kinetis_pinconfig(PIN_SDHC0_CMD | BOARD_SDHC_PULLUP_ENABLE);
#endif #endif
/* Reset the card and assure that it is in the initial, unconfigured /* Reset the card and assure that it is in the initial, unconfigured

View File

@ -100,6 +100,13 @@
#define BOARD_FLEXBUS_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV3) #define BOARD_FLEXBUS_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV3)
#define BOARD_FLASHCLK_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV4) #define BOARD_FLASHCLK_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV4)
/*
* Kinetis does not have pullups on their Freedom-K64F board
* So allow the the board config to enable them.
*/
#define BOARD_SDHC_ENABLE_PULLUPS 1
/* SDHC clocking ********************************************************************/ /* SDHC clocking ********************************************************************/
/* SDCLK configurations corresponding to various modes of operation. Formula is: /* SDCLK configurations corresponding to various modes of operation. Formula is:

View File

@ -143,6 +143,15 @@
#define BOARD_TPM_CLKSRC SIM_SOPT2_TPMSRC_MCGCLK #define BOARD_TPM_CLKSRC SIM_SOPT2_TPMSRC_MCGCLK
#define BOARD_TPM_FREQ BOARD_SIM_CLKDIV3_FREQ #define BOARD_TPM_FREQ BOARD_SIM_CLKDIV3_FREQ
/* SDHC pull-up resistors **********************************************************/
/*
* Kinetis does not have pullups on their Freedom-K66F board
* So allow the the board config to enable them.
*/
#define BOARD_SDHC_ENABLE_PULLUPS 1
/* SDHC clocking ********************************************************************/ /* SDHC clocking ********************************************************************/
/* SDCLK configurations corresponding to various modes of operation. Formula is: /* SDCLK configurations corresponding to various modes of operation. Formula is: