[PATCH 2/3] drivers: mmc: uclass: Set removable flag based on device tree property

Balaji Selvanathan balaji.selvanathan at oss.qualcomm.com
Tue Mar 24 06:52:35 CET 2026


The block device removable flag should reflect whether the MMC
device is physically removable (SD card) or soldered (eMMC). This
information is specified in the device tree via the "non-removable"
property and stored in the MMC_CAP_NONREMOVABLE capability flag.

Update the removable flag in the block device descriptor after
successful MMC initialization to properly reflect the device's
removable status. This allows the block layer and upper layers to
distinguish between eMMC and SD cards for appropriate handling.

The default removable=1 is set in mmc_bind(), and this change
overrides it only for non-removable devices after confirming
successful initialization.

Signed-off-by: Balaji Selvanathan <balaji.selvanathan at oss.qualcomm.com>
---
 drivers/mmc/mmc-uclass.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 698530088fe..b218c69b494 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -507,6 +507,7 @@ static int mmc_blk_probe(struct udevice *dev)
 	struct udevice *mmc_dev = dev_get_parent(dev);
 	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(mmc_dev);
 	struct mmc *mmc = upriv->mmc;
+	struct blk_desc *bdesc = dev_get_uclass_plat(dev);
 	int ret;
 
 	ret = mmc_init(mmc);
@@ -515,6 +516,10 @@ static int mmc_blk_probe(struct udevice *dev)
 		return ret;
 	}
 
+	/* Update removable flag based on device capabilities */
+	if (mmc->cfg->host_caps & MMC_CAP_NONREMOVABLE)
+		bdesc->removable = 0;
+
 	return 0;
 }
 

-- 
2.34.1



More information about the U-Boot mailing list