Re: [PATCH] mmc: MMC 4.4 DDR support

Previous thread: Re: [PATCH] netfilter: add CHECKSUM target by Herbert Xu on Friday, July 9, 2010 - 12:18 am. (2 messages)

Next thread: [PATCH] OMAP2: powerdomain: Add break in switch statement by Thomas Weber on Friday, July 9, 2010 - 12:40 am. (3 messages)
From: Hanumath Prasad
Date: Thursday, July 8, 2010 - 11:59 pm

Add support for Dual Data Rate MMC cards as defined in the 4.4
specification.

Cc: linux-mmc@vger.kernel.org
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Hanumath Prasad <hanumath.prasad@stericsson.com>
---
 drivers/mmc/card/block.c |   10 +++++++---
 drivers/mmc/core/mmc.c   |   37 +++++++++++++++++++++++++++++++++++--
 include/linux/mmc/card.h |    5 +++++
 include/linux/mmc/core.h |    1 +
 include/linux/mmc/host.h |    4 ++++
 include/linux/mmc/mmc.h  |   11 +++++++++--
 6 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index cb9fbc8..4eb84eb 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -299,7 +299,8 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
 			readcmd = MMC_READ_SINGLE_BLOCK;
 			writecmd = MMC_WRITE_BLOCK;
 		}
-
+		if (mmc_card_ddr_mode(card))
+			brq.data.flags |= MMC_DDR_MODE;
 		if (rq_data_dir(req) == READ) {
 			brq.cmd.opcode = readcmd;
 			brq.data.flags |= MMC_DATA_READ;
@@ -569,8 +570,11 @@ mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
 	struct mmc_command cmd;
 	int err;
 
-	/* Block-addressed cards ignore MMC_SET_BLOCKLEN. */
-	if (mmc_card_blockaddr(card))
+	/*
+	 * Block-addressed and ddr mode supported cards
+	 * ignore MMC_SET_BLOCKLEN.
+	 */
+	if (mmc_card_blockaddr(card) || mmc_card_ddr_mode(card))
 		return 0;
 
 	mmc_claim_host(card->host);
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 89f7a25..1d33503 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -227,6 +227,21 @@ static int mmc_read_ext_csd(struct mmc_card *card)
 	}
 
 	switch (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_MASK) {
+	case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 |
+	     EXT_CSD_CARD_TYPE_26:
+		card->ext_csd.hs_max_dtr = 52000000;
+		card->ext_csd.card_type = EXT_CSD_CARD_TYPE_DDR_52;
+		break;
+	case EXT_CSD_CARD_TYPE_DDR_1_2V | ...
From: Kyungmin Park
Date: Friday, July 9, 2010 - 10:28 pm

Hi,

Looks good to me except where's use the MMC_DDR_MODE. why do you set
brq.data.flags |= MMC_DDR_MODE?

Now my SDHCI host don't support eMMC 4.4 but the end of july I can test it.

Thank you,
Kyungmin Park

On Fri, Jul 9, 2010 at 3:59 PM, Hanumath Prasad
--

From: Kyungmin Park
Date: Friday, July 9, 2010 - 10:29 pm

From: Kyungmin Park
Date: Monday, July 12, 2010 - 6:14 pm

On Sat, Jul 10, 2010 at 2:40 PM, P.Hanumath PRASAD

Then where can I see your host drivers? I hope to see also.

I wonder if we use the DDR mode, then I first set the DDR mode at both
MMC and host. then no need to send DDR_MODE support for each request.
doesn't it?

Thank you,
--

From: Linus Walleij
Date: Saturday, August 21, 2010 - 3:30 pm

Hm is there some problem with this patch or has the processing
of it simply stalled? When I read the thread I cannot see Hanumaths
answers on the list but it looks mainly like the patch is OK and
there is some chit-chat.

Can it be picked up? Everyone is going to need DDR MMC
for their eMMCs soon-ish.

Hanumath can you resend your comments to the list since they
seem to be lost.

Yours,
Linus Walleij
--

From: Chris Ball
Date: Saturday, August 21, 2010 - 3:37 pm

Hi,

   > Hm is there some problem with this patch or has the processing of
   > it simply stalled? When I read the thread I cannot see Hanumaths
   > answers on the list but it looks mainly like the patch is OK and
   > there is some chit-chat.
   > 
   > Can it be picked up? Everyone is going to need DDR MMC for their
   > eMMCs soon-ish.

I'd like to dedicate more time to mmc/.  Do you think it'd be useful
for me to catch all the patches sent to linux-mmc@ into a public Git
tree, and periodically report on what went upstream via akpm and
what's still waiting?

Of course, the tree could also be used for testing.  Maybe even
automated testing, which I'm also interested in.

Thanks,

- Chris.
-- 
Chris Ball   <cjb@laptop.org>
One Laptop Per Child
--

From: Linus Walleij
Date: Monday, August 23, 2010 - 12:21 am

That sounds very close to getting it participate in linux-next.

Which in turn would make it convenient for you to issue pull
requests to Linus (Torvalds) directly.

Which would make you the MMC subsystem maintainer...

So why not :-)

Yours,
Linus Walleij
--

From: Matt Fleming
Date: Monday, August 23, 2010 - 1:48 pm

