drivers: emmc: dw_mmc: Add response flag into response ID definition
authorJun Nie <jun.nie@linaro.org>
Thu, 28 Jun 2018 08:38:00 +0000 (16:38 +0800)
committerBryan O'Donoghue <bryan.odonoghue@linaro.org>
Tue, 4 Sep 2018 11:35:21 +0000 (12:35 +0100)
Add response flag into ID definition so that driver does not
need to handle it again.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
drivers/synopsys/emmc/dw_mmc.c
include/drivers/mmc.h

index b0b0a3fd431ea2ac29e78a3663ad7cb2cad1c189..c544233fc28f4c1207d807af50cb4fbc1715dc13 100644 (file)
@@ -259,11 +259,14 @@ static int dw_send_cmd(struct mmc_cmd *cmd)
        switch (cmd->resp_type) {
        case 0:
                break;
-       case MMC_RESPONSE_R(2):
+       case MMC_RESPONSE_R2:
                op |= CMD_RESP_EXPECT | CMD_CHECK_RESP_CRC |
                      CMD_RESP_LEN;
                break;
-       case MMC_RESPONSE_R(3):
+       case MMC_RESPONSE_R1:
+       case MMC_RESPONSE_R1B:
+       case MMC_RESPONSE_R3:
+       case MMC_RESPONSE_R5:
                op |= CMD_RESP_EXPECT;
                break;
        default:
index 0a513bd645c2e1e1c2ce76908251b1796f72537e..50e08001dd0fb9c67530942e729c79e3848395b5 100644 (file)
 #define OCR_VDD_MIN_2V0                        GENMASK(14, 8)
 #define OCR_VDD_MIN_1V7                        BIT(7)
 
+#define MMC_RSP_48                     BIT(0)
+#define MMC_RSP_136                    BIT(1)          /* 136 bit response */
+#define MMC_RSP_CRC                    BIT(2)          /* expect valid crc */
+#define MMC_RSP_CMD_IDX                        BIT(3)          /* response contains cmd idx */
+#define MMC_RSP_BUSY                   BIT(4)          /* device may be busy */
+
+/* JEDEC 4.51 chapter 6.12 */
+#define MMC_RESPONSE_R1                        (MMC_RSP_48 | MMC_RSP_CMD_IDX | MMC_RSP_CRC)
+#define MMC_RESPONSE_R1B               (MMC_RESPONSE_R1 | MMC_RSP_BUSY)
+#define MMC_RESPONSE_R2                        (MMC_RSP_136 | MMC_RSP_CRC)
+#define MMC_RESPONSE_R3                        (MMC_RSP_48)
+#define MMC_RESPONSE_R4                        (MMC_RSP_48)
+#define MMC_RESPONSE_R5                        (MMC_RSP_48 | MMC_RSP_CRC)
+
 #define MMC_RESPONSE_R(_x)             U(_x)
 
 /* Value randomly chosen for eMMC RCA, it should be > 1 */