All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Cc: will.newton@imgtec.com, Chris Ball <cjb@laptop.org>,
	Kyungmin Park <kyungmin.park@samsung.com>
Subject: [PATCH] dw_mmc: support send_auto_stop
Date: Wed, 30 Mar 2011 14:55:30 +0900	[thread overview]
Message-ID: <4D92C5D2.2000004@samsung.com> (raw)

This patch is set the send_auto_stop bit in CMD register.
If use DW_MCI_QUIRK_SEND_AUTO_STOP, helps to send an exact
number of data bytes.


Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/mmc/host/dw_mmc.c  |   10 ++++++++++
 include/linux/mmc/dw_mmc.h |    2 ++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 87e1f57..6c4cb46 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -229,6 +229,8 @@ static void dw_mci_set_timeout(struct dw_mci *host)
 
 static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
 {
+	struct dw_mci_slot *slot = mmc_priv(mmc);
+	struct dw_mci *host = slot->host;
 	struct mmc_data	*data;
 	u32 cmdr;
 	cmd->error = -EINPROGRESS;
@@ -257,6 +259,9 @@ static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
 			cmdr |= SDMMC_CMD_STRM_MODE;
 		if (data->flags & MMC_DATA_WRITE)
 			cmdr |= SDMMC_CMD_DAT_WR;
+		if ((host->quirks & DW_MCI_QUIRK_SEND_AUTO_STOP) &&
+				(data->blocks > 1))
+			cmdr |= SDMMC_CMD_SEND_STOP;
 	}
 
 	return cmdr;
@@ -656,6 +661,11 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq)
 		return;
 	}
 
+	if ((host->quirks & DW_MCI_QUIRK_SEND_AUTO_STOP) && mrq->stop) {
+		mrq->data->stop = NULL;
+		mrq->stop = NULL;
+	}
+
 	/* We don't support multiple blocks of weird lengths. */
 	dw_mci_queue_request(host, slot, mrq);
 }
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index c0207a7..b98aafa 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -176,6 +176,8 @@ struct dw_mci_dma_ops {
 #define DW_MCI_QUIRK_HIGHSPEED			BIT(2)
 /* Unreliable card detection */
 #define DW_MCI_QUIRK_BROKEN_CARD_DETECTION	BIT(3)
+/* Use Auto_Send_Stop Command */
+#define DW_MCI_QUIRK_SEND_AUTO_STOP		BIT(4)
 
 
 struct dma_pdata;

             reply	other threads:[~2011-03-30  5:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-30  5:55 Jaehoon Chung [this message]
2011-03-30 12:37 ` [PATCH] dw_mmc: support send_auto_stop Will Newton
2011-03-31  1:29   ` Jaehoon Chung

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=4D92C5D2.2000004@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=cjb@laptop.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=will.newton@imgtec.com \
    /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.