]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
mmc: Avoid extra duplicate entry in mmc device structure
authorAndrew Gabbasov <andrew_gabbasov@mentor.com>
Thu, 19 Mar 2015 12:44:03 +0000 (07:44 -0500)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 20:36:25 +0000 (22:36 +0200)
The 'op_cond_response' field in mmc structure contains the response
from the last SEND_OP_COND MMC command while making iterational
polling of the card. Later it is copied to 'ocr' field, designed
to contain the OCR register value, which is actually the same
response from the same command. So, these fields have actually
the same data, just in different time periods. It's easier to use
the same 'ocr' field in both cases at once, without temporary using
of the 'op_cond_response' field.

Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com>
drivers/mmc/mmc.c
include/mmc.h

index 63d15d47690705396b58f3584ff873656ed633a9..192ce1d2e3ab541282e04de4c704621d4b70df88 100644 (file)
@@ -362,8 +362,8 @@ static int mmc_send_op_cond_iter(struct mmc *mmc, struct mmc_cmd *cmd,
        if (use_arg && !mmc_host_is_spi(mmc)) {
                cmd->cmdarg =
                        (mmc->cfg->voltages &
-                       (mmc->op_cond_response & OCR_VOLTAGE_MASK)) |
-                       (mmc->op_cond_response & OCR_ACCESS_MODE);
+                       (mmc->ocr & OCR_VOLTAGE_MASK)) |
+                       (mmc->ocr & OCR_ACCESS_MODE);
 
                if (mmc->cfg->host_caps & MMC_MODE_HC)
                        cmd->cmdarg |= OCR_HCS;
@@ -371,7 +371,7 @@ static int mmc_send_op_cond_iter(struct mmc *mmc, struct mmc_cmd *cmd,
        err = mmc_send_cmd(mmc, cmd, NULL);
        if (err)
                return err;
-       mmc->op_cond_response = cmd->response[0];
+       mmc->ocr = cmd->response[0];
        return 0;
 }
 
@@ -391,7 +391,7 @@ static int mmc_send_op_cond(struct mmc *mmc)
                        return err;
 
                /* exit if not busy (flag seems to be inverted) */
-               if (mmc->op_cond_response & OCR_BUSY)
+               if (mmc->ocr & OCR_BUSY)
                        return 0;
        }
        return IN_PROGRESS;
@@ -413,8 +413,8 @@ static int mmc_complete_op_cond(struct mmc *mmc)
                if (get_timer(start) > timeout)
                        break;
                udelay(100);
-       } while (!(mmc->op_cond_response & OCR_BUSY));
-       if (!(mmc->op_cond_response & OCR_BUSY)) {
+       } while (!(mmc->ocr & OCR_BUSY));
+       if (!(mmc->ocr & OCR_BUSY)) {
                debug("%s: timeout\n", __func__);
                return UNUSABLE_ERR;
        }
@@ -428,10 +428,11 @@ static int mmc_complete_op_cond(struct mmc *mmc)
 
                if (err)
                        return err;
+
+               mmc->ocr = cmd.response[0];
        }
 
        mmc->version = MMC_VERSION_UNKNOWN;
-       mmc->ocr = cmd.response[0];
 
        mmc->high_capacity = ((mmc->ocr & OCR_HCS) == OCR_HCS);
        mmc->rca = 1;
index 7dd03fb89c534b0e91022815ea511976dbff25ad..18e7ca53e80de99b48ced00f9d0f9bdcd70d845e 100644 (file)
@@ -356,7 +356,6 @@ struct mmc {
        char op_cond_pending;   /* 1 if we are waiting on an op_cond command */
        char init_in_progress;  /* 1 if we have done mmc_start_init() */
        char preinit;           /* start init as early as possible */
-       uint op_cond_response;  /* the response byte from the last op_cond */
        int ddr_mode;
 };