public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dw_mmc: support send_auto_stop
@ 2011-03-30  5:55 Jaehoon Chung
  2011-03-30 12:37 ` Will Newton
  0 siblings, 1 reply; 3+ messages in thread
From: Jaehoon Chung @ 2011-03-30  5:55 UTC (permalink / raw)
  To: linux-mmc@vger.kernel.org; +Cc: will.newton, Chris Ball, Kyungmin Park

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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dw_mmc: support send_auto_stop
  2011-03-30  5:55 [PATCH] dw_mmc: support send_auto_stop Jaehoon Chung
@ 2011-03-30 12:37 ` Will Newton
  2011-03-31  1:29   ` Jaehoon Chung
  0 siblings, 1 reply; 3+ messages in thread
From: Will Newton @ 2011-03-30 12:37 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-mmc@vger.kernel.org, Chris Ball, Kyungmin Park

On Wed, Mar 30, 2011 at 6:55 AM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> 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>

This is something I have been meaning to look into, does it improve
latency or throughput in your experiments?

Is there a reason you have implemented it as a quirk? I would have
thought if it was a win (in performance or code size) it would be
applicable to all instances of this block?

If we implemented it as an unconditional feature then we could
probably remove some of the explicit stop handling code.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dw_mmc: support send_auto_stop
  2011-03-30 12:37 ` Will Newton
@ 2011-03-31  1:29   ` Jaehoon Chung
  0 siblings, 0 replies; 3+ messages in thread
From: Jaehoon Chung @ 2011-03-31  1:29 UTC (permalink / raw)
  To: Will Newton
  Cc: Jaehoon Chung, linux-mmc@vger.kernel.org, Chris Ball,
	Kyungmin Park

Will Newton wrote:
> On Wed, Mar 30, 2011 at 6:55 AM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>> 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>
> 
> This is something I have been meaning to look into, does it improve
> latency or throughput in your experiments?

Not improve latency...but in my experiments,
when i used this, i could find the stable throughput..

> 
> Is there a reason you have implemented it as a quirk? I would have
> thought if it was a win (in performance or code size) it would be
> applicable to all instances of this block?

I didn't test every case..so Somebody doesn't want to use send_auto_stop,
So i think good that used the quirks...
you can see Send_Auto_Stop generation table in DesigneWare MMC controller spec
I think that our case can use send_auto_stop...but i didn't ensure in other case

> 
> If we implemented it as an unconditional feature then we could
> probably remove some of the explicit stop handling code.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-31  1:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-30  5:55 [PATCH] dw_mmc: support send_auto_stop Jaehoon Chung
2011-03-30 12:37 ` Will Newton
2011-03-31  1:29   ` Jaehoon Chung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox