]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mmc: zynq_sdhci: Reset the host controller
authorVenkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Thu, 26 Jun 2025 06:24:40 +0000 (11:54 +0530)
committerMichal Simek <michal.simek@amd.com>
Tue, 8 Jul 2025 12:58:43 +0000 (14:58 +0200)
Reset the host controller at the early stage of probe so that the
configuration will be done properly for reboot cases.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20250626062440.295301-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
drivers/mmc/zynq_sdhci.c

index 2375b15539b2bb669c207d344cc4c5ec94007b9a..3b682918b036d5d60a801e8824a26a49ab10f778 100644 (file)
@@ -1127,6 +1127,28 @@ static int arasan_sdhci_probe(struct udevice *dev)
        if (arasan_sdhci_is_compatible(dev, SDHCI_COMPATIBLE_VERSAL_NET_EMMC))
                priv->internal_phy_reg = true;
 
+       ret = reset_get_bulk(dev, &priv->resets);
+       if (ret == -ENOTSUPP || ret == -ENOENT) {
+               dev_warn(dev, "Reset not found\n");
+       } else if (ret) {
+               dev_err(dev, "Reset failed\n");
+               return ret;
+       }
+
+       if (!ret) {
+               ret = reset_assert_bulk(&priv->resets);
+               if (ret) {
+                       dev_err(dev, "Reset assert failed\n");
+                       return ret;
+               }
+
+               ret = reset_deassert_bulk(&priv->resets);
+               if (ret) {
+                       dev_err(dev, "Reset release failed\n");
+                       return ret;
+               }
+       }
+
        ret = clk_get_by_index(dev, 0, &clk);
        if (ret < 0) {
                dev_err(dev, "failed to get clock\n");