Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1289335a2ab57d00c638c3954dc86d6c4eab5606
Commit:     1289335a2ab57d00c638c3954dc86d6c4eab5606
Parent:     fba68bd2dab1ac99af3c5a963ec9581cfa9f1725
Author:     Alex Dubov <[EMAIL PROTECTED]>
AuthorDate: Fri Dec 8 16:50:47 2006 +1100
Committer:  Pierre Ossman <[EMAIL PROTECTED]>
CommitDate: Sun Feb 4 20:54:07 2007 +0100

    tifm_sd: alter order of the states in the command handler
    
    Previously, stop command was issued right after BRS (block received/sent)
    event. Stop command completion event could interfere with the card busy
    event, causing miscount of the written blocks.
    This patch ensures that stop command issued as last action for a
    particular command, after DMA sompletion event and written block
    count verification.
    
    Signed-off-by: Alex Dubov <[EMAIL PROTECTED]>
    Signed-off-by: Pierre Ossman <[EMAIL PROTECTED]>
---
 drivers/mmc/tifm_sd.c |   57 +++++++++++++++++++++++++++++++-----------------
 1 files changed, 37 insertions(+), 20 deletions(-)

diff --git a/drivers/mmc/tifm_sd.c b/drivers/mmc/tifm_sd.c
index fa4a528..f22c396 100644
--- a/drivers/mmc/tifm_sd.c
+++ b/drivers/mmc/tifm_sd.c
@@ -17,7 +17,7 @@
 #include <asm/io.h>
 
 #define DRIVER_NAME "tifm_sd"
-#define DRIVER_VERSION "0.6"
+#define DRIVER_VERSION "0.7"
 
 static int no_dma = 0;
 static int fixed_timeout = 0;
@@ -239,50 +239,65 @@ change_state:
                        tifm_sd_fetch_resp(cmd, sock);
                        if (cmd->data) {
                                host->state = BRS;
-                       } else
+                       } else {
                                host->state = READY;
+                       }
                        goto change_state;
                }
                break;
        case BRS:
                if (tifm_sd_transfer_data(sock, host, host_status)) {
-                       if (!host->req->stop) {
-                               if (cmd->data->flags & MMC_DATA_WRITE) {
-                                       host->state = CARD;
+                       if (cmd->data->flags & MMC_DATA_WRITE) {
+                               host->state = CARD;
+                       } else {
+                               if (no_dma) {
+                                       if (host->req->stop) {
+                                               tifm_sd_exec(host, 
host->req->stop);
+                                               host->state = SCMD;
+                                       } else {
+                                               host->state = READY;
+                                       }
                                } else {
-                                       host->state =
-                                               host->buffer ? READY : FIFO;
+                                       host->state = FIFO;
                                }
-                               goto change_state;
                        }
-                       tifm_sd_exec(host, host->req->stop);
-                       host->state = SCMD;
+                       goto change_state;
                }
                break;
        case SCMD:
                if (host_status & TIFM_MMCSD_EOC) {
                        tifm_sd_fetch_resp(host->req->stop, sock);
-                       if (cmd->error) {
-                               host->state = READY;
-                       } else if (cmd->data->flags & MMC_DATA_WRITE) {
-                               host->state = CARD;
-                       } else {
-                               host->state = host->buffer ? READY : FIFO;
-                       }
+                       host->state = READY;
                        goto change_state;
                }
                break;
        case CARD:
+               dev_dbg(&sock->dev, "waiting for CARD, have %zd blocks\n",
+                       host->written_blocks);
                if (!(host->flags & CARD_BUSY)
                    && (host->written_blocks == cmd->data->blocks)) {
-                       host->state = host->buffer ? READY : FIFO;
+                       if (no_dma) {
+                               if (host->req->stop) {
+                                       tifm_sd_exec(host, host->req->stop);
+                                       host->state = SCMD;
+                               } else {
+                                       host->state = READY;
+                               }
+                       } else {
+                               host->state = FIFO;
+                       }
                        goto change_state;
                }
                break;
        case FIFO:
                if (host->flags & FIFO_RDY) {
-                       host->state = READY;
                        host->flags &= ~FIFO_RDY;
+                       if (host->req->stop) {
+                               tifm_sd_exec(host, host->req->stop);
+                               host->state = SCMD;
+                       } else {
+                               host->state = READY;
+                       }
                        goto change_state;
                }
                break;
@@ -340,7 +355,9 @@ static unsigned int tifm_sd_signal_irq(struct tifm_dev 
*sock,
                        if (host->req->stop) {
                                if (host->state == SCMD) {
                                        host->req->stop->error = error_code;
-                               } else if(host->state == BRS) {
+                               } else if (host->state == BRS
+                                          || host->state == CARD
+                                          || host->state == FIFO) {
                                        host->req->cmd->error = error_code;
                                        tifm_sd_exec(host, host->req->stop);
                                        queue_delayed_work(sock->wq,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to