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

Commit 3bca4cf7 authored by Chris Ball's avatar Chris Ball Committed by Linus Torvalds
Browse files

sdio: don't use CMD[357] as part of a powered SDIO resume



Seen on a Marvell 8686 SDIO card and Via VX855 controller: we must avoid
sending CMD3/5/7 on a resume where power has been maintained, because the
8686 will refuse to respond to them and the MMC stack will give up on the
card.

Signed-off-by: default avatarChris Ball <cjb@laptop.org>
Signed-off-by: default avatarNicolas Pitre <nico@marvell.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2f4cbb3d
Loading
Loading
Loading
Loading
+11 −8
Original line number Original line Diff line number Diff line
@@ -224,7 +224,7 @@ static int sdio_enable_hs(struct mmc_card *card)
 * we're trying to reinitialise.
 * we're trying to reinitialise.
 */
 */
static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
			      struct mmc_card *oldcard)
			      struct mmc_card *oldcard, int powered_resume)
{
{
	struct mmc_card *card;
	struct mmc_card *card;
	int err;
	int err;
@@ -235,9 +235,11 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
	/*
	/*
	 * Inform the card of the voltage
	 * Inform the card of the voltage
	 */
	 */
	if (!powered_resume) {
		err = mmc_send_io_op_cond(host, host->ocr, &ocr);
		err = mmc_send_io_op_cond(host, host->ocr, &ocr);
		if (err)
		if (err)
			goto err;
			goto err;
	}


	/*
	/*
	 * For SPI, enable CRC as appropriate.
	 * For SPI, enable CRC as appropriate.
@@ -262,7 +264,7 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
	/*
	/*
	 * For native busses:  set card RCA and quit open drain mode.
	 * For native busses:  set card RCA and quit open drain mode.
	 */
	 */
	if (!mmc_host_is_spi(host)) {
	if (!powered_resume && !mmc_host_is_spi(host)) {
		err = mmc_send_relative_addr(host, &card->rca);
		err = mmc_send_relative_addr(host, &card->rca);
		if (err)
		if (err)
			goto remove;
			goto remove;
@@ -273,7 +275,7 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
	/*
	/*
	 * Select card, as all following commands rely on that.
	 * Select card, as all following commands rely on that.
	 */
	 */
	if (!mmc_host_is_spi(host)) {
	if (!powered_resume && !mmc_host_is_spi(host)) {
		err = mmc_select_card(card);
		err = mmc_select_card(card);
		if (err)
		if (err)
			goto remove;
			goto remove;
@@ -437,7 +439,8 @@ static int mmc_sdio_resume(struct mmc_host *host)


	/* Basic card reinitialization. */
	/* Basic card reinitialization. */
	mmc_claim_host(host);
	mmc_claim_host(host);
	err = mmc_sdio_init_card(host, host->ocr, host->card);
	err = mmc_sdio_init_card(host, host->ocr, host->card,
				 (host->pm_flags & MMC_PM_KEEP_POWER));
	mmc_release_host(host);
	mmc_release_host(host);


	/*
	/*
@@ -507,7 +510,7 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr)
	/*
	/*
	 * Detect and init the card.
	 * Detect and init the card.
	 */
	 */
	err = mmc_sdio_init_card(host, host->ocr, NULL);
	err = mmc_sdio_init_card(host, host->ocr, NULL, 0);
	if (err)
	if (err)
		goto err;
		goto err;
	card = host->card;
	card = host->card;