arch/arm/src/kinetis + SDHC configs: Make Kinetis SDHC pullups work the same as the STM32 SDIO pullups

This commit is contained in:
Gregory Nutt 2018-05-12 17:12:58 -06:00
parent df3d9dd357
commit aec56484ab
6 changed files with 25 additions and 37 deletions

View File

@ -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

View File

@ -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 <gnutt@nuttx.org>
*
* 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

View File

@ -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

View File

@ -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:

View File

@ -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:

View File

@ -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: