mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 05:42:05 +08:00
boards: spresense: Add board function for eMMC finalization
- Un-mount the FAT filesystem for eMMC - Un-initialize eMMC driver - Turn off the eMMC device
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
@@ -84,3 +86,44 @@ int board_emmc_initialize(void)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_emmc_finalize
|
||||
*
|
||||
* Description:
|
||||
* Finalize the eMMC device and umount the file system.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_emmc_finalize(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Un-mount the eMMC device */
|
||||
|
||||
ret = nx_umount2("/mnt/emmc", MNT_DETACH);
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: Failed to umount the eMMC. %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Uninitialize the eMMC device */
|
||||
|
||||
ret = cxd56_emmcuninitialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: Failed to uninitialize eMMC. %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Power off the eMMC device */
|
||||
|
||||
ret = board_power_control(POWER_EMMC, false);
|
||||
if (ret)
|
||||
{
|
||||
ferr("ERROR: Failed to power off eMMC. %d\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ extern "C"
|
||||
|
||||
#ifdef CONFIG_CXD56_EMMC
|
||||
int board_emmc_initialize(void);
|
||||
int board_emmc_finalize(void);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
|
||||
Reference in New Issue
Block a user