It's possible Andrew has a reason that hasn't been picked up yet.

Maybe what we really need is to get patchwork setup for the linux-mmc
list? Other subsystem maintainers swear by it. That way, it'd be much
harder for patches to go unnoticed.
--

From: Andrew Morton
Date: Monday, August 23, 2010 - 2:28 pm

On Mon, 23 Aug 2010 21:48:29 +0100

Kyungmin Park's questions didn't seem adequately answered and the
discussion kind of died.

I updated the patch and merged it, but I'd like the outstanding
question(s) resolved.  ie: why do we add MMC_DDR_MODE, set it in
brq.data.flags and then never use it?


--

From: Adrian Hunter
Date: Tuesday, August 24, 2010 - 3:30 am

I am not able to test DDR mode but it look to me that the patch
should be changed.  Here is a fix:

From 8253aa16b1ab15974a3ba8f33566fe8e2cca29e6 Mon Sep 17 00:00:00 2001
From: Adrian Hunter <adrian.hunter@nokia.com>
Date: Tue, 24 Aug 2010 13:20:26 +0300
Subject: [PATCH] mmc: Fix Dual Data Rate (DDR) support

The DDR support patch needs the following fixes:

- The block driver does not need to know about DDR, any more
than it needs to know about bus width.
- Not only the card must be switched to DDR mode.  The host
controller must also be configured, which is done through
the 'set_ios()' function.
- Do not set the DDR mode state until after the switch command
is successful.
- Setting block length is not supported in DDR mode.  Make that
a core function and change the other place it is used (mmc_test)
also.

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
---
 drivers/mmc/card/block.c    |   19 +++----------------
 drivers/mmc/card/mmc_test.c |   12 +-----------
 drivers/mmc/core/bus.c      |    6 ++++--
 drivers/mmc/core/core.c     |   28 ++++++++++++++++++++++++++--
 drivers/mmc/core/core.h     |    1 +
 drivers/mmc/core/mmc.c      |   21 +++++++++++----------
 include/linux/mmc/core.h    |    3 ++-
 include/linux/mmc/host.h    |    5 +++++
 8 files changed, 53 insertions(+), 42 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 24f39d7..1ec93bb 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -373,8 +373,6 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
 			readcmd = MMC_READ_SINGLE_BLOCK;
 			writecmd = MMC_WRITE_BLOCK;
 		}
-		if (mmc_card_ddr_mode(card))
-			brq.data.flags |= MMC_DDR_MODE;
 		if (rq_data_dir(req) == READ) {
 			brq.cmd.opcode = readcmd;
 			brq.data.flags |= MMC_DATA_READ;
@@ -652,26 +650,15 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
 static int
 mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
 ...
From: Chris Ball
Date: Tuesday, September 14, 2010 - 4:21 am

Hi Hanumath, Linus,


Could someone please test Adrian's patch and report back?  I'd like
to merge this, but not without testing.

https://patchwork.kernel.org/patch/177332/

Thanks,

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child
--

From: Ghorai, Sukumar
Date: Wednesday, September 15, 2010 - 2:32 am

[Ghorai] I was testing this patch (Adrian's) and top of patch[1] from Hanumath; Looks working fine as functionality. Checking throughput in my omap platform.
[1] http://lkml.org/lkml/2010/7/9/35
But there are few comments on this patch from others, I think. And is not applying cleanly in latest codebase. Also following #define is conflicting with Hanumath's patch.
File: include/linux/mmc/host.h
--

From: Ghorai, Sukumar
Date: Sunday, September 19, 2010 - 9:34 pm

[Ghorai] 
Chris and all,
Can we plan these patches for 2.6.37 release? 
Also let me know if I can do anything!

Thanks,
--

From: Chris Ball
Date: Tuesday, September 21, 2010 - 7:20 pm

Hi,


I would like to merge this for .37, and the quirk and merge conflicts
are not a big deal.  First, though, I'd like to see at least some of:

* a reply from Hanumath to Kyungmin on the use of MMC_DDR_MODE,
  and which host controller the submitted patch was tested on.
* an acknowledgement/comment on Adrian's fixup patch
* an ACK on the original+fixup patch as mergeable from Adrian
* some explicit Tested-by: lines for the commit.

Thanks!

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child
--

From: zhangfei gao
Date: Thursday, September 30, 2010 - 1:06 am

Thanks Hanumath for your patch to enable ddr mode for emmc 4.4, thanks
a lot for sharing the patch.
We have verifeid on sdhci-pxa with toshiba emmc.

--

From: Chris Ball
Date: Thursday, September 30, 2010 - 3:30 pm

Hi,


Applied to mmc-next, thanks very much Adrian.

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child
--

From: Chris Ball
Date: Thursday, September 30, 2010 - 3:29 pm

Thanks very much, pushed to mmc-next along with Zhangfei's Tested-By:
and Adrian's fixup patch.

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child
--

Previous thread: Re: [PATCH] netfilter: add CHECKSUM target by Herbert Xu on Friday, July 9, 2010 - 12:18 am. (2 messages)

Next thread: [PATCH] OMAP2: powerdomain: Add break in switch statement by Thomas Weber on Friday, July 9, 2010 - 12:40 am. (3 messages)