Commit 9a9f7e13 authored by Victor Shih's avatar Victor Shih Committed by Ulf Hansson
Browse files

mmc: core: Support UHS-II card control and access



Embed UHS-II access/control functionality into the MMC request
processing flow.

Signed-off-by: default avatarJason Lai <jason.lai@genesyslogic.com.tw>
Signed-off-by: default avatarVictor Shih <victor.shih@genesyslogic.com.tw>
Message-ID: <20241018105333.4569-2-victorshihgli@gmail.com>
[Ulf: A couple of cleanups and fixed sd_uhs2_power_off()]
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 328bda09
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -354,6 +354,9 @@ int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
	if (err)
		return err;

	if (host->uhs2_sd_tran)
		mmc_uhs2_prepare_cmd(host, mrq);

	led_trigger_event(host->led, LED_FULL);
	__mmc_start_request(host, mrq);

@@ -453,6 +456,9 @@ int mmc_cqe_start_req(struct mmc_host *host, struct mmc_request *mrq)
	if (err)
		goto out_err;

	if (host->uhs2_sd_tran)
		mmc_uhs2_prepare_cmd(host, mrq);

	err = host->cqe_ops->cqe_request(host, mrq);
	if (err)
		goto out_err;
@@ -1135,7 +1141,7 @@ u32 mmc_select_voltage(struct mmc_host *host, u32 ocr)
		return 0;
	}

	if (host->caps2 & MMC_CAP2_FULL_PWR_CYCLE) {
	if (!mmc_card_uhs2(host) && host->caps2 & MMC_CAP2_FULL_PWR_CYCLE) {
		bit = ffs(ocr) - 1;
		ocr &= 3 << bit;
		mmc_power_cycle(host, ocr);
+2 −2
Original line number Diff line number Diff line
@@ -200,7 +200,7 @@ static int mmc_decode_csd(struct mmc_card *card, bool is_sduc)
/*
 * Given a 64-bit response, decode to our card SCR structure.
 */
static int mmc_decode_scr(struct mmc_card *card)
int mmc_decode_scr(struct mmc_card *card)
{
	struct sd_scr *scr = &card->scr;
	unsigned int scr_struct;
@@ -903,7 +903,7 @@ int mmc_sd_get_csd(struct mmc_card *card, bool is_sduc)
	return 0;
}

static int mmc_sd_get_ro(struct mmc_host *host)
int mmc_sd_get_ro(struct mmc_host *host)
{
	int ro;

+2 −0
Original line number Diff line number Diff line
@@ -11,6 +11,8 @@ struct mmc_card;

int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid, u32 *rocr);
int mmc_sd_get_csd(struct mmc_card *card, bool is_sduc);
int mmc_decode_scr(struct mmc_card *card);
int mmc_sd_get_ro(struct mmc_host *host);
void mmc_decode_cid(struct mmc_card *card);
int mmc_sd_setup_card(struct mmc_host *host, struct mmc_card *card,
	bool reinit);
+9 −0
Original line number Diff line number Diff line
@@ -42,6 +42,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->uhs2_sd_tran) {
		host->uhs2_app_cmd = true;
		return 0;
	}

	cmd.opcode = MMC_APP_CMD;

	if (card) {
+2 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@

struct mmc_card;
struct mmc_host;
struct mmc_request;

int mmc_app_set_bus_width(struct mmc_card *card, int width);
int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr);
@@ -22,6 +23,7 @@ int mmc_app_send_scr(struct mmc_card *card);
int mmc_app_sd_status(struct mmc_card *card, void *ssr);
int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card);
int mmc_send_ext_addr(struct mmc_host *host, u32 addr);
void mmc_uhs2_prepare_cmd(struct mmc_host *host, struct mmc_request *mrq);

#endif
Loading