boards/arm/samv7/common: add HSMCI0 boot mount configuration option

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko 2022-01-24 00:07:28 +02:00
parent c0881feca9
commit 48c7fa6e92
4 changed files with 72 additions and 42 deletions

View File

@ -40,6 +40,27 @@ config SAMV7_HSMCI0_AUTOMOUNT_UDELAY
endif # SAMV7_HSMCI0_AUTOMOUNT
config SAMV7_HSMCI0_MOUNT
bool "HSMCI0 boot mount"
default n
depends on !DISABLE_MOUNTPOINT && SAMV7_HSMCI0 && !SAMV7_HSMCI0_AUTOMOUNT
if SAMV7_HSMCI0_MOUNT
config SAMV7_HSMCI0_MOUNT_FSTYPE
string "HSMCI0 file system type"
default "vfat"
config SAMV7_HSMCI0_MOUNT_BLKDEV
string "HSMCI0 block device"
default "/dev/mmcsd0"
config SAMV7_HSMCI0_MOUNT_MOUNTPOINT
string "HSMCI0 mount point"
default "/bin"
endif # SAMV7_HSMCI0_MOUNT
config SAMV7_PROGMEM_OTA_PARTITION
bool
default n

View File

@ -105,26 +105,29 @@ int sam_bringup(void)
HSMCI0_SLOTNO, HSMCI0_MINOR, ret);
}
#ifdef CONFIG_SAME70QMTECH_HSMCI0_MOUNT
#ifdef CONFIG_SAMV7_HSMCI0_MOUNT
else
{
/* REVISIT: A delay seems to be required here or the mount will fail */
/* Mount the volume on HSMCI0 */
ret = nx_mount(CONFIG_SAMV7_HSMCI0_MOUNT_BLKDEV,
CONFIG_SAMV7_HSMCI0_MOUNT_MOUNTPOINT,
CONFIG_SAMV7_HSMCI0_MOUNT_FSTYPE,
0, NULL);
if (ret < 0)
if (sam_cardinserted(HSMCI0_SLOTNO))
{
syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n",
CONFIG_SAMV7_HSMCI0_MOUNT_MOUNTPOINT, ret);
usleep(1000 * 1000);
/* Mount the volume on HSMCI0 */
ret = nx_mount(CONFIG_SAMV7_HSMCI0_MOUNT_BLKDEV,
CONFIG_SAMV7_HSMCI0_MOUNT_MOUNTPOINT,
CONFIG_SAMV7_HSMCI0_MOUNT_FSTYPE,
0, NULL);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n",
CONFIG_SAMV7_HSMCI0_MOUNT_MOUNTPOINT, ret);
}
}
}
#endif /* CONFIG_SAME70QMTECH_HSMCI0_MOUNT */
#endif /* CONFIG_SAMV7_HSMCI0_MOUNT */
#endif /* HAVE_HSMCI */
#ifdef HAVE_AUTOMOUNTER

View File

@ -196,26 +196,29 @@ int sam_bringup(void)
HSMCI0_SLOTNO, HSMCI0_MINOR, ret);
}
#ifdef CONFIG_SAME70XPLAINED_HSMCI0_MOUNT
#ifdef CONFIG_SAMV7_HSMCI0_MOUNT
else
{
/* REVISIT: A delay seems to be required here or the mount will fail */
/* Mount the volume on HSMCI0 */
ret = nx_mount(CONFIG_SAMV7_HSMCI0_MOUNT_BLKDEV,
CONFIG_SAMV7_HSMCI0_MOUNT_MOUNTPOINT,
CONFIG_SAMV7_HSMCI0_MOUNT_FSTYPE,
0, NULL);
if (ret < 0)
if (sam_cardinserted(HSMCI0_SLOTNO))
{
syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n",
CONFIG_SAMV7_HSMCI0_MOUNT_MOUNTPOINT, ret);
usleep(1000 * 1000);
/* Mount the volume on HSMCI0 */
ret = nx_mount(CONFIG_SAMV7_HSMCI0_MOUNT_BLKDEV,
CONFIG_SAMV7_HSMCI0_MOUNT_MOUNTPOINT,
CONFIG_SAMV7_HSMCI0_MOUNT_FSTYPE,
0, NULL);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n",
CONFIG_SAMV7_HSMCI0_MOUNT_MOUNTPOINT, ret);
}
}
}
#endif /* CONFIG_SAME70XPLAINED_HSMCI0_MOUNT */
#endif /* CONFIG_SAMV7_HSMCI0_MOUNT */
#endif /* HAVE_HSMCI */
#ifdef HAVE_AUTOMOUNTER

View File

@ -313,26 +313,29 @@ int sam_bringup(void)
HSMCI0_SLOTNO, HSMCI0_MINOR, ret);
}
#ifdef CONFIG_SAMV71XULT_HSMCI0_MOUNT
#ifdef CONFIG_SAMV7_HSMCI0_MOUNT
else
{
/* REVISIT: A delay seems to be required here or the mount will fail */
/* Mount the volume on HSMCI0 */
ret = nx_mount(CONFIG_SAMV7_HSMCI0_MOUNT_BLKDEV,
CONFIG_SAMV7_HSMCI0_MOUNT_MOUNTPOINT,
CONFIG_SAMV7_HSMCI0_MOUNT_FSTYPE,
0, NULL);
if (ret < 0)
if (sam_cardinserted(HSMCI0_SLOTNO))
{
syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n",
CONFIG_SAMV7_HSMCI0_MOUNT_MOUNTPOINT, ret);
usleep(1000 * 1000);
/* Mount the volume on HSMCI0 */
ret = nx_mount(CONFIG_SAMV7_HSMCI0_MOUNT_BLKDEV,
CONFIG_SAMV7_HSMCI0_MOUNT_MOUNTPOINT,
CONFIG_SAMV7_HSMCI0_MOUNT_FSTYPE,
0, NULL);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n",
CONFIG_SAMV7_HSMCI0_MOUNT_MOUNTPOINT, ret);
}
}
}
#endif /* CONFIG_SAMV71XULT_HSMCI0_MOUNT */
#endif /* CONFIG_SAMV7_HSMCI0_MOUNT */
#endif /* HAVE_HSMCI */
#ifdef HAVE_AUTOMOUNTER