Freedom K64F: SDHC-related changes from bring-up testing.

This commit is contained in:
Gregory Nutt 2016-07-13 14:26:18 -06:00
parent 6fda036615
commit 02eda2fdec
5 changed files with 25 additions and 16 deletions

View File

@ -8,7 +8,7 @@ if ARCH_BOARD_FREEDOM_K64F
config FRDMK64F_SDHC_AUTOMOUNT
bool "SDHC automounter"
default n
depends on FS_AUTOMOUNTER && SAMA5_SDHC
depends on FS_AUTOMOUNTER && KINETIS_SDHC
if FRDMK64F_SDHC_AUTOMOUNT
@ -22,7 +22,7 @@ config FRDMK64F_SDHC_AUTOMOUNT_BLKDEV
config FRDMK64F_SDHC_AUTOMOUNT_MOUNTPOINT
string "SDHC mount point"
default "/mnt/sdcard0"
default "/mnt/sdcard"
config FRDMK64F_SDHC_AUTOMOUNT_DDELAY
int "SDHC debounce delay (milliseconds)"
@ -33,5 +33,4 @@ config FRDMK64F_SDHC_AUTOMOUNT_UDELAY
default 2000
endif # FRDMK64F_SDHC_AUTOMOUNT
endif
endif # ARCH_BOARD_FREEDOM_K64F

View File

@ -853,6 +853,9 @@ Status
2016-07-13: Add SD automounter logic; broke out SDHC logic into a separate
file. The nsh configuration now has SDHC enabled be default. Does not
yet work. You might want to disable SDHC and MMC/SD if you are using
yet work. The basic problem seems to be that it does not sense the
presence of the SD card on PTE6. No interrupts are generated when the
SD card is inserted or removed. You might want to disable SDHC and
MMC/SD if you are using
this configuration.

View File

@ -134,7 +134,7 @@
# endif
# ifndef CONFIG_FRDMK64F_SDHC_AUTOMOUNT_MOUNTPOINT
# define CONFIG_FRDMK64F_SDHC_AUTOMOUNT_MOUNTPOINT "/mnt/sdcard0"
# define CONFIG_FRDMK64F_SDHC_AUTOMOUNT_MOUNTPOINT "/mnt/sdcard"
# endif
# ifndef CONFIG_FRDMK64F_SDHC_AUTOMOUNT_DDELAY

View File

@ -149,7 +149,7 @@ static int k64_attach(FAR const struct automount_lower_s *lower,
/* Recover references to our structure */
config = (FAR struct k64_automount_config_s *)lower;
DEBUGASSERT(config && config->state);
DEBUGASSERT(config != NULL && config->state != NULL);
state = config->state;
@ -188,7 +188,7 @@ static void k64_enable(FAR const struct automount_lower_s *lower, bool enable)
/* Recover references to our structure */
config = (FAR struct k64_automount_config_s *)lower;
DEBUGASSERT(config && config->state);
DEBUGASSERT(config != NULL && config->state != NULL);
state = config->state;
@ -231,11 +231,6 @@ static void k64_enable(FAR const struct automount_lower_s *lower, bool enable)
static bool k64_inserted(FAR const struct automount_lower_s *lower)
{
FAR const struct k64_automount_config_s *config;
config = (FAR struct k64_automount_config_s *)lower;
DEBUGASSERT(config && config->state);
return k64_cardinserted();
}

View File

@ -114,11 +114,14 @@ static void k64_mediachange(void)
*/
inserted = !kinetis_gpioread(GPIO_SD_CARDDETECT);
mcinfo("inserted: %s\n", inserted ? "Yes" : "No");
/* Has the pin changed state? */
if (inserted != g_sdhc.inserted)
{
mcinfo("Media change: %d->%d\n", g_sdhc.inserted, inserted);
/* Yes.. perform the appropriate action (this might need some debounce). */
g_sdhc.inserted = inserted;
@ -127,7 +130,7 @@ static void k64_mediachange(void)
#ifdef CONFIG_FRDMK64F_SDHC_AUTOMOUNT
/* Let the automounter know about the insertion event */
k64_automount_event(SDHC0_SLOTNO, k64_cardinserted());
k64_automount_event(k64_cardinserted());
#endif
}
}
@ -162,9 +165,10 @@ int k64_sdhc_initialize(void)
/* Configure GPIO pins */
kinetis_pinconfig(GPIO_SD_CARDDETECT);
/* Attached the card detect interrupt (but don't enable it yet) */
kinetis_pinconfig(GPIO_SD_CARDDETECT);
kinetis_pinirqattach(GPIO_SD_CARDDETECT, k64_cdinterrupt);
/* Configure the write protect GPIO -- None */
@ -215,7 +219,15 @@ int k64_sdhc_initialize(void)
#ifdef HAVE_AUTOMOUNTER
bool k64_cardinserted(void)
{
return !kinetis_gpioread(GPIO_SD_CARDDETECT);
bool inserted;
/* Get the current value of the card detect pin. This pin is pulled up on
* board. So low means that a card is present.
*/
inserted = !kinetis_gpioread(GPIO_SD_CARDDETECT);
mcinfo("inserted: %s\n", inserted ? "Yes" : "No");
return inserted;
}
#endif