Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmuk66-v3:Fix hang on SDIO card removal/reinsertion #13440

Merged
merged 1 commit into from
Nov 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions boards/nxp/fmuk66-v3/nuttx-config/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# see misc/tools/kconfig-language.txt.
#

if ARCH_BOARD_NXP_FMUK66_V3
config FMUK66_SDHC_AUTOMOUNT
bool "SDHC automounter"
default n
Expand All @@ -21,7 +20,7 @@ config FMUK66_SDHC_AUTOMOUNT_BLKDEV

config FMUK66_SDHC_AUTOMOUNT_MOUNTPOINT
string "SDHC mount point"
default "/mnt/sdcard"
default "/fs/microsd"

config FMUK66_SDHC_AUTOMOUNT_DDELAY
int "SDHC debounce delay (milliseconds)"
Expand All @@ -46,5 +45,3 @@ config BOARD_USE_PROBES

---help---
Select to use GPIO FMU-CH1-6 to provide timing signals from selected drivers.

endif
8 changes: 7 additions & 1 deletion boards/nxp/fmuk66-v3/nuttx-config/nsh/defconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DISABLE_OS_API is not set
# CONFIG_MMCSD_HAVE_WRITEPROTECT is not set
# CONFIG_MMCSD_SPI is not set
Expand Down Expand Up @@ -170,7 +177,6 @@ CONFIG_SDCLONE_DISABLE=y
CONFIG_SEM_NNESTPRIO=8
CONFIG_SEM_PREALLOCHOLDERS=0
CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_SIG_DEFAULT=y
CONFIG_SIG_SIGALRM_ACTION=y
CONFIG_SIG_SIGUSR1_ACTION=y
Expand Down
2 changes: 1 addition & 1 deletion boards/nxp/fmuk66-v3/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ __BEGIN_DECLS
*/
#define SD_CAED_P_EN (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTD | PIN6)

#define GPIO_SD_CARDDETECT (GPIO_PULLUP | PIN_INT_BOTH | PIN_PORTD | PIN10)
//#define GPIO_SD_CARDDETECT (GPIO_PULLUP | PIN_INT_BOTH | PIN_PORTD | PIN10)

/* SPI
*
Expand Down
9 changes: 8 additions & 1 deletion boards/nxp/fmuk66-v3/src/sdhc.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ static struct fmuk66_sdhc_state_s g_sdhc;
* Private Functions
****************************************************************************/

#if defined(GPIO_SD_CARDDETECT)
/****************************************************************************
* Name: fmuk66_mediachange
****************************************************************************/
Expand Down Expand Up @@ -143,6 +144,7 @@ static int fmuk66_cdinterrupt(int irq, FAR void *context, FAR void *args)
fmuk66_mediachange((struct fmuk66_sdhc_state_s *) args);
return OK;
}
#endif

/****************************************************************************
* Public Functions
Expand All @@ -164,12 +166,13 @@ int fmuk66_sdhc_initialize(void)

VDD_3V3_SD_CARD_EN(true);

#if defined(GPIO_SD_CARDDETECT)
kinetis_pinconfig(GPIO_SD_CARDDETECT);

/* Attached the card detect interrupt (but don't enable it yet) */

kinetis_pinirqattach(GPIO_SD_CARDDETECT, fmuk66_cdinterrupt, sdhc);

#endif
/* Configure the write protect GPIO -- None */

/* Mount the SDHC-based MMC/SD block driver */
Expand Down Expand Up @@ -210,13 +213,17 @@ int fmuk66_sdhc_initialize(void)

syslog(LOG_ERR, "Successfully bound SDHC to the MMC/SD driver\n");

#if defined(GPIO_SD_CARDDETECT)
/* Handle the initial card state */

fmuk66_mediachange(sdhc);

/* Enable CD interrupts to handle subsequent media changes */

kinetis_pinirqenable(GPIO_SD_CARDDETECT);
#else
sdhc_mediachange(sdhc->sdhc, true);
#endif
return OK;
}

Expand Down