Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af3070fc authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mmc: core: fix issue with sleep cmd that follows an RPMB access"

parents 83e58edd 50384b8c
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -1856,6 +1856,30 @@ static int mmc_sleep(struct mmc_host *host)
	struct mmc_card *card = host->card;
	int err = -ENOSYS;

	if (card && card->ext_csd.rev >= 3 &&
		card->part_curr == EXT_CSD_PART_CONFIG_ACC_RPMB) {
		u8 part_config = card->ext_csd.part_config;

		/*
		 * If the last access before suspend is RPMB access, then
		 * switch to default part config so that sleep command CMD5
		 * and deselect CMD7 can be sent to the card.
		 */
		part_config &= ~EXT_CSD_PART_CONFIG_ACC_MASK;
		err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
				 EXT_CSD_PART_CONFIG,
				 part_config,
				 card->ext_csd.part_time);
		if (err) {
			pr_err("%s: %s: failed to switch to default part config %x\n",
				mmc_hostname(host), __func__, part_config);
			return err;
		}
		card->ext_csd.part_config = part_config;
		card->part_curr = card->ext_csd.part_config &
				  EXT_CSD_PART_CONFIG_ACC_MASK;
	}

	if (card && card->ext_csd.rev >= 3) {
		err = mmc_card_sleepawake(host, 1);
		if (err < 0)