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

Commit 3794773d authored by Asutosh Das's avatar Asutosh Das Committed by Gerrit - the friendly Code Review server
Browse files

mmc: sd: Set card state to removed upon ejection



When the SD card is removed there's a detect
work that may or may not run immediately.
In the meantime if a request is issued, then
runtime_resume would pass without actually resuming
the card. Runtime-suspend turns-off the clocks too.

Thus writing to controller registers without resuming
causes the NOC error.

Fix this by setting the appropriate card state in resume.

CRs-fixed: 2452075
Change-Id: I70737c2b355ccf7a7c5e89130d57b458c1a7365b
Signed-off-by: default avatarAsutosh Das <asutoshd@codeaurora.org>
parent d6b58423
Loading
Loading
Loading
Loading
+7 −4
Original line number Original line Diff line number Diff line
@@ -1318,6 +1318,7 @@ static int _mmc_sd_resume(struct mmc_host *host)
		goto out;
		goto out;


	if (host->ops->get_cd && !host->ops->get_cd(host)) {
	if (host->ops->get_cd && !host->ops->get_cd(host)) {
		err = -ENOMEDIUM;
		mmc_card_clr_suspended(host->card);
		mmc_card_clr_suspended(host->card);
		goto out;
		goto out;
	}
	}
@@ -1417,14 +1418,16 @@ static int mmc_sd_runtime_suspend(struct mmc_host *host)
 */
 */
static int mmc_sd_runtime_resume(struct mmc_host *host)
static int mmc_sd_runtime_resume(struct mmc_host *host)
{
{
	int err;
	int err = 0;


	err = _mmc_sd_resume(host);
	err = _mmc_sd_resume(host);
	if (err && err != -ENOMEDIUM)
	if (err) {
		pr_err("%s: error %d doing runtime resume\n",
		pr_err("%s: error %d doing runtime resume\n",
			mmc_hostname(host), err);
			mmc_hostname(host), err);

		if (err == -ENOMEDIUM)
	return 0;
			mmc_card_set_removed(host->card);
	}
	return err;
}
}


static int mmc_sd_reset(struct mmc_host *host)
static int mmc_sd_reset(struct mmc_host *host)