diff --git a/arch/arm/src/kinetis/Kconfig b/arch/arm/src/kinetis/Kconfig index 3f79442d78..1f267060a8 100644 --- a/arch/arm/src/kinetis/Kconfig +++ b/arch/arm/src/kinetis/Kconfig @@ -973,6 +973,15 @@ config KINETIS_SDHC_DMA For most usages, SD accesses will cause data overruns if used without DMA. +config KINETIS_SDHC_PULLUP + bool "Enable internal Pull-Ups" + default n + ---help--- + If you are using an external SDCard module that does not have the + pull-up resistors for the SDIO interface (like the Gadgeteer SD Card + Module) then enable this option to activate the internal pull-up + resistors. + config KINETIS_SDHC_WIDTH_D1_ONLY bool "Use D1 only" default n diff --git a/arch/arm/src/kinetis/kinetis_sdhc.c b/arch/arm/src/kinetis/kinetis_sdhc.c index 816a4ee18b..bec804cbb5 100644 --- a/arch/arm/src/kinetis/kinetis_sdhc.c +++ b/arch/arm/src/kinetis/kinetis_sdhc.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/kinetis/kinetis_sdhc.c * - * Copyright (C) 2011-2012, 2014, 2016-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2014, 2016-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -98,10 +98,10 @@ * So allow the board config to enable them. */ -#if defined(BOARD_SDHC_ENABLE_PULLUPS) -# define BOARD_SDHC_PULLUP_ENABLE _PIN_INPUT_PULLUP +#if defined(CONFIG_KINETIS_SDHC_PULLUP) +# define SDHC_PULLUP_ENABLE _PIN_INPUT_PULLUP #else -# define BOARD_SDHC_PULLUP_ENABLE 0 +# define SDHC_PULLUP_ENABLE 0 #endif /* SDCLK frequencies corresponding to various modes of operation. These @@ -2861,29 +2861,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 | BOARD_SDHC_PULLUP_ENABLE); + kinetis_pinconfig(PIN_SDHC0_D0 | SDHC_PULLUP_ENABLE); /* Data width 4 or 8 */ #ifndef CONFIG_KINETIS_SDHC_WIDTH_D1_ONLY - 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); + kinetis_pinconfig(PIN_SDHC0_D1 | SDHC_PULLUP_ENABLE); + kinetis_pinconfig(PIN_SDHC0_D2 | SDHC_PULLUP_ENABLE); + kinetis_pinconfig(PIN_SDHC0_D3 | SDHC_PULLUP_ENABLE); /* Data width 8 (not supported) */ #if 0 - 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); + kinetis_pinconfig(PIN_SDHC0_D4 | SDHC_PULLUP_ENABLE); + kinetis_pinconfig(PIN_SDHC0_D5 | SDHC_PULLUP_ENABLE); + kinetis_pinconfig(PIN_SDHC0_D6 | SDHC_PULLUP_ENABLE); + kinetis_pinconfig(PIN_SDHC0_D7 | SDHC_PULLUP_ENABLE); #endif #endif /* Clocking and CMD pins (all data widths) */ kinetis_pinconfig(PIN_SDHC0_DCLK); - kinetis_pinconfig(PIN_SDHC0_CMD | BOARD_SDHC_PULLUP_ENABLE); + kinetis_pinconfig(PIN_SDHC0_CMD | SDHC_PULLUP_ENABLE); #endif /* Reset the card and assure that it is in the initial, unconfigured diff --git a/configs/Kconfig b/configs/Kconfig index b35859bb8c..a5f298fa20 100644 --- a/configs/Kconfig +++ b/configs/Kconfig @@ -226,6 +226,7 @@ config ARCH_BOARD_FREEDOM_K28F select ARCH_HAVE_LEDS if !RGBLED select ARCH_HAVE_BUTTONS select ARCH_HAVE_IRQBUTTONS + select KINETIS_SDHC_PULLUP if KINETIS_SDHC # REVISIT ---help--- development board. This port uses the NXP/FreeScale FREEDOM-K28F development board. This @@ -237,6 +238,7 @@ config ARCH_BOARD_FREEDOM_K64F select ARCH_HAVE_LEDS select ARCH_HAVE_BUTTONS select ARCH_HAVE_IRQBUTTONS + select KINETIS_SDHC_PULLUP if KINETIS_SDHC ---help--- development board. This port uses the NXP/FreeScale FREEDOM-K64F development board. This @@ -248,6 +250,7 @@ config ARCH_BOARD_FREEDOM_K66F select ARCH_HAVE_LEDS select ARCH_HAVE_BUTTONS select ARCH_HAVE_IRQBUTTONS + select KINETIS_SDHC_PULLUP if KINETIS_SDHC ---help--- development board. This port uses the NXP/FreeScale FREEDOM-K66F development board. This diff --git a/configs/freedom-k28f/include/board.h b/configs/freedom-k28f/include/board.h index 3c9cc1d292..2faa558a04 100644 --- a/configs/freedom-k28f/include/board.h +++ b/configs/freedom-k28f/include/board.h @@ -144,15 +144,6 @@ #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-K28F board - * So allow the board config to enable them. - * REVISIT: This was cloned from the K66F. Need to check the K28F schematic. - */ - -#define BOARD_SDHC_ENABLE_PULLUPS 1 - /* SDHC clocking ********************************************************************/ /* SDCLK configurations corresponding to various modes of operation. Formula is: diff --git a/configs/freedom-k64f/include/board.h b/configs/freedom-k64f/include/board.h index 34b682d691..24b2fc02b1 100644 --- a/configs/freedom-k64f/include/board.h +++ b/configs/freedom-k64f/include/board.h @@ -100,13 +100,6 @@ #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 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 ed1fe11345..8dd27a5c1f 100644 --- a/configs/freedom-k66f/include/board.h +++ b/configs/freedom-k66f/include/board.h @@ -143,14 +143,6 @@ #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 board config to enable them. - */ - -#define BOARD_SDHC_ENABLE_PULLUPS 1 - /* SDHC clocking ********************************************************************/ /* SDCLK configurations corresponding to various modes of operation. Formula is: