]> git.sur5r.net Git - u-boot/commitdiff
mmc: dwmmc: socfpga: Add reset ctrl to driver
authorLey Foon Tan <ley.foon.tan@intel.com>
Thu, 14 Jun 2018 10:45:21 +0000 (18:45 +0800)
committerTom Rini <trini@konsulko.com>
Mon, 9 Jul 2018 19:28:24 +0000 (15:28 -0400)
Add code to reset all reset signals as in mmc DT node. A reset property
is an optional feature, so only print out a warning and do not fail if a
reset property is not present.

If a reset property is discovered, then use it to deassert, thus
bringing the IP out of reset.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/mmc/socfpga_dw_mmc.c

index d0a0362d7ea6213bcc209d8b53637d1e9ae271c2..ed8ba10c9328e1db2e285c6196bf355e891ae1a0 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/libfdt.h>
 #include <linux/err.h>
 #include <malloc.h>
 #include <linux/libfdt.h>
 #include <linux/err.h>
 #include <malloc.h>
+#include <reset.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -33,6 +34,20 @@ struct dwmci_socfpga_priv_data {
        unsigned int            smplsel;
 };
 
        unsigned int            smplsel;
 };
 
+static void socfpga_dwmci_reset(struct udevice *dev)
+{
+       struct reset_ctl_bulk reset_bulk;
+       int ret;
+
+       ret = reset_get_bulk(dev, &reset_bulk);
+       if (ret) {
+               dev_warn(dev, "Can't get reset: %d\n", ret);
+               return;
+       }
+
+       reset_deassert_bulk(&reset_bulk);
+}
+
 static void socfpga_dwmci_clksel(struct dwmci_host *host)
 {
        struct dwmci_socfpga_priv_data *priv = host->priv;
 static void socfpga_dwmci_clksel(struct dwmci_host *host)
 {
        struct dwmci_socfpga_priv_data *priv = host->priv;
@@ -109,6 +124,8 @@ static int socfpga_dwmmc_probe(struct udevice *dev)
        struct dwmci_socfpga_priv_data *priv = dev_get_priv(dev);
        struct dwmci_host *host = &priv->host;
 
        struct dwmci_socfpga_priv_data *priv = dev_get_priv(dev);
        struct dwmci_host *host = &priv->host;
 
+       socfpga_dwmci_reset(dev);
+
 #ifdef CONFIG_BLK
        dwmci_setup_cfg(&plat->cfg, host, host->bus_hz, 400000);
        host->mmc = &plat->mmc;
 #ifdef CONFIG_BLK
        dwmci_setup_cfg(&plat->cfg, host, host->bus_hz, 400000);
        host->mmc = &plat->mmc;