All of lore.kernel.org
 help / color / mirror / Atom feed
From: Faiz Abbas <faiz_abbas@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 04/15] mmc: sdhci: Add support for sdhci-caps-mask
Date: Thu, 23 May 2019 12:37:41 -0500	[thread overview]
Message-ID: <20190523173752.28680-5-faiz_abbas@ti.com> (raw)
In-Reply-To: <20190523173752.28680-1-faiz_abbas@ti.com>

Add Support for masking some bits in the capabilities
register of a host controller.

Also remove the redundant readl() into caps1.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
 drivers/mmc/sdhci.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index e2bb90abbd..fa6bb0a944 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <dm.h>
 #include <errno.h>
 #include <malloc.h>
 #include <mmc.h>
@@ -643,8 +644,15 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
 		u32 f_max, u32 f_min)
 {
 	u32 caps, caps_1 = 0;
+	u32 mask[2] = {0};
+	int ret;
+
+	ret = dev_read_u32_array(host->mmc->dev, "sdhci-caps-mask",
+				 mask, 2);
+	if (ret && ret != -1)
+		return ret;
 
-	caps = sdhci_readl(host, SDHCI_CAPABILITIES);
+	caps = ~mask[1] & sdhci_readl(host, SDHCI_CAPABILITIES);
 
 #ifdef CONFIG_MMC_SDHCI_SDMA
 	if (!(caps & SDHCI_CAN_DO_SDMA)) {
@@ -684,7 +692,7 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
 
 	/* Check whether the clock multiplier is supported or not */
 	if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300) {
-		caps_1 = sdhci_readl(host, SDHCI_CAPABILITIES_1);
+		caps_1 = ~mask[0] & sdhci_readl(host, SDHCI_CAPABILITIES_1);
 		host->clk_mul = (caps_1 & SDHCI_CLOCK_MUL_MASK) >>
 				SDHCI_CLOCK_MUL_SHIFT;
 	}
@@ -741,9 +749,6 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
 		cfg->host_caps &= ~MMC_MODE_HS_52MHz;
 	}
 
-	if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300)
-		caps_1 = sdhci_readl(host, SDHCI_CAPABILITIES_1);
-
 	if (!(cfg->voltages & MMC_VDD_165_195) ||
 	    (host->quirks & SDHCI_QUIRK_NO_1_8_V))
 		caps_1 &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 |
-- 
2.17.1

  parent reply	other threads:[~2019-05-23 17:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-23 17:37 [U-Boot] [PATCH v4 00/15] Add Support for eMMC in AM65x-evm Faiz Abbas
2019-05-23 17:37 ` [U-Boot] [PATCH v4 01/15] arm64: dts: k3: Sync sdhci0 node from kernel and change driver name Faiz Abbas
2019-05-23 17:37 ` [U-Boot] [PATCH v4 02/15] mmc: am654_sdhci: Remove quirks Faiz Abbas
2019-05-23 17:37 ` [U-Boot] [PATCH v4 03/15] regmap: Add API regmap_init_mem_index() Faiz Abbas
2019-05-23 17:37 ` Faiz Abbas [this message]
2019-05-23 17:37 ` [U-Boot] [PATCH v4 05/15] mmc: sdhci: Make sdhci_set_clock() non static Faiz Abbas
2019-05-23 17:37 ` [U-Boot] [PATCH v4 06/15] arm: dts: k3: Add phy specific properties to SD card node Faiz Abbas
2019-05-23 18:57   ` Andreas Dannenberg
2019-05-29  9:47     ` Faiz Abbas
2019-05-23 17:37 ` [U-Boot] [PATCH v4 07/15] mmc: sdhci: Make set_ios_post() return int Faiz Abbas
2019-05-23 17:37 ` [U-Boot] [PATCH v4 08/15] mmc: am654_sdhci: Add Support for PHY Faiz Abbas
2019-05-23 17:37 ` [U-Boot] [PATCH v4 09/15] configs: am65x_evm: Enable CONFIG_REGMAP Faiz Abbas
2019-05-23 17:37 ` [U-Boot] [PATCH v4 10/15] mmc: am654_sdhci: Use f_max in mmc_config Faiz Abbas
2019-05-23 17:37 ` [U-Boot] [PATCH v4 11/15] mmc: sdhci: Add support for HOST_CONTROL2 and setting UHS timings Faiz Abbas
2019-05-23 17:37 ` [U-Boot] [PATCH v4 12/15] mmc: am654_sdhci: Add a platform specific set_control_reg() callback Faiz Abbas
2019-05-23 17:37 ` [U-Boot] [PATCH v4 13/15] configs: am65x: Add configs to support environment in eMMC Faiz Abbas
2019-05-23 17:37 ` [U-Boot] [PATCH v4 14/15] am65x_evm: Add Support for creating a filesystem GPT partition " Faiz Abbas
2019-05-23 17:37 ` [U-Boot] [PATCH v4 15/15] configs: am65x_evm_a53: Add Support for creating GPT partitions Faiz Abbas

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=20190523173752.28680-5-faiz_abbas@ti.com \
    --to=faiz_abbas@ti.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.