Skip to contentSkip to conversation

Enable eMMC and SD card support for QCS615

PATCH In review Balaji Selvanathan 3 participants 7 messages Apr 21 – May 5

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover Enable eMMC and SD card support for QCS615

This patch series enables eMMC and SD card support on the Qualcomm QCS615 platform by adding the necessary clock support, fixing device type detection for proper EFI boot handling, and addressing controller timeout issues.

Patch 1 adds clock support for SDCC1 (eMMC) and SDCC2 (SD card) controllers

Patch 2 fixes the block device removable flag to correctly distinguish between eMMC (non-removable) and SD cards (removable).

Patch 3 limits the maximum MMC transfer size to prevent controller timeouts that occur with very large block operations

---
Changes in v2:
- Moved removable flag update from generic mmc-uclass.c to platform-
specific msm_sdhci.c driver.
- Set CONFIG_SYS_MMC_MAX_BLK_COUNT to deal with controller timeout.
- Link to v1: https://lore.kernel.org/u-boot/[email protected]/

---
Balaji Selvanathan (3):
clk: qcom: qcs615: Add SDCC1 and SDCC2 clock support
drivers: mmc: uclass: Set removable flag based on device tree property
configs: qcom_defconfig: Limit MMC transfer size to prevent controller timeout

 configs/qcom_defconfig          |  1 +
 drivers/clk/qcom/clock-qcom.h   |  2 ++
 drivers/clk/qcom/clock-qcs615.c | 46 ++++++++++++++++++++++++++++++++++++++++-
 drivers/mmc/msm_sdhci.c         |  7 +++++++
 4 files changed, 55 insertions(+), 1 deletion(-)

---
base-commit: e3405917a1806971d9e72a94186b299f05581e1a
change-id: 20260421-emmc-4c0a286779be

Best regards,

Signature · 1 line
Balaji Selvanathan <[email protected]>
#1 lore raw

PATCH v2 1/3 clk: qcom: qcs615: Add SDCC1 and SDCC2 clock support

Add clock support for SDCC1 (eMMC) and SDCC2 (SD card) controllers on QCS615 platform. This enables proper clock configuration for both storage interfaces.

---
Changes in v2:
- No changes

---
 drivers/clk/qcom/clock-qcom.h   |  2 ++
 drivers/clk/qcom/clock-qcs615.c | 46 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 47 insertions(+), 1 deletion(-)
drivers/clk/qcom/clock-qcom.h +2 -0
index 3a4550d8536..9899cd28aad 100644
@@ -14,6 +14,8 @@
 #define CFG_CLK_SRC_GPLL0_AUX2 (2 << 8)
 #define CFG_CLK_SRC_GPLL2 (2 << 8)
 #define CFG_CLK_SRC_GPLL2_MAIN (2 << 8)
+#define CFG_CLK_SRC_GPLL6_OUT_MAIN (2 << 8)
+#define CFG_CLK_SRC_GPLL8 (2 << 8)
 #define CFG_CLK_SRC_GPLL9 (2 << 8)
 #define CFG_CLK_SRC_GPLL0_ODD (3 << 8)
 #define CFG_CLK_SRC_GPLL6 (4 << 8)
drivers/clk/qcom/clock-qcs615.c +45 -1

70 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

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

In reply to Balaji Selvanathan

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 during controller probe to properly reflect the device's removable status. This allows the block layer and upper layers (particularly EFI boot manager) 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 mmc_of_parse() has set the MMC_CAP_NONREMOVABLE capability from the device tree.

---
Changes in v2:
- Moved removable flag update from generic mmc-uclass.c to platform- specific msm_sdhci.c driver

---
 drivers/mmc/msm_sdhci.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mmc/msm_sdhci.c +7 -0
index 66f3cf2de4f..13fd4ae8a7d 100644
@@ -189,6 +189,7 @@ static int msm_sdc_probe(struct udevice *dev)
 	struct sdhci_host *host = &prv->host;
 	u32 core_version, core_minor, core_major;
 	struct reset_ctl bcr_rst;
+	struct blk_desc *bdesc;
 	u32 caps;
 	int ret;
 
@@ -252,6 +253,12 @@ static int msm_sdc_probe(struct udevice *dev)
 	if (ret)
 		return ret;
 
+	if (plat->cfg.host_caps & MMC_CAP_NONREMOVABLE) {
+		bdesc = mmc_get_blk_desc(&plat->mmc);
+		if (bdesc)
+			bdesc->removable = 0;
+	}
+
 	host->mmc = &plat->mmc;
 	host->mmc->dev = dev;
 	host->ops = &msm_sdhci_ops;
Signature · 1 line
2.34.1
Reviewed-by on v2 2/3
#3 lore raw

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

Quoted 15 lines · Balaji Selvanathan

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 during controller probe to properly reflect the device's removable status. This allows the block layer and upper layers (particularly EFI boot manager) 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 mmc_of_parse() has set the MMC_CAP_NONREMOVABLE capability from the device tree.

Quoted 6 lines

---
Changes in v2:
- Moved removable flag update from generic mmc-uclass.c to platform- specific msm_sdhci.c driver

-Sumit

Quoted 33 lines
---
 drivers/mmc/msm_sdhci.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mmc/msm_sdhci.c +7 -0
index 66f3cf2de4f..13fd4ae8a7d 100644
@@ -189,6 +189,7 @@ static int msm_sdc_probe(struct udevice *dev)
 	struct sdhci_host *host = &prv->host;
 	u32 core_version, core_minor, core_major;
 	struct reset_ctl bcr_rst;
+	struct blk_desc *bdesc;
 	u32 caps;
 	int ret;
 
@@ -252,6 +253,12 @@ static int msm_sdc_probe(struct udevice *dev)
 	if (ret)
 		return ret;
 
+	if (plat->cfg.host_caps & MMC_CAP_NONREMOVABLE) {
+		bdesc = mmc_get_blk_desc(&plat->mmc);
+		if (bdesc)
+			bdesc->removable = 0;
+	}
+
 	host->mmc = &plat->mmc;
 	host->mmc->dev = dev;
 	host->ops = &msm_sdhci_ops;
Signature · 2 lines
-- 
2.34.1
#4 lore raw

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

In reply to Balaji Selvanathan
Quoted 38 lines · Balaji Selvanathan

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 during controller probe to properly reflect the device's removable status. This allows the block layer and upper layers (particularly EFI boot manager) 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 mmc_of_parse() has set the MMC_CAP_NONREMOVABLE capability from the device tree.

---
Changes in v2:
- Moved removable flag update from generic mmc-uclass.c to platform- specific msm_sdhci.c driver

---
 drivers/mmc/msm_sdhci.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mmc/msm_sdhci.c +1 -0
index 66f3cf2de4f..13fd4ae8a7d 100644
@@ -189,6 +189,7 @@ static int msm_sdc_probe(struct udevice *dev)
 	struct sdhci_host *host = &prv->host;
 	u32 core_version, core_minor, core_major;
 	struct reset_ctl bcr_rst;
+	struct blk_desc *bdesc;
 	u32 caps;
 	int ret;
 

drivers/mmc/msm_sdhci.c static int msm_sdc_probe(struct udevice *dev) · line 259

Quoted 7 lines
drivers/mmc/msm_sdhci.c +4 -0
@@ -252,6 +253,12 @@ static int msm_sdc_probe(struct udevice *dev)
 	if (ret)
 		return ret;
 
+	if (plat->cfg.host_caps & MMC_CAP_NONREMOVABLE) {
+		bdesc = mmc_get_blk_desc(&plat->mmc);
+		if (bdesc)
+			bdesc->removable = 0;

Would bdesc ever be null here? Or an ERR_PTR()? Please handle the error case properly and bail out.

Quoted 6 lines
drivers/mmc/msm_sdhci.c +2 -0
+	}
+
 	host->mmc = &plat->mmc;
 	host->mmc->dev = dev;
 	host->ops = &msm_sdhci_ops;
Signature · 1 line
// Casey (she/her)
#5 lore raw

PATCH v2 3/3 configs: qcom_defconfig: Limit MMC transfer size to prevent controller timeout

In reply to Balaji Selvanathan

Set CONFIG_SYS_MMC_MAX_BLK_COUNT to 16384 blocks to limit the maximum transfer size per operation. This prevents controller timeouts.

---
Changes in v2:
- Set CONFIG_SYS_MMC_MAX_BLK_COUNT to deal with controller timeout.

---
 configs/qcom_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/qcom_defconfig +1 -0
index baad5f09455..315107fd279 100644
@@ -96,6 +96,7 @@ CONFIG_MISC=y
 CONFIG_NVMEM=y
 CONFIG_QCOM_GENI=y
 CONFIG_I2C_EEPROM=y
+CONFIG_SYS_MMC_MAX_BLK_COUNT=16384
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ADMA=y
 CONFIG_MMC_SDHCI_MSM=y
Signature · 1 line
2.34.1
Reviewed-by on v2 3/3
#6 lore raw

Re: [PATCH v2 3/3] configs: qcom_defconfig: Limit MMC transfer size to prevent controller timeout

Quoted 10 lines · Balaji Selvanathan

Set CONFIG_SYS_MMC_MAX_BLK_COUNT to 16384 blocks to limit the maximum transfer size per operation. This prevents controller timeouts.

---
Changes in v2:
- Set CONFIG_SYS_MMC_MAX_BLK_COUNT to deal with controller timeout.

---
 configs/qcom_defconfig | 1 +
 1 file changed, 1 insertion(+)

-Sumit

Quoted 17 lines
configs/qcom_defconfig +1 -0
index baad5f09455..315107fd279 100644
@@ -96,6 +96,7 @@ CONFIG_MISC=y
 CONFIG_NVMEM=y
 CONFIG_QCOM_GENI=y
 CONFIG_I2C_EEPROM=y
+CONFIG_SYS_MMC_MAX_BLK_COUNT=16384
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ADMA=y
 CONFIG_MMC_SDHCI_MSM=y
Signature · 2 lines
-- 
2.34.1