mmc: card: Issue BKOPS when queue is empty
Shridhar Rasal [Wed, 25 Jan 2012 13:19:32 +0000 (18:19 +0530)]
Issue BKOPS when the request queue is empty.
Before handling any new request, issue HPI
if bkops is being performed.

bug 919232

Originally reviewed on http://git-master/r/69779

Change-Id: Ic9258ebfea7f9cde96525371a5ef9d6d003ebf2f
Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-on: http://git-master/r/77335
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sachin Nikam <snikam@nvidia.com>

drivers/mmc/card/block.c
drivers/mmc/card/queue.c

index 6db913d..2bd93d7 100644 (file)
@@ -1140,6 +1140,9 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
                }
        } while (ret);
 
+       if (brq->cmd.resp[0] & R1_URGENT_BKOPS)
+               mmc_card_set_need_bkops(card);
+
        return 1;
 
  cmd_err:
@@ -1221,6 +1224,10 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
                        mmc_blk_issue_rw_rq(mq, NULL);
                ret = mmc_blk_issue_flush(mq, req);
        } else {
+               /* Abort any current bk ops of eMMC card by issuing HPI */
+               if (mmc_card_mmc(mq->card) && mmc_card_doing_bkops(mq->card))
+                       mmc_interrupt_hpi(mq->card);
+
                ret = mmc_blk_issue_rw_rq(mq, req);
        }
 
index 45fb362..5db38cb 100644 (file)
@@ -64,6 +64,12 @@ static int mmc_queue_thread(void *d)
                        set_current_state(TASK_RUNNING);
                        mq->issue_fn(mq, req);
                } else {
+                       /*
+                        * Since the queue is empty, start synchronous
+                        * background ops if there is a request for it.
+                        */
+                       if (mmc_card_need_bkops(mq->card))
+                               mmc_bkops_start(mq->card, true);
                        if (kthread_should_stop()) {
                                set_current_state(TASK_RUNNING);
                                break;