All of lore.kernel.org
 help / color / mirror / Atom feed
From: patrice.chotard at st.com <patrice.chotard@st.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 03/12] mmc: sti_sdhci: Use reset framework
Date: Tue, 9 May 2017 14:16:37 +0200	[thread overview]
Message-ID: <1494332206-24843-4-git-send-email-patrice.chotard@st.com> (raw)
In-Reply-To: <1494332206-24843-1-git-send-email-patrice.chotard@st.com>

From: Patrice Chotard <patrice.chotard@st.com>

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
---

v4:	_ none

v3:	_ none

v2:	_ none

 drivers/mmc/sti_sdhci.c | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/sti_sdhci.c b/drivers/mmc/sti_sdhci.c
index d6c4d67..8b1b2c0 100644
--- a/drivers/mmc/sti_sdhci.c
+++ b/drivers/mmc/sti_sdhci.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <mmc.h>
+#include <reset-uclass.h>
 #include <sdhci.h>
 #include <asm/arch/sdhci.h>
 
@@ -16,6 +17,7 @@ DECLARE_GLOBAL_DATA_PTR;
 struct sti_sdhci_plat {
 	struct mmc_config cfg;
 	struct mmc mmc;
+	struct reset_ctl reset;
 	int instance;
 };
 
@@ -37,17 +39,19 @@ struct sti_sdhci_plat {
  * W/o these settings the SDHCI could configure and use the embedded controller
  * with limited features.
  */
-static void sti_mmc_core_config(struct udevice *dev)
+static int sti_mmc_core_config(struct udevice *dev)
 {
 	struct sti_sdhci_plat *plat = dev_get_platdata(dev);
 	struct sdhci_host *host = dev_get_priv(dev);
-	unsigned long *sysconf;
+	int ret;
 
 	/* only MMC1 has a reset line */
 	if (plat->instance) {
-		sysconf = (unsigned long *)(STIH410_SYSCONF5_BASE +
-			  ST_MMC_CCONFIG_REG_5);
-		generic_set_bit(SYSCONF_MMC1_ENABLE_BIT, sysconf);
+		ret = reset_deassert(&plat->reset);
+		if (ret < 0) {
+			error("MMC1 deassert failed: %d", ret);
+			return ret;
+		}
 	}
 
 	writel(STI_FLASHSS_MMC_CORE_CONFIG_1,
@@ -66,6 +70,8 @@ static void sti_mmc_core_config(struct udevice *dev)
 	}
 	writel(STI_FLASHSS_MMC_CORE_CONFIG4,
 	       host->ioaddr + FLASHSS_MMC_CORE_CONFIG_4);
+
+	return 0;
 }
 
 static int sti_sdhci_probe(struct udevice *dev)
@@ -80,13 +86,20 @@ static int sti_sdhci_probe(struct udevice *dev)
 	 * MMC0 is wired to the SD slot,
 	 * MMC1 is wired on the high speed connector
 	 */
-
-	if (fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "resets", NULL))
+	if (fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "resets", NULL)) {
 		plat->instance = 1;
-	else
+		ret = reset_get_by_name(dev, "softreset", &plat->reset);
+		if (ret) {
+			error("can't get reset for %s (%d)", dev->name, ret);
+			return ret;
+		}
+	} else {
 		plat->instance = 0;
+	}
 
-	sti_mmc_core_config(dev);
+	ret = sti_mmc_core_config(dev);
+	if (ret)
+		return ret;
 
 	host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD |
 		       SDHCI_QUIRK_32BIT_DMA_ADDR |
-- 
1.9.1

  parent reply	other threads:[~2017-05-09 12:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-09 12:16 [U-Boot] [PATCH v4 00/12] STiH410-B2260: add reset, usb and fastboot support patrice.chotard at st.com
2017-05-09 12:16 ` [U-Boot] [PATCH v4 01/12] mmc: sti_sdhci: Rework sti_mmc_core_config() patrice.chotard at st.com
2017-05-09 12:16 ` [U-Boot] [PATCH v4 02/12] ARM: dts: stih410-family: Add missing reset_names for mmc1 node patrice.chotard at st.com
2017-05-09 12:16 ` patrice.chotard at st.com [this message]
2017-05-09 12:16 ` [U-Boot] [PATCH v4 04/12] usb: phy: Add STi USB2 PHY patrice.chotard at st.com
2017-05-10 11:02   ` Marek Vasut
2017-05-10 14:29     ` Patrice CHOTARD
2017-05-09 12:16 ` [U-Boot] [PATCH v4 05/12] usb: ehci: Add STi ehci support patrice.chotard at st.com
2017-05-10 11:03   ` Marek Vasut
2017-05-10 15:39     ` Patrice CHOTARD
2017-05-09 12:16 ` [U-Boot] [PATCH v4 06/12] usb: ohci: Add STi ohci support patrice.chotard at st.com
2017-05-10 11:03   ` Marek Vasut
2017-05-10 15:39     ` Patrice CHOTARD
2017-05-09 12:16 ` [U-Boot] [PATCH v4 07/12] usb: xhci: Add STi xhci support patrice.chotard at st.com
2017-05-09 12:16 ` [U-Boot] [PATCH v4 08/12] usb: dwc3: Add dwc3 glue driver support for STi patrice.chotard at st.com
2017-05-09 12:16 ` [U-Boot] [PATCH v4 09/12] board: STiH410-B2260: add OHCI and XHCI related defines patrice.chotard at st.com
2017-05-09 12:16 ` [U-Boot] [PATCH v4 10/12] board: STiH410-B2260: add fastboot support patrice.chotard at st.com
2017-05-09 12:16 ` [U-Boot] [PATCH v4 11/12] STiH410-B2260: enable USB Host Networking patrice.chotard at st.com
2017-05-09 12:16 ` [U-Boot] [PATCH v4 12/12] STiH410-B2260: enable USB, fastboot, reset related flags patrice.chotard at st.com
2017-05-10 15:41 ` [U-Boot] [PATCH v4 00/12] STiH410-B2260: add reset, usb and fastboot support Patrice CHOTARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1494332206-24843-4-git-send-email-patrice.chotard@st.com \
    --to=patrice.chotard@st.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.