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

Commit cb808fc8 authored by Sujit Reddy Thumma's avatar Sujit Reddy Thumma
Browse files

mmc: core: Fix disabling of cache for Hynix cards



Commit 6932a01c (mmc: card: quirk: disable cache for Hynix card)
claims to disable cache because of data corruption issues when cache
it is enabled. In reality, the patch allows enabling of cache during
card initialization but disallow flushing of cache during suspend or
file system sync operations. This is more dangerous than without
the commit. Move the fixups for disabling cache to mmc_fixups so as
to enable the quirk during initialization itself. Also, remove obvious
warnings everytime card is initialized during runtime resume.

Change-Id: I3f71eaccf90ffdea83f418b7c05be68f5d89d227
Signed-off-by: default avatarSujit Reddy Thumma <sthumma@codeaurora.org>
parent 500bff85
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -3192,9 +3192,6 @@ static const struct mmc_fixup blk_fixups[] =
	MMC_FIXUP("SEM04G", 0x45, CID_OEMID_ANY, add_quirk_mmc,
		  MMC_QUIRK_INAND_DATA_TIMEOUT),

	/* Disable cache for this cards */
	MMC_FIXUP("H8G2d", CID_MANFID_HYNIX, CID_OEMID_ANY, add_quirk_mmc,
		  MMC_QUIRK_CACHE_DISABLE),
	END_FIXUP
};

+8 −5
Original line number Diff line number Diff line
@@ -66,6 +66,14 @@ static const struct mmc_fixup mmc_fixups[] = {
	MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_HYNIX,
			      0x014a, add_quirk, MMC_QUIRK_BROKEN_HPI, 5),

	/*
	 * Some Hynix cards exhibit data corruption over reboots if cache is
	 * enabled. Disable cache for all versions until a class of cards that
	 * show this behavior is identified.
	 */
	MMC_FIXUP("H8G2d", CID_MANFID_HYNIX, CID_OEMID_ANY, add_quirk_mmc,
		  MMC_QUIRK_CACHE_DISABLE),

	END_FIXUP
};

@@ -1579,11 +1587,6 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
			card->ext_csd.cache_ctrl = 1;
		}
	}
	if (card->quirks & MMC_QUIRK_CACHE_DISABLE) {
		pr_warn("%s: This is Hynix card, cache disabled!\n",
				mmc_hostname(card->host));
		card->ext_csd.cache_ctrl = 0;
	}

	/*
	 * The mandatory minimum values are defined for packed command.