From: stefan.wahren@i2se.com (Stefan Wahren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC 3/3] mmc: mxs-mmc: Implement DDR support
Date: Sat, 6 Aug 2016 12:55:40 +0000 [thread overview]
Message-ID: <1470488140-10104-4-git-send-email-stefan.wahren@i2se.com> (raw)
In-Reply-To: <1470488140-10104-1-git-send-email-stefan.wahren@i2se.com>
This patch implements driver support for 3.3V DDR eMMCs.
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
drivers/mmc/host/mxs-mmc.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index d839147..84019d5 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -71,6 +71,7 @@ struct mxs_mmc_host {
spinlock_t lock;
int sdio_irq_en;
bool broken_cd;
+ bool is_ddr;
};
static int mxs_mmc_get_cd(struct mmc_host *mmc)
@@ -411,6 +412,9 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host)
cmd0 |= BF_SSP(log2_blksz, CMD0_BLOCK_SIZE) |
BF_SSP(blocks - 1, CMD0_BLOCK_COUNT);
} else {
+ if (host->is_ddr)
+ cmd0 |= BM_SSP_CMD0_DBL_DATA_RATE_EN;
+
writel(data_size, ssp->base + HW_SSP_XFER_SIZE);
writel(BF_SSP(log2_blksz, BLOCK_SIZE_BLOCK_SIZE) |
BF_SSP(blocks - 1, BLOCK_SIZE_BLOCK_COUNT),
@@ -499,6 +503,7 @@ static void mxs_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
static void mxs_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{
struct mxs_mmc_host *host = mmc_priv(mmc);
+ struct mxs_ssp *ssp = &host->ssp;
if (ios->bus_width == MMC_BUS_WIDTH_8)
host->bus_width = 2;
@@ -509,6 +514,23 @@ static void mxs_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
if (ios->clock)
mxs_ssp_set_clk_rate(&host->ssp, ios->clock);
+
+ if (ssp_is_old(ssp))
+ return;
+
+ if (ios->timing == MMC_TIMING_MMC_DDR52) {
+ /*
+ * ENGR00133481-1: In DDR mode the host send the data at
+ * negative edge and the MMC receive the data at positive edge.
+ */
+ host->is_ddr = true;
+ writel(BM_SSP_CTRL1_POLARITY, ssp->base +
+ HW_SSP_CTRL1(ssp) + STMP_OFFSET_REG_CLR);
+ } else {
+ host->is_ddr = false;
+ writel(BM_SSP_CTRL1_POLARITY, ssp->base + HW_SSP_CTRL1(ssp) +
+ STMP_OFFSET_REG_SET);
+ }
}
static void mxs_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
--
1.7.9.5
next prev parent reply other threads:[~2016-08-06 12:55 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-06 12:55 [PATCH RFC 0/3] mmc: mxs-mmc: Implement DDR support Stefan Wahren
2016-08-06 12:55 ` [PATCH RFC 1/3] DT: bindings: mmc: Add property for 3.3V only support Stefan Wahren
2016-08-10 18:44 ` Rob Herring
2016-08-10 20:27 ` Stefan Wahren
2016-08-10 21:39 ` Rob Herring
2016-08-11 0:48 ` Shawn Lin
2016-08-18 12:25 ` Adrian Hunter
2016-08-30 9:26 ` Ulf Hansson
2016-09-02 18:50 ` Stefan Wahren
2016-09-08 16:44 ` Rob Herring
2016-08-06 12:55 ` [PATCH RFC 2/3] mmc: core: add new cap for 3.3V only DDR MMCs Stefan Wahren
2016-08-06 13:14 ` Marek Vasut
2016-08-06 14:18 ` Stefan Wahren
2016-08-06 14:42 ` Marek Vasut
2016-08-07 2:07 ` Shawn Lin
2016-08-07 8:09 ` Stefan Wahren
2016-08-11 11:12 ` Jaehoon Chung
2016-08-11 11:57 ` Stefan Wahren
2016-08-06 12:55 ` Stefan Wahren [this message]
2016-08-06 13:13 ` [PATCH RFC 3/3] mmc: mxs-mmc: Implement DDR support Marek Vasut
2016-08-06 14:08 ` Stefan Wahren
2016-08-06 13:10 ` [PATCH RFC 0/3] " Marek Vasut
2016-08-06 13:48 ` Stefan Wahren
2016-08-07 11:37 ` Stefan Wahren
2016-08-27 19:15 ` Stefan Wahren
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=1470488140-10104-4-git-send-email-stefan.wahren@i2se.com \
--to=stefan.wahren@i2se.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).