drivers: disk: sdmmc_subsys: remove CONFIG_SDMMC_VOLUME_NAME

Remove CONFIG_SDMMC_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 sdmmc_subsys disk driver to be registered.

Add disk-name properties for all in tree definitions for the
sdmmc-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:
Daniel DeGrasse 2024-10-31 20:24:57 +00:00 committed by Mahesh Mahadevan
commit a1dc0b8b3e
58 changed files with 77 additions and 40 deletions

View file

@ -72,6 +72,7 @@
mmc {
status = "okay";
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
};
};
};

View file

@ -89,6 +89,7 @@
spi-max-frequency = <1000000>;
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -219,6 +219,7 @@
pinctrl-names = "default";
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -209,6 +209,7 @@
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -252,6 +252,7 @@
spi-max-frequency = <8000000>;
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -154,6 +154,7 @@
spi-max-frequency = <8000000>;
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -144,6 +144,7 @@
status = "okay";
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
spi-max-frequency = <20000000>;

View file

@ -26,6 +26,7 @@
mmc {
/*SD Disk Access */
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -217,6 +217,7 @@
spi-max-frequency = <20000000>;
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};

View file

@ -186,6 +186,7 @@
pinctrl-names = "default", "slow", "med", "fast";
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -214,6 +214,7 @@ arduino_spi: &spi4 {
status = "okay";
sdmmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};

View file

