Skip to contentSkip to conversation

mmc: core: UHS-II support, set APP_CMD bit if necessary

RFC PATCH In review Ben Chuang 1 participant 1 message Jul 10, 2020 MMC, SD and SDIO

lore
Share & tools
lore

Ben Chuang

author
#0 lore raw

RFC PATCH v3 7/21 mmc: core: UHS-II support, set APP_CMD bit if necessary

From: AKASHI Takahiro <[email protected]>

In UHS-II mode, MMC_APP_CMD command need not to be sent. Instead, APP_CMD bit in a packet should be set.

---
 drivers/mmc/core/sd_ops.c | 9 +++++++++
 drivers/mmc/core/uhs2.c   | 4 ++++
 2 files changed, 13 insertions(+)
drivers/mmc/core/sd_ops.c +9 -0
index f58bb50872f6..9dc296356928 100644
@@ -26,6 +26,15 @@ int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card)
 	if (WARN_ON(card && card->host != host))
 		return -EINVAL;
 
+	/* UHS2 packet has APP bit so only set APP_CMD flag here.
+	 * Will set the APP bit when assembling UHS2 packet.
+	 */
+	if (host->flags &  MMC_UHS2_SUPPORT &&
+	    host->flags & MMC_UHS2_INITIALIZED) {
+		host->flags |= MMC_UHS2_APP_CMD;
+		return 0;
+	}
+
 	cmd.opcode = MMC_APP_CMD;
 
 	if (card) {
drivers/mmc/core/uhs2.c +4 -0
index 6e26de429726..2fbd7b6d9dea 100644
@@ -826,6 +826,10 @@ int uhs2_prepare_sd_cmd(struct mmc_host *host, struct mmc_request *mrq)
 		header |= UHS2_PACKET_TYPE_CCMD;
 
 	arg = cmd->opcode << UHS2_SD_CMD_INDEX_POS;
+	if (host->flags & MMC_UHS2_APP_CMD) {
+		arg |= UHS2_SD_CMD_APP;
+		host->flags &= ~MMC_UHS2_APP_CMD;
+	}
 
 	uhs2_cmd = cmd->uhs2_cmd;
 	payload = uhs2_cmd->payload;
Signature · 1 line
2.27.0