drivers: disk: mmc_subsys: remove CONFIG_MMC_VOLUME_NAME
Remove CONFIG_MMC_VOLUME_NAME, and set the disk name based on the ``disk-name`` property. This aligns with other disk drivers, and allows for multiple instances of the mmc_subsys disk driver to be registered. Add disk-name properties for all in tree definitions for the mmc-subsys disk driver, and change all in tree usage of the disk name Fixes #75004 Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
parent
a1dc0b8b3e
commit
07a8e3253a
|
@ -371,6 +371,7 @@ zephyr_udc0: &usbhs {
|
|||
cd-gpios = <&gpio2 9 GPIO_ACTIVE_LOW>;
|
||||
mmc {
|
||||
compatible = "zephyr,mmc-disk";
|
||||
disk-name = "SD2";
|
||||
status = "okay";
|
||||
};
|
||||
pinctrl-0 = <&pinmux_usdhc>;
|
||||
|
|
|
@ -94,6 +94,7 @@
|
|||
pinctrl-names = "default", "uhs";
|
||||
disk {
|
||||
compatible = "zephyr,mmc-disk";
|
||||
disk-name = "SD2";
|
||||
status = "disabled";
|
||||
};
|
||||
bus-width = <8>;
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
pinctrl-names = "default", "uhs";
|
||||
disk {
|
||||
compatible = "zephyr,mmc-disk";
|
||||
disk-name = "SD2";
|
||||
status = "disabled";
|
||||
};
|
||||
bus-width = <8>;
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
pinctrl-names = "default", "uhs";
|
||||
disk {
|
||||
compatible = "zephyr,mmc-disk";
|
||||
disk-name = "SD2";
|
||||
status = "okay";
|
||||
};
|
||||
bus-width = <8>;
|
||||
|
|
|
@ -323,9 +323,8 @@ or SD Card to the host. Only one disk instance can be exported at a time.
|
|||
The disc to be used by the implementation is set by the
|
||||
:kconfig:option:`CONFIG_MASS_STORAGE_DISK_NAME` and should be the same as the
|
||||
name used by the disc access driver that the application wants to expose to the
|
||||
host. MMC disk drivers use option :kconfig:option:`CONFIG_MMC_VOLUME_NAME`, or
|
||||
flash, RAM, and SDMMC disk drivers use node property ``disk-name`` to set
|
||||
the disk name.
|
||||
host. Flash, RAM, and SDMMC/MMC disk drivers use node property ``disk-name`` to
|
||||
set the disk name.
|
||||
|
||||
For the emulated block device on a flash partition, the flash partition and
|
||||
flash disk to be used must be described in the devicetree. If a storage partition
|
||||
|
|
|
@ -16,13 +16,6 @@ config SD_INIT_PRIORITY
|
|||
help
|
||||
MMC controller driver initialization priority.
|
||||
|
||||
config MMC_VOLUME_NAME
|
||||
string "MMC Disk mount point or drive name"
|
||||
default "SD" if FAT_FILESYSTEM_ELM
|
||||
default "MMC"
|
||||
help
|
||||
Disk name as per file system naming guidelines.
|
||||
|
||||
config MMC_SUBSYS
|
||||
bool "MMC access via SD subsystem"
|
||||
select MMC_STACK
|
||||
|
|
|
@ -27,7 +27,7 @@ struct mmc_config {
|
|||
struct mmc_data {
|
||||
struct sd_card card;
|
||||
enum sd_status status;
|
||||
char *name;
|
||||
struct disk_info *disk_info;
|
||||
};
|
||||
|
||||
|
||||
|
@ -107,10 +107,6 @@ static const struct disk_operations mmc_disk_ops = {
|
|||
.ioctl = disk_mmc_access_ioctl,
|
||||
};
|
||||
|
||||
static struct disk_info mmc_disk = {
|
||||
.ops = &mmc_disk_ops,
|
||||
};
|
||||
|
||||
static int disk_mmc_init(const struct device *dev)
|
||||
{
|
||||
struct mmc_data *data = dev->data;
|
||||
|
@ -118,10 +114,8 @@ static int disk_mmc_init(const struct device *dev)
|
|||
|
||||
data->status = SD_UNINIT;
|
||||
data->card.bus_width = config->bus_width;
|
||||
mmc_disk.dev = dev;
|
||||
mmc_disk.name = data->name;
|
||||
|
||||
return disk_access_register(&mmc_disk);
|
||||
return disk_access_register(data->disk_info);
|
||||
}
|
||||
|
||||
#define DISK_ACCESS_MMC_INIT(n) \
|
||||
|
@ -130,8 +124,14 @@ static int disk_mmc_init(const struct device *dev)
|
|||
.bus_width = DT_INST_PROP(n, bus_width), \
|
||||
}; \
|
||||
\
|
||||
static struct disk_info mmc_disk_##n = { \
|
||||
.name = DT_INST_PROP(n, disk_name), \
|
||||
.ops = &mmc_disk_ops, \
|
||||
.dev = DEVICE_DT_INST_GET(n), \
|
||||
}; \
|
||||
\
|
||||
static struct mmc_data mmc_data_##n = { \
|
||||
.name = CONFIG_MMC_VOLUME_NAME, \
|
||||
.disk_info = &mmc_disk_##n, \
|
||||
}; \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(n, \
|
||||
|
|
|
@ -19,3 +19,9 @@ properties:
|
|||
- 1
|
||||
- 4
|
||||
- 8
|
||||
|
||||
disk-name:
|
||||
type: string
|
||||
required: true
|
||||
description: |
|
||||
Disk name.
|
||||
|
|
|
@ -348,6 +348,7 @@
|
|||
|
||||
mmc {
|
||||
compatible = "zephyr,mmc-disk";
|
||||
disk-name = "SD2";
|
||||
bus-width = <8>;
|
||||
status = "okay";
|
||||
};
|
||||
|
|
|
@ -22,7 +22,12 @@
|
|||
* Note the fatfs library is able to mount only strings inside _VOLUME_STRS
|
||||
* in ffconf.h
|
||||
*/
|
||||
#if defined(CONFIG_DISK_DRIVER_MMC)
|
||||
#define DISK_DRIVE_NAME "SD2"
|
||||
#else
|
||||
#define DISK_DRIVE_NAME "SD"
|
||||
#endif
|
||||
|
||||
#define DISK_MOUNT_PT "/"DISK_DRIVE_NAME":"
|
||||
|
||||
static FATFS fat_fs;
|
||||
|
|
|
@ -99,9 +99,9 @@ following logic:
|
|||
* if the :kconfig:option:`CONFIG_DISK_DRIVER_SDMMC` configuration is defined, ``"SD"``
|
||||
will be used as the mount point name;
|
||||
* if the :kconfig:option:`CONFIG_DISK_DRIVER_SDMMC` configuration is not defined, but the
|
||||
:kconfig:option:`CONFIG_MMC_VOLUME_NAME` configuration is defined,
|
||||
:kconfig:option:`CONFIG_MMC_VOLUME_NAME` will be used as the mount point name;
|
||||
* if neither :kconfig:option:`CONFIG_SDMMC_VOLUME_NAME` nor :kconfig:option:`CONFIG_MMC_VOLUME_NAME`
|
||||
:kconfig:option:`CONFIG_DISK_DRIVER_MMC` configuration is defined, ``"SD2"`` will
|
||||
be used as the mount point name;
|
||||
* if neither :kconfig:option:`CONFIG_DISK_DRIVER_SDMMC` nor :kconfig:option:`CONFIG_DISK_DRIVER_MMC`
|
||||
configurations are defined, the mount point name will not be determined, and an appropriate error
|
||||
will appear during the sample build.
|
||||
|
||||
|
|
|
@ -313,7 +313,7 @@ static int littlefs_mount(struct fs_mount_t *mp)
|
|||
#if defined(CONFIG_DISK_DRIVER_SDMMC)
|
||||
#define DISK_NAME "SD"
|
||||
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
||||
#define DISK_NAME CONFIG_MMC_VOLUME_NAME
|
||||
#define DISK_NAME "SD2"
|
||||
#else
|
||||
#error "No disk device defined, is your board supported?"
|
||||
#endif
|
||||
|
|
|
@ -42,7 +42,7 @@ static struct fs_mount_t fatfs_mnt = {
|
|||
#if defined(CONFIG_DISK_DRIVER_SDMMC)
|
||||
#define DISK_NAME "SD"
|
||||
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
||||
#define DISK_NAME CONFIG_MMC_VOLUME_NAME
|
||||
#define DISK_NAME "SD2"
|
||||
#else
|
||||
#error "No disk device defined, is your board supported?"
|
||||
#endif
|
||||
|
|
|
@ -17,6 +17,7 @@ sdhc@0 {
|
|||
|
||||
mmc {
|
||||
compatible = "zephyr,mmc-disk";
|
||||
disk-name = "SD2";
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#if defined(CONFIG_DISK_DRIVER_SDMMC)
|
||||
#define DISK_NAME_PHYS "SD"
|
||||
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
||||
#define DISK_NAME_PHYS CONFIG_MMC_VOLUME_NAME
|
||||
#define DISK_NAME_PHYS "SD2"
|
||||
#elif defined(CONFIG_DISK_DRIVER_FLASH)
|
||||
#define DISK_NAME_PHYS "NAND"
|
||||
#elif defined(CONFIG_NVME)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#if defined(CONFIG_DISK_DRIVER_SDMMC)
|
||||
#define DISK_NAME "SD"
|
||||
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
||||
#define DISK_NAME CONFIG_MMC_VOLUME_NAME
|
||||
#define DISK_NAME "SD2"
|
||||
#elif defined(CONFIG_NVME)
|
||||
#define DISK_NAME "nvme0n0"
|
||||
#else
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#ifdef CONFIG_DISK_DRIVER_SDMMC
|
||||
#define DISK_NAME "SD"
|
||||
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
||||
#define DISK_NAME CONFIG_MMC_VOLUME_NAME
|
||||
#define DISK_NAME "SD2"
|
||||
#else
|
||||
#error "No disk device defined, is your board supported?"
|
||||
#endif /* CONFIG_DISK_DRIVER_SDMMC */
|
||||
|
|
|
@ -4,5 +4,4 @@ CONFIG_FAT_FILESYSTEM_ELM=y
|
|||
CONFIG_SPI=y
|
||||
CONFIG_GPIO=y
|
||||
CONFIG_ZTEST=y
|
||||
CONFIG_MMC_VOLUME_NAME="NAND"
|
||||
CONFIG_MAIN_STACK_SIZE=4096
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#elif defined(CONFIG_DISK_DRIVER_SDMMC)
|
||||
#define DISK_NAME "SD"
|
||||
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
||||
#define DISK_NAME CONFIG_MMC_VOLUME_NAME
|
||||
#define DISK_NAME "SD2"
|
||||
#else
|
||||
#error "Failed to select DISK access type"
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue