All of lore.kernel.org
 help / color / mirror / Atom feed
From: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [UBOOT PATCH v3 5/7] mmc : sdhci: Read capabilities register1 and update host caps
Date: Thu, 19 Apr 2018 12:37:08 +0530	[thread overview]
Message-ID: <1524121630-13933-6-git-send-email-siva.durga.paladugu@xilinx.com> (raw)
In-Reply-To: <1524121630-13933-1-git-send-email-siva.durga.paladugu@xilinx.com>

From: Siva Durga Prasad Paladugu <sivadur@xilinx.com>

This patch reads the capabilities register1 and update the host
caps accordingly for mmc layer usage. This patch mainly reads
for UHS capabilities inorder to support SD3.0.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
---
 drivers/mmc/sdhci.c | 28 +++++++++++++++++++++++++++-
 include/sdhci.h     |  6 ++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index c17ab12..1cbd1bb 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -557,7 +557,7 @@ static const struct mmc_ops sdhci_ops = {
 int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
                u32 f_max, u32 f_min)
 {
-       u32 caps, caps_1;
+       u32 caps, caps_1 = 0;

        caps = sdhci_readl(host, SDHCI_CAPABILITIES);

@@ -633,6 +633,32 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
                        cfg->host_caps &= ~MMC_MODE_8BIT;
        }

+       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 |
+                           SDHCI_SUPPORT_DDR50);
+
+       if (caps_1 & (SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 |
+                     SDHCI_SUPPORT_DDR50))
+               cfg->host_caps |= MMC_CAP(UHS_SDR12) | MMC_CAP(UHS_SDR25);
+
+       if (caps_1 & SDHCI_SUPPORT_SDR104) {
+               cfg->host_caps |= MMC_CAP(UHS_SDR104) | MMC_CAP(UHS_SDR50);
+               /*
+                * SD3.0: SDR104 is supported so (for eMMC) the caps2
+                * field can be promoted to support HS200.
+                */
+               cfg->host_caps |= MMC_CAP(MMC_HS_200);
+       } else if (caps_1 & SDHCI_SUPPORT_SDR50) {
+               cfg->host_caps |= MMC_CAP(UHS_SDR50);
+       }
+
+       if (caps_1 & SDHCI_SUPPORT_DDR50)
+               cfg->host_caps |= MMC_CAP(UHS_DDR50);
+
        if (host->host_caps)
                cfg->host_caps |= host->host_caps;

diff --git a/include/sdhci.h b/include/sdhci.h
index 9e8302e..72957dc 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -167,6 +167,11 @@
 #define  SDHCI_CAN_64BIT       BIT(28)

 #define SDHCI_CAPABILITIES_1   0x44
+#define  SDHCI_SUPPORT_SDR50   0x00000001
+#define  SDHCI_SUPPORT_SDR104  0x00000002
+#define  SDHCI_SUPPORT_DDR50   0x00000004
+#define  SDHCI_USE_SDR50_TUNING        0x00002000
+
 #define  SDHCI_CLOCK_MUL_MASK  0x00FF0000
 #define  SDHCI_CLOCK_MUL_SHIFT 16

@@ -215,6 +220,7 @@
 #define SDHCI_QUIRK_BROKEN_VOLTAGE     (1 << 4)
 #define SDHCI_QUIRK_WAIT_SEND_CMD      (1 << 6)
 #define SDHCI_QUIRK_USE_WIDE8          (1 << 8)
+#define SDHCI_QUIRK_NO_1_8_V           (1 << 9)

 /* to make gcc happy */
 struct sdhci_host;
--
2.7.4

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

  parent reply	other threads:[~2018-04-19  7:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-19  7:07 [U-Boot] [UBOOT PATCH v3 0/7] Add support of SD3.0 UHS modes for ZynqMP Siva Durga Prasad Paladugu
2018-04-19  7:07 ` [U-Boot] [UBOOT PATCH v3 1/7] mmc: sdhci: Add support for disabling clock Siva Durga Prasad Paladugu
2018-04-19  7:07 ` [U-Boot] [UBOOT PATCH v3 2/7] mmc: sdhci: Handle execute tuning command in sdhci_send_command Siva Durga Prasad Paladugu
2018-04-19  7:07 ` [U-Boot] [UBOOT PATCH v3 3/7] sdhci: Add new sdhci ops for platform specific tuning and delays Siva Durga Prasad Paladugu
2018-04-19  7:07 ` [U-Boot] [UBOOT PATCH v3 4/7] mmc: sdhci: Invoke platform specific tuning and delay routines Siva Durga Prasad Paladugu
2018-04-19  7:07 ` Siva Durga Prasad Paladugu [this message]
2018-04-19  7:07 ` [U-Boot] [UBOOT PATCH v3 6/7] mmc: zynq_sdhci: Add support for SD3.0 Siva Durga Prasad Paladugu
2018-04-24 11:46   ` Michal Simek
2018-04-19  7:07 ` [U-Boot] [UBOOT PATCH v3 7/7] zynqmp: zcu102: Enable UHS support for ZCU102 Rev1.0 board Siva Durga Prasad Paladugu
2018-04-24 11:40   ` Michal Simek
2018-04-24 11:09 ` [U-Boot] [UBOOT PATCH v3 0/7] Add support of SD3.0 UHS modes for ZynqMP Michal Simek
2018-04-30  9:02 ` Michal Simek
2018-04-30 14:17   ` Tom Rini
2018-04-30 16:46     ` Michal Simek
2018-04-30 16:56       ` Tom Rini
2018-05-02  2:05   ` Jaehoon Chung
2018-05-09  9:51     ` Michal Simek
2018-05-11 12:56 ` Michal Simek

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=1524121630-13933-6-git-send-email-siva.durga.paladugu@xilinx.com \
    --to=siva.durga.paladugu@xilinx.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.