]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mmc: sdhci-of-k1: add reset support
authorYixun Lan <dlan@gentoo.org>
Tue, 23 Dec 2025 02:24:50 +0000 (10:24 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 23 Feb 2026 11:06:53 +0000 (12:06 +0100)
The SDHCI controller of SpacemiT K1 SoC requires two resets, add
support to explicitly request the reset line and deassert during
initialization phase. Still using devm_xx_get_optional() API to
make the request optional.

Signed-off-by: Yixun Lan <dlan@gentoo.org>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci-of-k1.c

index 0cc97e23a2f9c7b2f9376318a8a7ebb860571504..a160e1d5d9bdef7774e2c9c2db59e2983ba793c5 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/reset.h>
 #include <linux/platform_device.h>
 
 #include "sdhci.h"
@@ -223,6 +224,21 @@ static inline int spacemit_sdhci_get_clocks(struct device *dev,
        return 0;
 }
 
+static inline int spacemit_sdhci_get_resets(struct device *dev)
+{
+       struct reset_control *rst;
+
+       rst = devm_reset_control_get_optional_shared_deasserted(dev, "axi");
+       if (IS_ERR(rst))
+               return PTR_ERR(rst);
+
+       rst = devm_reset_control_get_optional_exclusive_deasserted(dev, "sdh");
+       if (IS_ERR(rst))
+               return PTR_ERR(rst);
+
+       return 0;
+}
+
 static const struct sdhci_ops spacemit_sdhci_ops = {
        .get_max_clock          = spacemit_sdhci_clk_get_max_clock,
        .reset                  = spacemit_sdhci_reset,
@@ -284,6 +300,10 @@ static int spacemit_sdhci_probe(struct platform_device *pdev)
        if (ret)
                goto err_pltfm;
 
+       ret = spacemit_sdhci_get_resets(dev);
+       if (ret)
+               goto err_pltfm;
+
        ret = sdhci_add_host(host);
        if (ret)
                goto err_pltfm;