From 2a82a9c95f6c06079f58d69315544a6b49cf64a4 Mon Sep 17 00:00:00 2001 From: Jun Nie Date: Thu, 28 Jun 2018 16:38:00 +0800 Subject: [PATCH] drivers: emmc: dw_mmc: Add response flag into response ID definition Add response flag into ID definition so that driver does not need to handle it again. Signed-off-by: Jun Nie Signed-off-by: Bryan O'Donoghue --- drivers/synopsys/emmc/dw_mmc.c | 7 +++++-- include/drivers/mmc.h | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/synopsys/emmc/dw_mmc.c b/drivers/synopsys/emmc/dw_mmc.c index b0b0a3fd..c544233f 100644 --- a/drivers/synopsys/emmc/dw_mmc.c +++ b/drivers/synopsys/emmc/dw_mmc.c @@ -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: diff --git a/include/drivers/mmc.h b/include/drivers/mmc.h index 0a513bd6..50e08001 100644 --- a/include/drivers/mmc.h +++ b/include/drivers/mmc.h @@ -36,6 +36,20 @@ #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 */ -- 2.30.2