You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/01/13 04:18:46 UTC
[nuttx] 02/03: boards/arm/cxd56xx/spresense: fix card detect status reading
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 74d5c3948d654358cd68b86604970fe5b152e0c8
Author: Petro Karashchenko <pe...@gmail.com>
AuthorDate: Thu Jan 12 23:28:49 2023 +0200
boards/arm/cxd56xx/spresense: fix card detect status reading
Signed-off-by: Petro Karashchenko <pe...@gmail.com>
---
boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c | 27 ++++++++++---------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c b/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c
index fc9afa9406..152eb1502a 100644
--- a/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c
+++ b/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c
@@ -174,17 +174,15 @@ static void board_sdcard_enable(void *arg)
{
g_sdhci.cb(true);
}
+#else
+ /* Let the automounter know about the insertion event */
+
+ board_automount_event(0, board_sdcard_inserted(0));
#endif /* CONFIG_CXD56_SDCARD_AUTOMOUNT */
g_sdhci.initialized = true;
}
-#ifdef CONFIG_CXD56_SDCARD_AUTOMOUNT
- /* Let the automounter know about the insertion event */
-
- board_automount_event(0, board_sdcard_inserted(0));
-#endif /* CONFIG_CXD56_SDCARD_AUTOMOUNT */
-
release_frequency_lock:
/* Release frequency lock */
@@ -229,14 +227,14 @@ static void board_sdcard_disable(void *arg)
cxd56_sdhci_finalize(0);
- g_sdhci.initialized = false;
- }
-
#ifdef CONFIG_CXD56_SDCARD_AUTOMOUNT
- /* Let the automounter know about the insertion event */
+ /* Let the automounter know about the removal event */
- board_automount_event(0, board_sdcard_inserted(0));
+ board_automount_event(0, board_sdcard_inserted(0));
#endif /* CONFIG_CXD56_SDCARD_AUTOMOUNT */
+
+ g_sdhci.initialized = false;
+ }
}
#ifdef CONFIG_MMCSD_HAVE_CARDDETECT
@@ -344,16 +342,13 @@ int board_sdcard_initialize(void)
/* Configure Interrupt pin with internal pull-up */
cxd56_pin_config(PINCONF_SDIO_CD_GPIO);
+ cxd56_gpioint_config(PIN_SDIO_CD, GPIOINT_PSEUDO_EDGE_BOTH,
+ board_sdcard_detect_int, NULL);
/* Handle the case when SD card is already inserted */
board_sdcard_detect_int(PIN_SDIO_CD, NULL, NULL);
- /* Configure Interrupt pin with internal pull-up */
-
- cxd56_gpioint_config(PIN_SDIO_CD, GPIOINT_PSEUDO_EDGE_BOTH,
- board_sdcard_detect_int, NULL);
-
/* Enabling Interrupt */
cxd56_gpioint_enable(PIN_SDIO_CD);