Skip to content

Commit 07a8e32

Browse files
danieldegrassemmahadevan108
authored andcommitted
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 <[email protected]>
1 parent a1dc0b8 commit 07a8e32

File tree

19 files changed

+37
-29
lines changed

19 files changed

+37
-29
lines changed

boards/nxp/mimxrt595_evk/mimxrt595_evk_mimxrt595s_cm33.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ zephyr_udc0: &usbhs {
371371
cd-gpios = <&gpio2 9 GPIO_ACTIVE_LOW>;
372372
mmc {
373373
compatible = "zephyr,mmc-disk";
374+
disk-name = "SD2";
374375
status = "okay";
375376
};
376377
pinctrl-0 = <&pinmux_usdhc>;

boards/renesas/rcar_h3ulcb/rcar_h3ulcb_r8a77951_a57.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
pinctrl-names = "default", "uhs";
9595
disk {
9696
compatible = "zephyr,mmc-disk";
97+
disk-name = "SD2";
9798
status = "disabled";
9899
};
99100
bus-width = <8>;

boards/renesas/rcar_salvator_xs/rcar_salvator_xs.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
pinctrl-names = "default", "uhs";
4747
disk {
4848
compatible = "zephyr,mmc-disk";
49+
disk-name = "SD2";
4950
status = "disabled";
5051
};
5152
bus-width = <8>;

boards/renesas/rcar_spider_s4/rcar_spider_s4_r8a779f0_a55.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
pinctrl-names = "default", "uhs";
4242
disk {
4343
compatible = "zephyr,mmc-disk";
44+
disk-name = "SD2";
4445
status = "okay";
4546
};
4647
bus-width = <8>;

doc/connectivity/usb/device/usb_device.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,8 @@ or SD Card to the host. Only one disk instance can be exported at a time.
323323
The disc to be used by the implementation is set by the
324324
:kconfig:option:`CONFIG_MASS_STORAGE_DISK_NAME` and should be the same as the
325325
name used by the disc access driver that the application wants to expose to the
326-
host. MMC disk drivers use option :kconfig:option:`CONFIG_MMC_VOLUME_NAME`, or
327-
flash, RAM, and SDMMC disk drivers use node property ``disk-name`` to set
328-
the disk name.
326+
host. Flash, RAM, and SDMMC/MMC disk drivers use node property ``disk-name`` to
327+
set the disk name.
329328

330329
For the emulated block device on a flash partition, the flash partition and
331330
flash disk to be used must be described in the devicetree. If a storage partition

drivers/disk/Kconfig.mmc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ config SD_INIT_PRIORITY
1616
help
1717
MMC controller driver initialization priority.
1818

19-
config MMC_VOLUME_NAME
20-
string "MMC Disk mount point or drive name"
21-
default "SD" if FAT_FILESYSTEM_ELM
22-
default "MMC"
23-
help
24-
Disk name as per file system naming guidelines.
25-
2619
config MMC_SUBSYS
2720
bool "MMC access via SD subsystem"
2821
select MMC_STACK

drivers/disk/mmc_subsys.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct mmc_config {
2727
struct mmc_data {
2828
struct sd_card card;
2929
enum sd_status status;
30-
char *name;
30+
struct disk_info *disk_info;
3131
};
3232

3333

@@ -107,21 +107,15 @@ static const struct disk_operations mmc_disk_ops = {
107107
.ioctl = disk_mmc_access_ioctl,
108108
};
109109

110-
static struct disk_info mmc_disk = {
111-
.ops = &mmc_disk_ops,
112-
};
113-
114110
static int disk_mmc_init(const struct device *dev)
115111
{
116112
struct mmc_data *data = dev->data;
117113
const struct mmc_config *config = dev->config;
118114

119115
data->status = SD_UNINIT;
120116
data->card.bus_width = config->bus_width;
121-
mmc_disk.dev = dev;
122-
mmc_disk.name = data->name;
123117

124-
return disk_access_register(&mmc_disk);
118+
return disk_access_register(data->disk_info);
125119
}
126120

127121
#define DISK_ACCESS_MMC_INIT(n) \
@@ -130,8 +124,14 @@ static int disk_mmc_init(const struct device *dev)
130124
.bus_width = DT_INST_PROP(n, bus_width), \
131125
}; \
132126
\
127+
static struct disk_info mmc_disk_##n = { \
128+
.name = DT_INST_PROP(n, disk_name), \
129+
.ops = &mmc_disk_ops, \
130+
.dev = DEVICE_DT_INST_GET(n), \
131+
}; \
132+
\
133133
static struct mmc_data mmc_data_##n = { \
134-
.name = CONFIG_MMC_VOLUME_NAME, \
134+
.disk_info = &mmc_disk_##n, \
135135
}; \
136136
\
137137
DEVICE_DT_INST_DEFINE(n, \

dts/bindings/sd/zephyr,mmc-disk.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ properties:
1919
- 1
2020
- 4
2121
- 8
22+
23+
disk-name:
24+
type: string
25+
required: true
26+
description: |
27+
Disk name.

dts/x86/intel/alder_lake.dtsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@
348348

349349
mmc {
350350
compatible = "zephyr,mmc-disk";
351+
disk-name = "SD2";
351352
bus-width = <8>;
352353
status = "okay";
353354
};

samples/subsys/fs/fs_sample/src/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@
2222
* Note the fatfs library is able to mount only strings inside _VOLUME_STRS
2323
* in ffconf.h
2424
*/
25+
#if defined(CONFIG_DISK_DRIVER_MMC)
26+
#define DISK_DRIVE_NAME "SD2"
27+
#else
2528
#define DISK_DRIVE_NAME "SD"
29+
#endif
30+
2631
#define DISK_MOUNT_PT "/"DISK_DRIVE_NAME":"
2732

2833
static FATFS fat_fs;

0 commit comments

Comments
 (0)