Add reset control functionality to the SDHCI Cadence driver to properly
handle hardware reset sequences during probe. This ensures the controller
is in a known state before initialization.

Signed-off-by: Tanmay Kathpalia <[email protected]>
Reviewed-by: Balsundar Ponnusamy <[email protected]>
---
 drivers/mmc/sdhci-cadence.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mmc/sdhci-cadence.c b/drivers/mmc/sdhci-cadence.c
index 7d169efa476..6c9d24fe5f7 100644
--- a/drivers/mmc/sdhci-cadence.c
+++ b/drivers/mmc/sdhci-cadence.c
@@ -15,6 +15,7 @@
 #include <linux/sizes.h>
 #include <linux/libfdt.h>
 #include <mmc.h>
+#include <reset.h>
 #include <sdhci.h>
 #include "sdhci-cadence.h"
 
@@ -214,6 +215,7 @@ static int sdhci_cdns_probe(struct udevice *dev)
        struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
        struct sdhci_cdns_plat *plat = dev_get_plat(dev);
        struct sdhci_host *host = dev_get_priv(dev);
+       struct reset_ctl_bulk reset_bulk;
        fdt_addr_t base;
        int ret;
 
@@ -225,6 +227,10 @@ static int sdhci_cdns_probe(struct udevice *dev)
        if (!plat->hrs_addr)
                return -ENOMEM;
 
+       ret = reset_get_bulk(dev, &reset_bulk);
+       if (!ret)
+               reset_deassert_bulk(&reset_bulk);
+
        host->name = dev->name;
        host->ioaddr = plat->hrs_addr + SDHCI_CDNS_SRS_BASE;
        host->ops = &sdhci_cdns_ops;
-- 
2.43.7

Reply via email to