diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 8b4128ee929b..649505c318df 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -3287,28 +3287,6 @@ int dw_mci_probe(struct dw_mci *host) int width, i, ret = 0; u32 fifo_size; -#ifdef CONFIG_ROCKCHIP_THUNDER_BOOT - struct device *dev = host->dev; - u32 intr; - - if (device_property_read_bool(host->dev, "supports-emmc")) { - if (readl_poll_timeout(host->regs + SDMMC_STATUS, - fifo_size, - !(fifo_size & (BIT(10) | GENMASK(7, 4))), - 0, 500 * USEC_PER_MSEC)) - dev_err(dev, "Controller is occupied!\n"); - - if (readl_poll_timeout(host->regs + SDMMC_IDSTS, - fifo_size, !(fifo_size & GENMASK(16, 13)), - 0, 500 * USEC_PER_MSEC)) - dev_err(dev, "DMA is still running!\n"); - - intr = mci_readl(host, RINTSTS); - if (intr & DW_MCI_CMD_ERROR_FLAGS || intr & DW_MCI_DATA_ERROR_FLAGS) - BUG_ON(1); - } -#endif - if (!host->pdata) { host->pdata = dw_mci_parse_dt(host); if (PTR_ERR(host->pdata) == -EPROBE_DEFER) { @@ -3329,6 +3307,22 @@ int dw_mci_probe(struct dw_mci *host) return ret; } } +#ifdef CONFIG_ROCKCHIP_THUNDER_BOOT + if (device_property_read_bool(host->dev, "supports-emmc")) { + if (readl_poll_timeout(host->regs + SDMMC_STATUS, + fifo_size, + !(fifo_size & (BIT(10) | GENMASK(7, 4))), + 0, 500 * USEC_PER_MSEC)) + dev_err(host->dev, "Controller is occupied!\n"); + + if (readl_poll_timeout(host->regs + SDMMC_IDSTS, + fifo_size, !(fifo_size & GENMASK(16, 13)), + 0, 500 * USEC_PER_MSEC)) + dev_err(host->dev, "DMA is still running!\n"); + + BUG_ON(mci_readl(host, RINTSTS) & DW_MCI_ERROR_FLAGS); + } +#endif host->ciu_clk = devm_clk_get(host->dev, "ciu"); if (IS_ERR(host->ciu_clk)) {