Skip to contentSkip to conversation

mmc: dw_mmc: Abort probe if reset deassertion fails

PATCH New Jiawen Liu 1 participant 1 message Nov 29

Subsystems (2)
lore
Share & tools
lore

Jiawen Liu

author
#0 lore raw

PATCH 1/1 mmc: dw_mmc: Abort probe if reset deassertion fails

dw_mci_probe() ignores the result of reset_control_deassert() for devices with an external reset. On StarFive JH7110, the MMC1 node supplies a named reset whose provider can return -ETIMEDOUT if its status register does not confirm deassertion. Probe then accesses the controller registers and can lose the provider's error if the internal reset check fails.

Report the deassertion error with dev_err_probe() and abort probe before accessing controller registers. Use the existing clock unwind to disable CIU and BIU and return the original error.

Source
review, diff and style checks, and targeted RISC-V object builds with reset support enabled and disabled were completed. No runtime or hardware reproduction was performed.

Fixes d6786fefe816 ("mmc: dw_mmc: add reset support to dwmmc host controller")
---
 drivers/mmc/host/dw_mmc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/mmc/host/dw_mmc.c +5 -1
index ff0b25d287a94..234538f473338 100644
@@ -3246,7 +3246,11 @@ int dw_mci_probe(struct dw_mci *host)
 	if (host->rstc) {
 		reset_control_assert(host->rstc);
 		usleep_range(10, 50);
-		reset_control_deassert(host->rstc);
+		ret = reset_control_deassert(host->rstc);
+		if (ret) {
+			dev_err_probe(host->dev, ret, "failed to deassert reset\n");
+			goto err_clk_ciu;
+		}
 	}
 
 	if (drv_data && drv_data->init) {
Signature · 1 line
2.34.1