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

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

Merge "mmc: card: quirk: disable cache for Hynix card"

parents a1283375 6932a01c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3159,6 +3159,9 @@ 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
};

+4 −2
Original line number Diff line number Diff line
@@ -3540,7 +3540,8 @@ int mmc_flush_cache(struct mmc_card *card)
	struct mmc_host *host = card->host;
	int err = 0, rc;

	if (!(host->caps2 & MMC_CAP2_CACHE_CTRL))
	if (!(host->caps2 & MMC_CAP2_CACHE_CTRL) ||
	     (card->quirks & MMC_QUIRK_CACHE_DISABLE))
		return err;

	if (mmc_card_mmc(card) &&
@@ -3579,7 +3580,8 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
	int err = 0, rc;

	if (!(host->caps2 & MMC_CAP2_CACHE_CTRL) ||
			mmc_card_is_removable(host))
			mmc_card_is_removable(host) ||
			(card->quirks & MMC_QUIRK_CACHE_DISABLE))
		return err;

	if (card && mmc_card_mmc(card) &&
+7 −1
Original line number Diff line number Diff line
@@ -1555,7 +1555,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
	 * If HPI is not supported then cache shouldn't be enabled.
	 */
	if ((host->caps2 & MMC_CAP2_CACHE_CTRL) &&
	    (card->ext_csd.cache_size > 0) && card->ext_csd.hpi_en) {
	    (card->ext_csd.cache_size > 0) && card->ext_csd.hpi_en &&
	    ((card->quirks & MMC_QUIRK_CACHE_DISABLE) == 0)) {
		err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
				EXT_CSD_CACHE_CTRL, 1,
				card->ext_csd.generic_cmd6_time);
@@ -1575,6 +1576,11 @@ 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.
+1 −1
Original line number Diff line number Diff line
@@ -356,7 +356,7 @@ struct mmc_card {
#define MMC_QUIRK_BROKEN_HPI (1 << 12)
 /* Skip data-timeout advertised by card */
#define MMC_QUIRK_BROKEN_DATA_TIMEOUT	(1<<13)

#define MMC_QUIRK_CACHE_DISABLE (1 << 14)       /* prevent cache enable */

	unsigned int		erase_size;	/* erase size in sectors */
 	unsigned int		erase_shift;	/* if erase unit is power 2 */