diff --git a/arch/arm/src/kinetis/kinetis_sdhc.c b/arch/arm/src/kinetis/kinetis_sdhc.c index e3a36762e0..8500c95908 100644 --- a/arch/arm/src/kinetis/kinetis_sdhc.c +++ b/arch/arm/src/kinetis/kinetis_sdhc.c @@ -92,6 +92,18 @@ # undef CONFIG_SDIO_XFRDEBUG #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 * values may be provided in either the NuttX configuration file or in * the board.h file @@ -2844,29 +2856,29 @@ FAR struct sdio_dev_s *sdhc_initialize(int slotno) #ifndef CONFIG_SDIO_MUXBUS /* 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 */ #ifndef CONFIG_KINETIS_SDHC_WIDTH_D1_ONLY - kinetis_pinconfig(PIN_SDHC0_D1); - kinetis_pinconfig(PIN_SDHC0_D2); - kinetis_pinconfig(PIN_SDHC0_D3); + kinetis_pinconfig(PIN_SDHC0_D1 | BOARD_SDHC_PULLUP_ENABLE); + kinetis_pinconfig(PIN_SDHC0_D2 | BOARD_SDHC_PULLUP_ENABLE); + kinetis_pinconfig(PIN_SDHC0_D3 | BOARD_SDHC_PULLUP_ENABLE); /* Data width 8 (not supported) */ #if 0 - kinetis_pinconfig(PIN_SDHC0_D4); - kinetis_pinconfig(PIN_SDHC0_D5); - kinetis_pinconfig(PIN_SDHC0_D6); - kinetis_pinconfig(PIN_SDHC0_D7); + kinetis_pinconfig(PIN_SDHC0_D4 | BOARD_SDHC_PULLUP_ENABLE); + kinetis_pinconfig(PIN_SDHC0_D5 | BOARD_SDHC_PULLUP_ENABLE); + kinetis_pinconfig(PIN_SDHC0_D6 | BOARD_SDHC_PULLUP_ENABLE); + kinetis_pinconfig(PIN_SDHC0_D7 | BOARD_SDHC_PULLUP_ENABLE); #endif #endif /* Clocking and CMD pins (all data widths) */ kinetis_pinconfig(PIN_SDHC0_DCLK); - kinetis_pinconfig(PIN_SDHC0_CMD); + kinetis_pinconfig(PIN_SDHC0_CMD | BOARD_SDHC_PULLUP_ENABLE); #endif /* Reset the card and assure that it is in the initial, unconfigured diff --git a/configs/freedom-k64f/include/board.h b/configs/freedom-k64f/include/board.h index 01d52a622e..62eb2fe5e0 100644 --- a/configs/freedom-k64f/include/board.h +++ b/configs/freedom-k64f/include/board.h @@ -100,6 +100,13 @@ #define BOARD_FLEXBUS_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV3) #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 ********************************************************************/ /* SDCLK configurations corresponding to various modes of operation. Formula is: diff --git a/configs/freedom-k66f/include/board.h b/configs/freedom-k66f/include/board.h index 79d2fa0005..b59515e6d8 100644 --- a/configs/freedom-k66f/include/board.h +++ b/configs/freedom-k66f/include/board.h @@ -143,6 +143,15 @@ #define BOARD_TPM_CLKSRC SIM_SOPT2_TPMSRC_MCGCLK #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 ********************************************************************/ /* SDCLK configurations corresponding to various modes of operation. Formula is: