Re: [U-Boot] [PATCH v4 2/4] mmc: dwmmc: socfpga: Add reset ctrl to driver

2018-06-01 Thread Simon Glass
On 1 June 2018 at 02:45, Ley Foon Tan  wrote:
> 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 
> ---
>  drivers/mmc/socfpga_dw_mmc.c | 17 +
>  1 file changed, 17 insertions(+)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v4 2/4] mmc: dwmmc: socfpga: Add reset ctrl to driver

2018-06-01 Thread Ley Foon Tan
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 
---
 drivers/mmc/socfpga_dw_mmc.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/mmc/socfpga_dw_mmc.c b/drivers/mmc/socfpga_dw_mmc.c
index d0a0362..4be4eb5 100644
--- a/drivers/mmc/socfpga_dw_mmc.c
+++ b/drivers/mmc/socfpga_dw_mmc.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -33,6 +34,20 @@ struct dwmci_socfpga_priv_data {
unsigned intsmplsel;
 };
 
+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;
@@ -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;
 
+   socfpga_dwmci_reset(dev);
+
 #ifdef CONFIG_BLK
dwmci_setup_cfg(&plat->cfg, host, host->bus_hz, 40);
host->mmc = &plat->mmc;
-- 
2.2.2

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot