[PATCH 05/12] mci: sdhci: imx: Use sdhci_setup_host()

Sascha Hauer s.hauer at pengutronix.de
Mon Jun 7 03:44:04 PDT 2021


sdhci_setup_host() handles reading the caps. Call it instead of doing it
in the driver.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/mci/imx-esdhc.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index fa858a9853..12e98ce26a 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -230,7 +230,6 @@ static int fsl_esdhc_probe(struct device_d *dev)
 	struct resource *iores;
 	struct fsl_esdhc_host *host;
 	struct mci_host *mci;
-	u32 caps;
 	int ret;
 	unsigned long rate;
 	struct esdhc_platform_data *pdata = dev->platform_data;
@@ -269,29 +268,22 @@ static int fsl_esdhc_probe(struct device_d *dev)
 
 	esdhc_populate_sdhci(host);
 
-	caps = sdhci_read32(&host->sdhci, SDHCI_CAPABILITIES);
-
-	if (caps & SDHCI_CAN_VDD_180)
-		mci->voltages |= MMC_VDD_165_195;
-	if (caps & SDHCI_CAN_VDD_300)
-		mci->voltages |= MMC_VDD_29_30 | MMC_VDD_30_31;
-	if (caps & SDHCI_CAN_VDD_330)
-		mci->voltages |= MMC_VDD_32_33 | MMC_VDD_33_34;
-
 	if (pdata) {
 		mci->host_caps = pdata->caps;
 		if (pdata->devname)
 			mci->devname = pdata->devname;
 	}
 
-	if (caps & SDHCI_CAN_DO_HISPD)
-		mci->host_caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED;
-
 	host->mci.send_cmd = esdhc_send_cmd;
 	host->mci.set_ios = esdhc_set_ios;
 	host->mci.init = esdhc_init;
 	host->mci.card_present = esdhc_card_present;
 	host->mci.hw_dev = dev;
+	host->sdhci.mci = &host->mci;
+
+	ret = sdhci_setup_host(&host->sdhci);
+	if (ret)
+		goto err_clk_disable;
 
 	rate = clk_get_rate(host->clk);
 	host->mci.f_min = rate >> 12;
-- 
2.29.2




More information about the barebox mailing list