[PATCH V4 21/25] mmc: mmci: add optional reset property

2018-10-02 Thread Ludovic Barre
From: Ludovic Barre 

This patch adds a optional reset management.
STM32 sdmmc variant needs to reset hardware block
during the power cycle procedure (for re-initialization).

Signed-off-by: Ludovic Barre 
---
 drivers/mmc/host/mmci.c | 7 +++
 drivers/mmc/host/mmci.h | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 969b665..0898cc9 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1877,6 +1878,12 @@ static int mmci_probe(struct amba_device *dev,
 
dev_dbg(mmc_dev(mmc), "clocking block at %u Hz\n", mmc->f_max);
 
+   host->rst = devm_reset_control_get_optional_exclusive(>dev, NULL);
+   if (IS_ERR(host->rst)) {
+   ret = PTR_ERR(host->rst);
+   goto clk_disable;
+   }
+
/* Get regulators and the supported OCR mask */
ret = mmc_regulator_get_supply(mmc);
if (ret)
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
index 33c243f..f793426 100644
--- a/drivers/mmc/host/mmci.h
+++ b/drivers/mmc/host/mmci.h
@@ -318,6 +318,8 @@ struct mmci_host {
struct clk  *clk;
u8  singleirq:1;
 
+   struct reset_control*rst;
+
spinlock_t  lock;
 
unsigned intmclk;
-- 
2.7.4



[PATCH V4 21/25] mmc: mmci: add optional reset property

2018-10-02 Thread Ludovic Barre
From: Ludovic Barre 

This patch adds a optional reset management.
STM32 sdmmc variant needs to reset hardware block
during the power cycle procedure (for re-initialization).

Signed-off-by: Ludovic Barre 
---
 drivers/mmc/host/mmci.c | 7 +++
 drivers/mmc/host/mmci.h | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 969b665..0898cc9 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1877,6 +1878,12 @@ static int mmci_probe(struct amba_device *dev,
 
dev_dbg(mmc_dev(mmc), "clocking block at %u Hz\n", mmc->f_max);
 
+   host->rst = devm_reset_control_get_optional_exclusive(>dev, NULL);
+   if (IS_ERR(host->rst)) {
+   ret = PTR_ERR(host->rst);
+   goto clk_disable;
+   }
+
/* Get regulators and the supported OCR mask */
ret = mmc_regulator_get_supply(mmc);
if (ret)
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
index 33c243f..f793426 100644
--- a/drivers/mmc/host/mmci.h
+++ b/drivers/mmc/host/mmci.h
@@ -318,6 +318,8 @@ struct mmci_host {
struct clk  *clk;
u8  singleirq:1;
 
+   struct reset_control*rst;
+
spinlock_t  lock;
 
unsigned intmclk;
-- 
2.7.4