Skip to contentSkip to conversation

mmc: rockchip_dw_mmc: Allow 4-bit mode when 8-bit mode is supported

PATCH In review Jonas Karlman 2 participants 2 messages Jul 24, 2024 – Aug 2, 2024

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

PATCH 1/1 mmc: rockchip_dw_mmc: Allow 4-bit mode when 8-bit mode is supported

Hosts capable of 8-bit can also do 4 bits, fix use of 4-bit mode when 8-bit mode is supported.

This fixes use of 1-bit mode with SD NAND on ROCK Pi S using the DT in v6.11-rc1 that chage to use 8-bit bus to also support eMMC. With this 4-bit mode is used with SD NAND and 8-bit mode with eMMC, same as in Linux kernel.

---
 drivers/mmc/rockchip_dw_mmc.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/rockchip_dw_mmc.c +4 -0
index 1a10b7057a47..549fb80f1988 100644
@@ -159,6 +159,10 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
 	host->mmc->dev = dev;
 	upriv->mmc = host->mmc;
 
+	/* Hosts capable of 8-bit can also do 4 bits */
+	if (host->buswidth == 8)
+		plat->cfg.host_caps |= MMC_MODE_4BIT;
+
 	return dwmci_probe(dev);
 }
 
Signature · 1 line
2.45.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Jonas Karlman

Hosts capable of 8-bit can also do 4 bits, fix use of 4-bit mode when 8-bit mode is supported.

This fixes use of 1-bit mode with SD NAND on ROCK Pi S using the DT in v6.11-rc1 that chage to use 8-bit bus to also support eMMC. With this 4-bit mode is used with SD NAND and 8-bit mode with eMMC, same as in Linux kernel.

Thanks,
- Kever

Quoted 19 lines
---
  drivers/mmc/rockchip_dw_mmc.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/mmc/rockchip_dw_mmc.c +4 -0
index 1a10b7057a47..549fb80f1988 100644
@@ -159,6 +159,10 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
  	host->mmc->dev = dev;
  	upriv->mmc = host->mmc;
 
+	/* Hosts capable of 8-bit can also do 4 bits */
+	if (host->buswidth == 8)
+		plat->cfg.host_caps |= MMC_MODE_4BIT;
+
  	return dwmci_probe(dev);
  }