CI: https://source.denx.de/u-boot/custodians/u-boot-mmc/-/pipelines/27140

- Fix emmc error state after mmc write timeout
- Minor cleanup s5p_sdhci
- Support DT upstream for exynos5420 and exynos4210 mmc
This commit is contained in:
Tom Rini
2025-07-24 07:54:20 -06:00
3 changed files with 17 additions and 12 deletions

View File

@@ -372,6 +372,12 @@ static const struct udevice_id exynos_dwmmc_ids[] = {
{
.compatible = "samsung,exynos4412-dw-mshc",
.data = (ulong)&exynos4_drv_data,
}, {
.compatible = "samsung,exynos5420-dw-mshc-smu",
.data = (ulong)&exynos5_drv_data,
}, {
.compatible = "samsung,exynos5420-dw-mshc",
.data = (ulong)&exynos5_drv_data,
}, {
.compatible = "samsung,exynos-dwmmc",
.data = (ulong)&exynos5_drv_data,

View File

@@ -155,6 +155,7 @@ static ulong mmc_write_blocks(struct mmc *mmc, lbaint_t start,
struct mmc_cmd cmd;
struct mmc_data data;
int timeout_ms = 1000;
int err;
if ((start + blkcnt) > mmc_get_blk_desc(mmc)->lba) {
printf("MMC: block number 0x" LBAF " exceeds max(0x" LBAF ")\n",
@@ -181,9 +182,13 @@ static ulong mmc_write_blocks(struct mmc *mmc, lbaint_t start,
data.blocksize = mmc->write_bl_len;
data.flags = MMC_DATA_WRITE;
if (mmc_send_cmd(mmc, &cmd, &data)) {
err = mmc_send_cmd(mmc, &cmd, &data);
if (err) {
printf("mmc write failed\n");
return 0;
/*
* Don't return 0 here since the emmc will still be in data
* transfer mode continue to send the STOP_TRANSMISSION command
*/
}
/* SPI multiblock writes terminate using a special
@@ -203,6 +208,9 @@ static ulong mmc_write_blocks(struct mmc *mmc, lbaint_t start,
if (mmc_poll_for_busy(mmc, timeout_ms))
return 0;
if (err)
return 0;
return blkcnt;
}

View File

@@ -141,14 +141,6 @@ static int do_sdhci_init(struct sdhci_host *host)
}
}
if (dm_gpio_is_valid(&host->cd_gpio)) {
ret = dm_gpio_get_value(&host->cd_gpio);
if (ret) {
debug("no SD card detected (%d)\n", ret);
return -ENODEV;
}
}
return s5p_sdhci_core_init(host);
}
@@ -183,8 +175,6 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host)
gpio_request_by_name_nodev(offset_to_ofnode(node), "pwr-gpios", 0,
&host->pwr_gpio, GPIOD_IS_OUT);
gpio_request_by_name_nodev(offset_to_ofnode(node), "cd-gpios", 0,
&host->cd_gpio, GPIOD_IS_IN);
return 0;
}
@@ -236,6 +226,7 @@ static int s5p_sdhci_bind(struct udevice *dev)
static const struct udevice_id s5p_sdhci_ids[] = {
{ .compatible = "samsung,exynos4412-sdhci"},
{ .compatible = "samsung,exynos4210-sdhci"},
{ }
};