aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWenbin Mei <wenbin.mei@mediatek.com>2022-06-08 16:37:00 +0800
committerMartin L Roth <gaumless@tutanota.com>2022-06-12 22:28:37 +0000
commita49460c6b6e54bf09945263e8a57119e813f6de5 (patch)
tree5a6441cef1ddeb2771de7d708415ffa66ba7f061
parentf32a533931845f7974b25dda7191eac40ef831e5 (diff)
soc/mediatek: pass access mode to the payload
Some eMMCs (for example, Kingston-EMMC64G-TX29-HP) may enter the ready state by sending CMD1 twice. If it is in the ready state, then the payload (for example, depthcharge) will not send CMD1, but the access mode is only available from the response of CMD1. Therefore, we need to pass the access mode to the payload by defining the following types: - MMC_STATUS_CMD1_READY: in ready state and access mode is byte mode. - MMC_STATUS_CMD1_READY_HCS: in ready state and access mode is sector mode. BUG=b:234672726 BRANCH=cherry TEST=boot ok Signed-off-by: Wenbin Mei <wenbin.mei@mediatek.com> Change-Id: Iad905781d8ba0105911cf87a6b845cd8df57521e Reviewed-on: https://review.coreboot.org/c/coreboot/+/65054 Reviewed-by: Yidi Lin <yidilin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
-rw-r--r--src/commonlib/include/commonlib/sd_mmc_ctrlr.h3
-rw-r--r--src/soc/mediatek/common/msdc.c12
2 files changed, 10 insertions, 5 deletions
diff --git a/src/commonlib/include/commonlib/sd_mmc_ctrlr.h b/src/commonlib/include/commonlib/sd_mmc_ctrlr.h
index 6ac274090f..c5da967d89 100644
--- a/src/commonlib/include/commonlib/sd_mmc_ctrlr.h
+++ b/src/commonlib/include/commonlib/sd_mmc_ctrlr.h
@@ -17,8 +17,9 @@
enum {
MMC_STATUS_NEED_RESET = 0,
MMC_STATUS_CMD1_READY_OR_IN_PROGRESS,
- MMC_STATUS_CMD1_READY,
+ MMC_STATUS_CMD1_READY, /* Byte mode */
MMC_STATUS_CMD1_IN_PROGRESS,
+ MMC_STATUS_CMD1_READY_HCS, /* Sector mode (High capacity support) */
};
struct mmc_command {
diff --git a/src/soc/mediatek/common/msdc.c b/src/soc/mediatek/common/msdc.c
index 8208886c20..6e0086ba75 100644
--- a/src/soc/mediatek/common/msdc.c
+++ b/src/soc/mediatek/common/msdc.c
@@ -474,12 +474,16 @@ int mtk_emmc_early_init(void *base, void *top_base)
/* Send CMD1 */
err = mmc_send_op_cond(&media);
- if (err == 0)
- set_early_mmc_wake_status(MMC_STATUS_CMD1_READY);
- else if (err == CARD_IN_PROGRESS)
+ if (err == 0) {
+ if (media.op_cond_response & OCR_HCS)
+ set_early_mmc_wake_status(MMC_STATUS_CMD1_READY_HCS);
+ else
+ set_early_mmc_wake_status(MMC_STATUS_CMD1_READY);
+ } else if (err == CARD_IN_PROGRESS) {
set_early_mmc_wake_status(MMC_STATUS_CMD1_IN_PROGRESS);
- else
+ } else {
goto out_err;
+ }
return 0;