mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
Freedom K64F: SDHC-related changes from bring-up testing.
This commit is contained in:
@@ -8,7 +8,7 @@ if ARCH_BOARD_FREEDOM_K64F
|
|||||||
config FRDMK64F_SDHC_AUTOMOUNT
|
config FRDMK64F_SDHC_AUTOMOUNT
|
||||||
bool "SDHC automounter"
|
bool "SDHC automounter"
|
||||||
default n
|
default n
|
||||||
depends on FS_AUTOMOUNTER && SAMA5_SDHC
|
depends on FS_AUTOMOUNTER && KINETIS_SDHC
|
||||||
|
|
||||||
if FRDMK64F_SDHC_AUTOMOUNT
|
if FRDMK64F_SDHC_AUTOMOUNT
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ config FRDMK64F_SDHC_AUTOMOUNT_BLKDEV
|
|||||||
|
|
||||||
config FRDMK64F_SDHC_AUTOMOUNT_MOUNTPOINT
|
config FRDMK64F_SDHC_AUTOMOUNT_MOUNTPOINT
|
||||||
string "SDHC mount point"
|
string "SDHC mount point"
|
||||||
default "/mnt/sdcard0"
|
default "/mnt/sdcard"
|
||||||
|
|
||||||
config FRDMK64F_SDHC_AUTOMOUNT_DDELAY
|
config FRDMK64F_SDHC_AUTOMOUNT_DDELAY
|
||||||
int "SDHC debounce delay (milliseconds)"
|
int "SDHC debounce delay (milliseconds)"
|
||||||
@@ -33,5 +33,4 @@ config FRDMK64F_SDHC_AUTOMOUNT_UDELAY
|
|||||||
default 2000
|
default 2000
|
||||||
|
|
||||||
endif # FRDMK64F_SDHC_AUTOMOUNT
|
endif # FRDMK64F_SDHC_AUTOMOUNT
|
||||||
|
endif # ARCH_BOARD_FREEDOM_K64F
|
||||||
endif
|
|
||||||
|
|||||||
@@ -853,6 +853,9 @@ Status
|
|||||||
|
|
||||||
2016-07-13: Add SD automounter logic; broke out SDHC logic into a separate
|
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
|
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.
|
this configuration.
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef CONFIG_FRDMK64F_SDHC_AUTOMOUNT_MOUNTPOINT
|
# ifndef CONFIG_FRDMK64F_SDHC_AUTOMOUNT_MOUNTPOINT
|
||||||
# define CONFIG_FRDMK64F_SDHC_AUTOMOUNT_MOUNTPOINT "/mnt/sdcard0"
|
# define CONFIG_FRDMK64F_SDHC_AUTOMOUNT_MOUNTPOINT "/mnt/sdcard"
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef CONFIG_FRDMK64F_SDHC_AUTOMOUNT_DDELAY
|
# ifndef CONFIG_FRDMK64F_SDHC_AUTOMOUNT_DDELAY
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ static int k64_attach(FAR const struct automount_lower_s *lower,
|
|||||||
/* Recover references to our structure */
|
/* Recover references to our structure */
|
||||||
|
|
||||||
config = (FAR struct k64_automount_config_s *)lower;
|
config = (FAR struct k64_automount_config_s *)lower;
|
||||||
DEBUGASSERT(config && config->state);
|
DEBUGASSERT(config != NULL && config->state != NULL);
|
||||||
|
|
||||||
state = config->state;
|
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 */
|
/* Recover references to our structure */
|
||||||
|
|
||||||
config = (FAR struct k64_automount_config_s *)lower;
|
config = (FAR struct k64_automount_config_s *)lower;
|
||||||
DEBUGASSERT(config && config->state);
|
DEBUGASSERT(config != NULL && config->state != NULL);
|
||||||
|
|
||||||
state = config->state;
|
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)
|
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();
|
return k64_cardinserted();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,11 +114,14 @@ static void k64_mediachange(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
inserted = !kinetis_gpioread(GPIO_SD_CARDDETECT);
|
inserted = !kinetis_gpioread(GPIO_SD_CARDDETECT);
|
||||||
|
mcinfo("inserted: %s\n", inserted ? "Yes" : "No");
|
||||||
|
|
||||||
/* Has the pin changed state? */
|
/* Has the pin changed state? */
|
||||||
|
|
||||||
if (inserted != g_sdhc.inserted)
|
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). */
|
/* Yes.. perform the appropriate action (this might need some debounce). */
|
||||||
|
|
||||||
g_sdhc.inserted = inserted;
|
g_sdhc.inserted = inserted;
|
||||||
@@ -127,7 +130,7 @@ static void k64_mediachange(void)
|
|||||||
#ifdef CONFIG_FRDMK64F_SDHC_AUTOMOUNT
|
#ifdef CONFIG_FRDMK64F_SDHC_AUTOMOUNT
|
||||||
/* Let the automounter know about the insertion event */
|
/* Let the automounter know about the insertion event */
|
||||||
|
|
||||||
k64_automount_event(SDHC0_SLOTNO, k64_cardinserted());
|
k64_automount_event(k64_cardinserted());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,9 +165,10 @@ int k64_sdhc_initialize(void)
|
|||||||
|
|
||||||
/* Configure GPIO pins */
|
/* Configure GPIO pins */
|
||||||
|
|
||||||
|
kinetis_pinconfig(GPIO_SD_CARDDETECT);
|
||||||
|
|
||||||
/* Attached the card detect interrupt (but don't enable it yet) */
|
/* Attached the card detect interrupt (but don't enable it yet) */
|
||||||
|
|
||||||
kinetis_pinconfig(GPIO_SD_CARDDETECT);
|
|
||||||
kinetis_pinirqattach(GPIO_SD_CARDDETECT, k64_cdinterrupt);
|
kinetis_pinirqattach(GPIO_SD_CARDDETECT, k64_cdinterrupt);
|
||||||
|
|
||||||
/* Configure the write protect GPIO -- None */
|
/* Configure the write protect GPIO -- None */
|
||||||
@@ -215,7 +219,15 @@ int k64_sdhc_initialize(void)
|
|||||||
#ifdef HAVE_AUTOMOUNTER
|
#ifdef HAVE_AUTOMOUNTER
|
||||||
bool k64_cardinserted(void)
|
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
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user