@ -163,6 +163,7 @@ arduino_spi: &spi0 {
status = "okay";
sdmmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
spi-max-frequency = <24000000>;

View file

@ -166,6 +166,7 @@
status = "okay";
sdmmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -121,6 +121,7 @@
pinctrl-names = "default";
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -206,6 +206,7 @@ zephyr_udc0: &usb1 {
pwr-gpios = <&gpio3 24 GPIO_ACTIVE_HIGH>;
sdmmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -241,6 +241,7 @@ zephyr_udc0: &usb1 {
no-1-8-v;
sdmmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -221,6 +221,7 @@ zephyr_udc0: &usb1 {
pinctrl-names = "default", "slow", "med", "fast";
sdmmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -229,6 +229,7 @@ zephyr_udc0: &usb1 {
pinctrl-names = "default", "slow", "med", "fast";
sdmmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -420,6 +420,7 @@ zephyr_udc0: &usb1 {
pinctrl-names = "default", "slow", "med", "fast";
sdmmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -276,6 +276,7 @@ zephyr_udc0: &usb1 {
pinctrl-names = "default", "slow", "med", "fast";
sdmmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -118,6 +118,7 @@ nxp_mipi_i2c: &lpi2c5 {
pwr-gpios = <&gpio10 2 GPIO_ACTIVE_LOW>;
sdmmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -344,6 +344,7 @@ i2s1: &flexcomm3 {
cd-gpios = <&gpio2 9 GPIO_ACTIVE_LOW>;
sdmmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
pinctrl-0 = <&pinmux_usdhc>;

View file

@ -459,6 +459,7 @@
cd-gpios = <&gpio3 31 (GPIO_ACTIVE_LOW | GPIO_PULL_DOWN)>;
sdmmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -136,6 +136,7 @@ uext_serial: &usart1 {};
spi-max-frequency = <24000000>;
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -71,6 +71,7 @@
pinctrl-names = "default", "slow", "med", "fast";
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -66,6 +66,7 @@
pinctrl-names = "default", "uhs";
disk {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};

View file

@ -277,6 +277,7 @@
spi-max-frequency = <24000000>;
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
};
};
};

View file

@ -64,6 +64,7 @@
status = "okay";
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
spi-max-frequency = <20000000>;

View file

@ -58,6 +58,7 @@
spi-max-frequency = <24000000>;
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -43,6 +43,7 @@
sdmmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -60,6 +60,7 @@
status = "okay";
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
spi-max-frequency = <24000000>;

View file

@ -89,6 +89,7 @@
status = "okay";
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
spi-max-frequency = <DT_FREQ_M(24)>;

View file

@ -35,6 +35,7 @@
status = "okay";
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
spi-max-frequency = <DT_FREQ_M(8)>;

View file

@ -41,6 +41,7 @@
spi-max-frequency = <25000000>;
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -33,6 +33,7 @@
spi-max-frequency = <25000000>;
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -16,6 +16,7 @@
spi-max-frequency = <24000000>;
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -170,6 +170,7 @@
spi-max-frequency = <24000000>;
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
};

View file

@ -321,11 +321,11 @@ access and expose a RAM disk, emulated block device on a flash partition,
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.
SD card disk drivers use options :kconfig:option:`CONFIG_MMC_VOLUME_NAME` or
:kconfig:option:`CONFIG_SDMMC_VOLUME_NAME`, and flash and RAM disk drivers use
node property ``disk-name`` to set the disk name.
: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.
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

View file

@ -78,6 +78,7 @@ at 24 MHz once the SD card has been initialized:
status = "okay";
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
spi-max-frequency = <24000000>;

View file

@ -20,13 +20,6 @@ config SD_INIT_PRIORITY
help
SDMMC controller driver initialization priority.
config SDMMC_VOLUME_NAME
string "SDMMC Disk mount point or drive name"
default "SD" if FAT_FILESYSTEM_ELM
default "SDMMC"
help
Disk name as per file system naming guidelines.
config SDMMC_SUBSYS
bool "SDMMC access via SD subsystem"
select SDMMC_STACK

View file

@ -537,7 +537,7 @@ static const struct disk_operations stm32_sdmmc_ops = {
};
static struct disk_info stm32_sdmmc_info = {
.name = CONFIG_SDMMC_VOLUME_NAME,
.name = "SD",
.ops = &stm32_sdmmc_ops,
};

View file

@ -26,7 +26,7 @@ struct sdmmc_config {
struct sdmmc_data {
struct sd_card card;
enum sd_status status;
char *name;
struct disk_info *disk_info;
};
@ -111,19 +111,13 @@ static const struct disk_operations sdmmc_disk_ops = {
.ioctl = disk_sdmmc_access_ioctl,
};
static struct disk_info sdmmc_disk = {
.ops = &sdmmc_disk_ops,
};
static int disk_sdmmc_init(const struct device *dev)
{
struct sdmmc_data *data = dev->data;
data->status = SD_UNINIT;
sdmmc_disk.dev = dev;
sdmmc_disk.name = data->name;
return disk_access_register(&sdmmc_disk);
return disk_access_register(data->disk_info);
}
#define DISK_ACCESS_SDMMC_INIT(n) \
@ -131,8 +125,14 @@ static int disk_sdmmc_init(const struct device *dev)
.host_controller = DEVICE_DT_GET(DT_INST_PARENT(n)), \
}; \
\
static struct disk_info sdmmc_disk_##n = { \
.name = DT_INST_PROP(n, disk_name), \
.ops = &sdmmc_disk_ops, \
.dev = DEVICE_DT_INST_GET(n), \
}; \
\
static struct sdmmc_data sdmmc_data_##n = { \
.name = CONFIG_SDMMC_VOLUME_NAME, \
.disk_info = &sdmmc_disk_##n, \
}; \
\
DEVICE_DT_INST_DEFINE(n, \

View file

@ -1,5 +1,5 @@
description: |
Zephyr MMC disk node. A binding with this compatible present within an SD
Zephyr SDMMC disk node. A binding with this compatible present within an SD
host controller device node indicates that an SDMMC disk is attached to that
SD bus. This binding will enable that disk to be used with the disk driver
API and any subsystems that utilize it.
@ -7,3 +7,10 @@ description: |
compatible: "zephyr,sdmmc-disk"
include: [sd-device.yaml]
properties:
disk-name:
type: string
required: true
description: |
Disk name.

View file

@ -13,6 +13,7 @@
status = "okay";
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
spi-max-frequency = <20000000>;

View file

@ -14,6 +14,7 @@
status = "okay";
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
spi-max-frequency = <24000000>;

View file

@ -11,6 +11,7 @@
status = "okay";
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
spi-max-frequency = <25000000>;

View file

@ -36,7 +36,7 @@ static struct fs_mount_t mp = {
#include <zephyr/fs/ext2.h>
#define DISK_DRIVE_NAME "SDMMC"
#define DISK_DRIVE_NAME "SD"
#define DISK_MOUNT_PT "/ext"
static struct fs_mount_t mp = {

View file

@ -96,9 +96,9 @@ present and enabled in the final board dts and configuration files simultaneousl
point name for the ``littlefs`` file system block device will be determined based on the
following logic:
* if the :kconfig:option:`CONFIG_SDMMC_VOLUME_NAME` configuration is defined, it will be used
as the mount point name;
* if the :kconfig:option:`CONFIG_SDMMC_VOLUME_NAME` configuration is not defined, but the
* 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`

View file

@ -311,7 +311,7 @@ static int littlefs_mount(struct fs_mount_t *mp)
#ifdef CONFIG_APP_LITTLEFS_STORAGE_BLK_SDMMC
#if defined(CONFIG_DISK_DRIVER_SDMMC)
#define DISK_NAME CONFIG_SDMMC_VOLUME_NAME
#define DISK_NAME "SD"
#elif defined(CONFIG_DISK_DRIVER_MMC)
#define DISK_NAME CONFIG_MMC_VOLUME_NAME
#else

View file

@ -40,7 +40,7 @@ static struct fs_mount_t fatfs_mnt = {
#ifdef CONFIG_FS_LITTLEFS_BLK_DEV
#if defined(CONFIG_DISK_DRIVER_SDMMC)
#define DISK_NAME CONFIG_SDMMC_VOLUME_NAME
#define DISK_NAME "SD"
#elif defined(CONFIG_DISK_DRIVER_MMC)
#define DISK_NAME CONFIG_MMC_VOLUME_NAME
#else

View file

@ -11,6 +11,7 @@ sdhc@0 {
sdmmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};

View file

@ -21,7 +21,7 @@
#endif
#if defined(CONFIG_DISK_DRIVER_SDMMC)
#define DISK_NAME_PHYS CONFIG_SDMMC_VOLUME_NAME
#define DISK_NAME_PHYS "SD"
#elif defined(CONFIG_DISK_DRIVER_MMC)
#define DISK_NAME_PHYS CONFIG_MMC_VOLUME_NAME
#elif defined(CONFIG_DISK_DRIVER_FLASH)

View file

@ -13,7 +13,7 @@
#include <zephyr/random/random.h>
#if defined(CONFIG_DISK_DRIVER_SDMMC)
#define DISK_NAME CONFIG_SDMMC_VOLUME_NAME
#define DISK_NAME "SD"
#elif defined(CONFIG_DISK_DRIVER_MMC)
#define DISK_NAME CONFIG_MMC_VOLUME_NAME
#elif defined(CONFIG_NVME)

View file

@ -4,12 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/
&sdmmc1 {
sdmmc {
compatible = "zephyr,sdmmc-disk";
};
};
/delete-node/ &storage_partition;
&flash0 {

View file

@ -18,7 +18,7 @@
#ifdef CONFIG_FS_LITTLEFS_BLK_DEV
#ifdef CONFIG_DISK_DRIVER_SDMMC
#define DISK_NAME CONFIG_SDMMC_VOLUME_NAME
#define DISK_NAME "SD"
#elif defined(CONFIG_DISK_DRIVER_MMC)
#define DISK_NAME CONFIG_MMC_VOLUME_NAME
#else

View file

@ -13,6 +13,7 @@
status = "okay";
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
spi-max-frequency = <20000000>;

View file

@ -14,7 +14,7 @@
#elif CONFIG_DISK_DRIVER_FLASH
#define STORAGE_DEVICE "NAND"
#elif CONFIG_DISK_DRIVER_SDMMC
#define STORAGE_DEVICE "SDMMC"
#define STORAGE_DEVICE "SD"
#endif
/* All tests must use this structure to mount file system. After each test this structure is cleaned

View file

@ -16,7 +16,7 @@
#elif defined(CONFIG_DISK_DRIVER_FLASH)
#define DISK_NAME DT_PROP(DT_NODELABEL(test_disk), disk_name)
#elif defined(CONFIG_DISK_DRIVER_SDMMC)
#define DISK_NAME CONFIG_SDMMC_VOLUME_NAME
#define DISK_NAME "SD"
#elif defined(CONFIG_DISK_DRIVER_MMC)
#define DISK_NAME CONFIG_MMC_VOLUME_NAME
#else