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
19 changed files with 37 additions and 29 deletions
|
|
@ -371,6 +371,7 @@ zephyr_udc0: &usbhs {
|
||||||
cd-gpios = <&gpio2 9 GPIO_ACTIVE_LOW>;
|
cd-gpios = <&gpio2 9 GPIO_ACTIVE_LOW>;
|
||||||
mmc {
|
mmc {
|
||||||
compatible = "zephyr,mmc-disk";
|
compatible = "zephyr,mmc-disk";
|
||||||
|
disk-name = "SD2";
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
pinctrl-0 = <&pinmux_usdhc>;
|
pinctrl-0 = <&pinmux_usdhc>;
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@
|
||||||
pinctrl-names = "default", "uhs";
|
pinctrl-names = "default", "uhs";
|
||||||
disk {
|
disk {
|
||||||
compatible = "zephyr,mmc-disk";
|
compatible = "zephyr,mmc-disk";
|
||||||
|
disk-name = "SD2";
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
bus-width = <8>;
|
bus-width = <8>;
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@
|
||||||
pinctrl-names = "default", "uhs";
|
pinctrl-names = "default", "uhs";
|
||||||
disk {
|
disk {
|
||||||
compatible = "zephyr,mmc-disk";
|
compatible = "zephyr,mmc-disk";
|
||||||
|
disk-name = "SD2";
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
bus-width = <8>;
|
bus-width = <8>;
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@
|
||||||
pinctrl-names = "default", "uhs";
|
pinctrl-names = "default", "uhs";
|
||||||
disk {
|
disk {
|
||||||
compatible = "zephyr,mmc-disk";
|
compatible = "zephyr,mmc-disk";
|
||||||
|
disk-name = "SD2";
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
bus-width = <8>;
|
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
|
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
|
: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
|
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
|
host. Flash, RAM, and SDMMC/MMC disk drivers use node property ``disk-name`` to
|
||||||
flash, RAM, and SDMMC disk drivers use node property ``disk-name`` to set
|
set the disk name.
|
||||||
the disk name.
|
|
||||||
|
|
||||||
For the emulated block device on a flash partition, the flash partition and
|
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
|
flash disk to be used must be described in the devicetree. If a storage partition
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,6 @@ config SD_INIT_PRIORITY
|
||||||
help
|
help
|
||||||
MMC controller driver initialization priority.
|
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
|
config MMC_SUBSYS
|
||||||
bool "MMC access via SD subsystem"
|
bool "MMC access via SD subsystem"
|
||||||
select MMC_STACK
|
select MMC_STACK
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ struct mmc_config {
|
||||||
struct mmc_data {
|
struct mmc_data {
|
||||||
struct sd_card card;
|
struct sd_card card;
|
||||||
enum sd_status status;
|
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,
|
.ioctl = disk_mmc_access_ioctl,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct disk_info mmc_disk = {
|
|
||||||
.ops = &mmc_disk_ops,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int disk_mmc_init(const struct device *dev)
|
static int disk_mmc_init(const struct device *dev)
|
||||||
{
|
{
|
||||||
struct mmc_data *data = dev->data;
|
struct mmc_data *data = dev->data;
|
||||||
|
|
@ -118,10 +114,8 @@ static int disk_mmc_init(const struct device *dev)
|
||||||
|
|
||||||
data->status = SD_UNINIT;
|
data->status = SD_UNINIT;
|
||||||
data->card.bus_width = config->bus_width;
|
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) \
|
#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), \
|
.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 = { \
|
static struct mmc_data mmc_data_##n = { \
|
||||||
.name = CONFIG_MMC_VOLUME_NAME, \
|
.disk_info = &mmc_disk_##n, \
|
||||||
}; \
|
}; \
|
||||||
\
|
\
|
||||||
DEVICE_DT_INST_DEFINE(n, \
|
DEVICE_DT_INST_DEFINE(n, \
|
||||||
|
|
|
||||||
|
|
@ -19,3 +19,9 @@ properties:
|
||||||
- 1
|
- 1
|
||||||
- 4
|
- 4
|
||||||
- 8
|
- 8
|
||||||
|
|
||||||
|
disk-name:
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
description: |
|
||||||
|
Disk name.
|
||||||
|
|
|
||||||
|
|
@ -348,6 +348,7 @@
|
||||||
|
|
||||||
mmc {
|
mmc {
|
||||||
compatible = "zephyr,mmc-disk";
|
compatible = "zephyr,mmc-disk";
|
||||||
|
disk-name = "SD2";
|
||||||
bus-width = <8>;
|
bus-width = <8>;
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,12 @@
|
||||||
* Note the fatfs library is able to mount only strings inside _VOLUME_STRS
|
* Note the fatfs library is able to mount only strings inside _VOLUME_STRS
|
||||||
* in ffconf.h
|
* in ffconf.h
|
||||||
*/
|
*/
|
||||||
|
#if defined(CONFIG_DISK_DRIVER_MMC)
|
||||||
|
#define DISK_DRIVE_NAME "SD2"
|
||||||
|
#else
|
||||||
#define DISK_DRIVE_NAME "SD"
|
#define DISK_DRIVE_NAME "SD"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DISK_MOUNT_PT "/"DISK_DRIVE_NAME":"
|
#define DISK_MOUNT_PT "/"DISK_DRIVE_NAME":"
|
||||||
|
|
||||||
static FATFS fat_fs;
|
static FATFS fat_fs;
|
||||||
|
|
|
||||||
|
|
@ -99,9 +99,9 @@ following logic:
|
||||||
* if the :kconfig:option:`CONFIG_DISK_DRIVER_SDMMC` configuration is defined, ``"SD"``
|
* if the :kconfig:option:`CONFIG_DISK_DRIVER_SDMMC` configuration is defined, ``"SD"``
|
||||||
will be used as the mount point name;
|
will be used as the mount point name;
|
||||||
* if the :kconfig:option:`CONFIG_DISK_DRIVER_SDMMC` configuration is not defined, but the
|
* 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_DISK_DRIVER_MMC` configuration is defined, ``"SD2"`` will
|
||||||
:kconfig:option:`CONFIG_MMC_VOLUME_NAME` will be used as the mount point name;
|
be used as the mount point name;
|
||||||
* if neither :kconfig:option:`CONFIG_SDMMC_VOLUME_NAME` nor :kconfig:option:`CONFIG_MMC_VOLUME_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
|
configurations are defined, the mount point name will not be determined, and an appropriate error
|
||||||
will appear during the sample build.
|
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)
|
#if defined(CONFIG_DISK_DRIVER_SDMMC)
|
||||||
#define DISK_NAME "SD"
|
#define DISK_NAME "SD"
|
||||||
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
||||||
#define DISK_NAME CONFIG_MMC_VOLUME_NAME
|
#define DISK_NAME "SD2"
|
||||||
#else
|
#else
|
||||||
#error "No disk device defined, is your board supported?"
|
#error "No disk device defined, is your board supported?"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ static struct fs_mount_t fatfs_mnt = {
|
||||||
#if defined(CONFIG_DISK_DRIVER_SDMMC)
|
#if defined(CONFIG_DISK_DRIVER_SDMMC)
|
||||||
#define DISK_NAME "SD"
|
#define DISK_NAME "SD"
|
||||||
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
||||||
#define DISK_NAME CONFIG_MMC_VOLUME_NAME
|
#define DISK_NAME "SD2"
|
||||||
#else
|
#else
|
||||||
#error "No disk device defined, is your board supported?"
|
#error "No disk device defined, is your board supported?"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ sdhc@0 {
|
||||||
|
|
||||||
mmc {
|
mmc {
|
||||||
compatible = "zephyr,mmc-disk";
|
compatible = "zephyr,mmc-disk";
|
||||||
|
disk-name = "SD2";
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#if defined(CONFIG_DISK_DRIVER_SDMMC)
|
#if defined(CONFIG_DISK_DRIVER_SDMMC)
|
||||||
#define DISK_NAME_PHYS "SD"
|
#define DISK_NAME_PHYS "SD"
|
||||||
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
#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)
|
#elif defined(CONFIG_DISK_DRIVER_FLASH)
|
||||||
#define DISK_NAME_PHYS "NAND"
|
#define DISK_NAME_PHYS "NAND"
|
||||||
#elif defined(CONFIG_NVME)
|
#elif defined(CONFIG_NVME)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
#if defined(CONFIG_DISK_DRIVER_SDMMC)
|
#if defined(CONFIG_DISK_DRIVER_SDMMC)
|
||||||
#define DISK_NAME "SD"
|
#define DISK_NAME "SD"
|
||||||
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
||||||
#define DISK_NAME CONFIG_MMC_VOLUME_NAME
|
#define DISK_NAME "SD2"
|
||||||
#elif defined(CONFIG_NVME)
|
#elif defined(CONFIG_NVME)
|
||||||
#define DISK_NAME "nvme0n0"
|
#define DISK_NAME "nvme0n0"
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#ifdef CONFIG_DISK_DRIVER_SDMMC
|
#ifdef CONFIG_DISK_DRIVER_SDMMC
|
||||||
#define DISK_NAME "SD"
|
#define DISK_NAME "SD"
|
||||||
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
||||||
#define DISK_NAME CONFIG_MMC_VOLUME_NAME
|
#define DISK_NAME "SD2"
|
||||||
#else
|
#else
|
||||||
#error "No disk device defined, is your board supported?"
|
#error "No disk device defined, is your board supported?"
|
||||||
#endif /* CONFIG_DISK_DRIVER_SDMMC */
|
#endif /* CONFIG_DISK_DRIVER_SDMMC */
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,4 @@ CONFIG_FAT_FILESYSTEM_ELM=y
|
||||||
CONFIG_SPI=y
|
CONFIG_SPI=y
|
||||||
CONFIG_GPIO=y
|
CONFIG_GPIO=y
|
||||||
CONFIG_ZTEST=y
|
CONFIG_ZTEST=y
|
||||||
CONFIG_MMC_VOLUME_NAME="NAND"
|
|
||||||
CONFIG_MAIN_STACK_SIZE=4096
|
CONFIG_MAIN_STACK_SIZE=4096
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
#elif defined(CONFIG_DISK_DRIVER_SDMMC)
|
#elif defined(CONFIG_DISK_DRIVER_SDMMC)
|
||||||
#define DISK_NAME "SD"
|
#define DISK_NAME "SD"
|
||||||
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
#elif defined(CONFIG_DISK_DRIVER_MMC)
|
||||||
#define DISK_NAME CONFIG_MMC_VOLUME_NAME
|
#define DISK_NAME "SD2"
|
||||||
#else
|
#else
|
||||||
#error "Failed to select DISK access type"
|
#error "Failed to select DISK access type"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue