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

Commit 58a29f2e authored by Asutosh Das's avatar Asutosh Das Committed by Ram Prakash Gupta
Browse files

mmc: sd: set card removed to true



Sometimes when the card is removed and a request
is in queue the resume fails. But there's no way
to inform the in-flight request that the card is
removed since the resume itself fails and rescan
is waiting for claim_host which was acquired by
the in-flight request.

This request percolates to platform driver which
sees that the pre-requisites to issue the request
are not met i.e. the clocks are OFF.
So it tries to dump the registers and results in a
NoC error.

Set the card removed when resume fails to avoid this
problem.

CRs-fixed: 2430862
Change-Id: I171ad435ec11c1212e6528592b8db43cd0171b11
Signed-off-by: default avatarAsutosh Das <asutoshd@codeaurora.org>
Signed-off-by: default avatarVeerabhadrarao Badiganti <vbadigan@codeaurora.org>
parent d37e89ef
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -2667,8 +2667,14 @@ int mmc_resume_bus(struct mmc_host *host)
	spin_unlock_irqrestore(&host->lock, flags);

	mmc_bus_get(host);
	if (host->ops->get_cd)
	if (host->ops->get_cd) {
		card_present = host->ops->get_cd(host);
		if (!card_present) {
			pr_err("%s: Card removed - card_present:%d\n",
			       mmc_hostname(host), card_present);
			mmc_card_set_removed(host->card);
		}
	}

	if (host->bus_ops && !host->bus_dead && host->card && card_present) {
		mmc_power_up(host, host->card->ocr);
+15 −4
Original line number Diff line number Diff line
@@ -1369,12 +1369,23 @@ static int mmc_sd_resume(struct mmc_host *host)
{
	int err = 0;

	mmc_log_string(host, "enter\n");
	err = _mmc_sd_resume(host);
	if (err) {
		pr_err("%s: sd resume err: %d\n", mmc_hostname(host), err);
		if (host->ops->get_cd && !host->ops->get_cd(host)) {
			err = -ENOMEDIUM;
			mmc_card_set_removed(host->card);
		}
	}

	if (err != -ENOMEDIUM) {
		pm_runtime_set_active(&host->card->dev);
		pm_runtime_mark_last_busy(&host->card->dev);
		pm_runtime_enable(&host->card->dev);
	mmc_log_string(host, "done\n");
	}

	mmc_log_string(host, "done err=%d\n", err);
	return err;
}