Linux MultiMedia Card development
 help / color / mirror / Atom feed
* [PATCH RESEND] mmc: dw_mmc: Support predefined mutiple block transfers
@ 2011-12-09  5:56 Seungwon Jeon
  0 siblings, 0 replies; 4+ messages in thread
From: Seungwon Jeon @ 2011-12-09  5:56 UTC (permalink / raw)
  To: linux-mmc; +Cc: 'Chris Ball', linux-samsung-soc

This patch adds the support for predefined multiple block read/write.

Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
---
 drivers/mmc/host/dw_mmc.c |   34 ++++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 366df6b..f8301a7 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -588,11 +588,11 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot)
 	mci_writel(host, CTYPE, (slot->ctype << slot->id));
 }
 
-static void dw_mci_start_request(struct dw_mci *host,
-				 struct dw_mci_slot *slot)
+static void __dw_mci_start_request(struct dw_mci *host,
+				   struct dw_mci_slot *slot,
+				   struct mmc_command *cmd)
 {
 	struct mmc_request *mrq;
-	struct mmc_command *cmd;
 	struct mmc_data	*data;
 	u32 cmdflags;
 
@@ -610,14 +610,13 @@ static void dw_mci_start_request(struct dw_mci *host,
 	host->completed_events = 0;
 	host->data_status = 0;
 
-	data = mrq->data;
+	data = cmd->data;
 	if (data) {
 		dw_mci_set_timeout(host);
 		mci_writel(host, BYTCNT, data->blksz*data->blocks);
 		mci_writel(host, BLKSIZ, data->blksz);
 	}
 
-	cmd = mrq->cmd;
 	cmdflags = dw_mci_prepare_command(slot->mmc, cmd);
 
 	/* this is the first command, send the initialization clock */
@@ -635,6 +634,16 @@ static void dw_mci_start_request(struct dw_mci *host,
 		host->stop_cmdr = dw_mci_prepare_command(slot->mmc, mrq->stop);
 }
 
+static void dw_mci_start_request(struct dw_mci *host,
+				 struct dw_mci_slot *slot)
+{
+	struct mmc_request *mrq = slot->mrq;
+	struct mmc_command *cmd;
+
+	cmd = mrq->sbc ? mrq->sbc : mrq->cmd;
+	__dw_mci_start_request(host, slot, cmd);
+}
+
 /* must be called with host->lock held */
 static void dw_mci_queue_request(struct dw_mci *host, struct dw_mci_slot *slot,
 				 struct mmc_request *mrq)
@@ -889,7 +898,14 @@ static void dw_mci_tasklet_func(unsigned long priv)
 			cmd = host->cmd;
 			host->cmd = NULL;
 			set_bit(EVENT_CMD_COMPLETE, &host->completed_events);
-			dw_mci_command_complete(host, host->mrq->cmd);
+			dw_mci_command_complete(host, cmd);
+			if ((cmd == host->mrq->sbc) && !cmd->error) {
+				prev_state = state = STATE_SENDING_CMD;
+				__dw_mci_start_request(host, host->cur_slot,
+						       host->mrq->cmd);
+				goto unlock;
+			}
+
 			if (!host->mrq->data || cmd->error) {
 				dw_mci_request_end(host, host->mrq);
 				goto unlock;
@@ -967,6 +983,12 @@ static void dw_mci_tasklet_func(unsigned long priv)
 				goto unlock;
 			}
 
+			if (host->mrq->sbc && !data->error) {
+				data->stop->error = 0;
+				dw_mci_request_end(host, host->mrq);
+				goto unlock;
+			}
+
 			prev_state = state = STATE_SENDING_STOP;
 			if (!data->error)
 				send_stop_cmd(host, data);
-- 
1.7.0.4



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

* [PATCH RESEND] mmc: dw_mmc: Support predefined mutiple block transfers
@ 2011-12-22  9:01 Seungwon Jeon
  2011-12-22 11:40 ` Will Newton
  0 siblings, 1 reply; 4+ messages in thread
From: Seungwon Jeon @ 2011-12-22  9:01 UTC (permalink / raw)
  To: linux-mmc; +Cc: 'Chris Ball', linux-samsung-soc

This patch adds the support for predefined multiple block r/w.
dw_mmc can support MMC_CAP_CMD23 capability.

Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
---
 drivers/mmc/host/dw_mmc.c |   34 ++++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 3aaeb08..04653e8 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -588,11 +588,11 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot)
 	mci_writel(host, CTYPE, (slot->ctype << slot->id));
 }
 
-static void dw_mci_start_request(struct dw_mci *host,
-				 struct dw_mci_slot *slot)
+static void __dw_mci_start_request(struct dw_mci *host,
+				   struct dw_mci_slot *slot,
+				   struct mmc_command *cmd)
 {
 	struct mmc_request *mrq;
-	struct mmc_command *cmd;
 	struct mmc_data	*data;
 	u32 cmdflags;
 
@@ -610,14 +610,13 @@ static void dw_mci_start_request(struct dw_mci *host,
 	host->completed_events = 0;
 	host->data_status = 0;
 
-	data = mrq->data;
+	data = cmd->data;
 	if (data) {
 		dw_mci_set_timeout(host);
 		mci_writel(host, BYTCNT, data->blksz*data->blocks);
 		mci_writel(host, BLKSIZ, data->blksz);
 	}
 
-	cmd = mrq->cmd;
 	cmdflags = dw_mci_prepare_command(slot->mmc, cmd);
 
 	/* this is the first command, send the initialization clock */
@@ -635,6 +634,16 @@ static void dw_mci_start_request(struct dw_mci *host,
 		host->stop_cmdr = dw_mci_prepare_command(slot->mmc, mrq->stop);
 }
 
+static void dw_mci_start_request(struct dw_mci *host,
+				 struct dw_mci_slot *slot)
+{
+	struct mmc_request *mrq = slot->mrq;
+	struct mmc_command *cmd;
+
+	cmd = mrq->sbc ? mrq->sbc : mrq->cmd;
+	__dw_mci_start_request(host, slot, cmd);
+}
+
 /* must be called with host->lock held */
 static void dw_mci_queue_request(struct dw_mci *host, struct dw_mci_slot *slot,
 				 struct mmc_request *mrq)
@@ -889,7 +898,14 @@ static void dw_mci_tasklet_func(unsigned long priv)
 			cmd = host->cmd;
 			host->cmd = NULL;
 			set_bit(EVENT_CMD_COMPLETE, &host->completed_events);
-			dw_mci_command_complete(host, host->mrq->cmd);
+			dw_mci_command_complete(host, cmd);
+			if ((cmd == host->mrq->sbc) && !cmd->error) {
+				prev_state = state = STATE_SENDING_CMD;
+				__dw_mci_start_request(host, host->cur_slot,
+						       host->mrq->cmd);
+				goto unlock;
+			}
+
 			if (!host->mrq->data || cmd->error) {
 				dw_mci_request_end(host, host->mrq);
 				goto unlock;
@@ -967,6 +983,12 @@ static void dw_mci_tasklet_func(unsigned long priv)
 				goto unlock;
 			}
 
+			if (host->mrq->sbc && !data->error) {
+				data->stop->error = 0;
+				dw_mci_request_end(host, host->mrq);
+				goto unlock;
+			}
+
 			prev_state = state = STATE_SENDING_STOP;
 			if (!data->error)
 				send_stop_cmd(host, data);
-- 
1.7.0.4



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

* Re: [PATCH RESEND] mmc: dw_mmc: Support predefined mutiple block transfers
  2011-12-22  9:01 [PATCH RESEND] mmc: dw_mmc: Support predefined mutiple block transfers Seungwon Jeon
@ 2011-12-22 11:40 ` Will Newton
  2011-12-25  2:09   ` Chris Ball
  0 siblings, 1 reply; 4+ messages in thread
From: Will Newton @ 2011-12-22 11:40 UTC (permalink / raw)
  To: Seungwon Jeon; +Cc: linux-mmc, Chris Ball, linux-samsung-soc

On Thu, Dec 22, 2011 at 9:01 AM, Seungwon Jeon <tgih.jun@samsung.com> wrote:
> This patch adds the support for predefined multiple block r/w.
> dw_mmc can support MMC_CAP_CMD23 capability.
>
> Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc.c |   34 ++++++++++++++++++++++++++++------
>  1 files changed, 28 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 3aaeb08..04653e8 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -588,11 +588,11 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot)
>        mci_writel(host, CTYPE, (slot->ctype << slot->id));
>  }
>
> -static void dw_mci_start_request(struct dw_mci *host,
> -                                struct dw_mci_slot *slot)
> +static void __dw_mci_start_request(struct dw_mci *host,
> +                                  struct dw_mci_slot *slot,
> +                                  struct mmc_command *cmd)
>  {
>        struct mmc_request *mrq;
> -       struct mmc_command *cmd;
>        struct mmc_data *data;
>        u32 cmdflags;
>
> @@ -610,14 +610,13 @@ static void dw_mci_start_request(struct dw_mci *host,
>        host->completed_events = 0;
>        host->data_status = 0;
>
> -       data = mrq->data;
> +       data = cmd->data;
>        if (data) {
>                dw_mci_set_timeout(host);
>                mci_writel(host, BYTCNT, data->blksz*data->blocks);
>                mci_writel(host, BLKSIZ, data->blksz);
>        }
>
> -       cmd = mrq->cmd;
>        cmdflags = dw_mci_prepare_command(slot->mmc, cmd);
>
>        /* this is the first command, send the initialization clock */
> @@ -635,6 +634,16 @@ static void dw_mci_start_request(struct dw_mci *host,
>                host->stop_cmdr = dw_mci_prepare_command(slot->mmc, mrq->stop);
>  }
>
> +static void dw_mci_start_request(struct dw_mci *host,
> +                                struct dw_mci_slot *slot)
> +{
> +       struct mmc_request *mrq = slot->mrq;
> +       struct mmc_command *cmd;
> +
> +       cmd = mrq->sbc ? mrq->sbc : mrq->cmd;
> +       __dw_mci_start_request(host, slot, cmd);
> +}
> +
>  /* must be called with host->lock held */
>  static void dw_mci_queue_request(struct dw_mci *host, struct dw_mci_slot *slot,
>                                 struct mmc_request *mrq)
> @@ -889,7 +898,14 @@ static void dw_mci_tasklet_func(unsigned long priv)
>                        cmd = host->cmd;
>                        host->cmd = NULL;
>                        set_bit(EVENT_CMD_COMPLETE, &host->completed_events);
> -                       dw_mci_command_complete(host, host->mrq->cmd);
> +                       dw_mci_command_complete(host, cmd);
> +                       if ((cmd == host->mrq->sbc) && !cmd->error) {

The inner set of parentheses here is not strictly required.

> +                               prev_state = state = STATE_SENDING_CMD;
> +                               __dw_mci_start_request(host, host->cur_slot,
> +                                                      host->mrq->cmd);
> +                               goto unlock;
> +                       }
> +
>                        if (!host->mrq->data || cmd->error) {
>                                dw_mci_request_end(host, host->mrq);
>                                goto unlock;
> @@ -967,6 +983,12 @@ static void dw_mci_tasklet_func(unsigned long priv)
>                                goto unlock;
>                        }
>
> +                       if (host->mrq->sbc && !data->error) {
> +                               data->stop->error = 0;
> +                               dw_mci_request_end(host, host->mrq);
> +                               goto unlock;
> +                       }
> +
>                        prev_state = state = STATE_SENDING_STOP;
>                        if (!data->error)
>                                send_stop_cmd(host, data);
> --
> 1.7.0.4

Otherwise looks ok.

Acked-by: Will Newton <will.newton@imgtec.com>

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

* Re: [PATCH RESEND] mmc: dw_mmc: Support predefined mutiple block transfers
  2011-12-22 11:40 ` Will Newton
@ 2011-12-25  2:09   ` Chris Ball
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Ball @ 2011-12-25  2:09 UTC (permalink / raw)
  To: Will Newton; +Cc: Seungwon Jeon, linux-mmc, linux-samsung-soc

Hi,

On Thu, Dec 22 2011, Will Newton wrote:
> On Thu, Dec 22, 2011 at 9:01 AM, Seungwon Jeon <tgih.jun@samsung.com> wrote:
>> This patch adds the support for predefined multiple block r/w.
>> dw_mmc can support MMC_CAP_CMD23 capability.
>>
>> Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
>> ---
>>  drivers/mmc/host/dw_mmc.c |   34 ++++++++++++++++++++++++++++------
>>  1 files changed, 28 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
>> index 3aaeb08..04653e8 100644
>> --- a/drivers/mmc/host/dw_mmc.c
>> +++ b/drivers/mmc/host/dw_mmc.c
>> @@ -588,11 +588,11 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot)
>>        mci_writel(host, CTYPE, (slot->ctype << slot->id));
>>  }
>>
>> -static void dw_mci_start_request(struct dw_mci *host,
>> -                                struct dw_mci_slot *slot)
>> +static void __dw_mci_start_request(struct dw_mci *host,
>> +                                  struct dw_mci_slot *slot,
>> +                                  struct mmc_command *cmd)
>>  {
>>        struct mmc_request *mrq;
>> -       struct mmc_command *cmd;
>>        struct mmc_data *data;
>>        u32 cmdflags;
>>
>> @@ -610,14 +610,13 @@ static void dw_mci_start_request(struct dw_mci *host,
>>        host->completed_events = 0;
>>        host->data_status = 0;
>>
>> -       data = mrq->data;
>> +       data = cmd->data;
>>        if (data) {
>>                dw_mci_set_timeout(host);
>>                mci_writel(host, BYTCNT, data->blksz*data->blocks);
>>                mci_writel(host, BLKSIZ, data->blksz);
>>        }
>>
>> -       cmd = mrq->cmd;
>>        cmdflags = dw_mci_prepare_command(slot->mmc, cmd);
>>
>>        /* this is the first command, send the initialization clock */
>> @@ -635,6 +634,16 @@ static void dw_mci_start_request(struct dw_mci *host,
>>                host->stop_cmdr = dw_mci_prepare_command(slot->mmc, mrq->stop);
>>  }
>>
>> +static void dw_mci_start_request(struct dw_mci *host,
>> +                                struct dw_mci_slot *slot)
>> +{
>> +       struct mmc_request *mrq = slot->mrq;
>> +       struct mmc_command *cmd;
>> +
>> +       cmd = mrq->sbc ? mrq->sbc : mrq->cmd;
>> +       __dw_mci_start_request(host, slot, cmd);
>> +}
>> +
>>  /* must be called with host->lock held */
>>  static void dw_mci_queue_request(struct dw_mci *host, struct
>> dw_mci_slot *slot,
>>                                 struct mmc_request *mrq)
>> @@ -889,7 +898,14 @@ static void dw_mci_tasklet_func(unsigned long priv)
>>                        cmd = host->cmd;
>>                        host->cmd = NULL;
>>                        set_bit(EVENT_CMD_COMPLETE, &host->completed_events);
>> -                       dw_mci_command_complete(host, host->mrq->cmd);
>> +                       dw_mci_command_complete(host, cmd);
>> +                       if ((cmd == host->mrq->sbc) && !cmd->error) {
>
> The inner set of parentheses here is not strictly required.
>
>> +                               prev_state = state = STATE_SENDING_CMD;
>> +                               __dw_mci_start_request(host, host->cur_slot,
>> +                                                      host->mrq->cmd);
>> +                               goto unlock;
>> +                       }
>> +
>>                        if (!host->mrq->data || cmd->error) {
>>                                dw_mci_request_end(host, host->mrq);
>>                                goto unlock;
>> @@ -967,6 +983,12 @@ static void dw_mci_tasklet_func(unsigned long priv)
>>                                goto unlock;
>>                        }
>>
>> +                       if (host->mrq->sbc && !data->error) {
>> +                               data->stop->error = 0;
>> +                               dw_mci_request_end(host, host->mrq);
>> +                               goto unlock;
>> +                       }
>> +
>>                        prev_state = state = STATE_SENDING_STOP;
>>                        if (!data->error)
>>                                send_stop_cmd(host, data);
>> --
>> 1.7.0.4
>
> Otherwise looks ok.
>
> Acked-by: Will Newton <will.newton@imgtec.com>

Thanks, pushed to mmc-next for 3.3 with Will's ACK and suggested change.

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

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

end of thread, other threads:[~2011-12-25  2:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-22  9:01 [PATCH RESEND] mmc: dw_mmc: Support predefined mutiple block transfers Seungwon Jeon
2011-12-22 11:40 ` Will Newton
2011-12-25  2:09   ` Chris Ball
  -- strict thread matches above, loose matches on Subject: below --
2011-12-09  5:56 Seungwon Jeon

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