mmc: quirks: add new quirk that allows HPI disable

Certain cards might get broken when HPI feature is used.
This patch allows host to avoid using HPI for such
buggy cards by adding new quirk.

As some of the other features like BKOPs/Cache are
dependent on HPI feature, those features would also
get disabled if HPI is disabled.

Change-Id: I93a8810e4031eafcd44b5152296e065dc3330b63
Signed-off-by: Talel Shenhar <tatias@codeaurora.org>
This commit is contained in:
Talel Shenhar 2015-02-05 14:44:15 +02:00 committed by Subhash Jadavani
parent d3254ba7a0
commit a89dfb1bbd
3 changed files with 23 additions and 3 deletions

View file

@ -490,13 +490,30 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
ext_csd[EXT_CSD_PWR_CL_DDR_200_360];
}
/* check whether the eMMC card supports HPI */
if ((ext_csd[EXT_CSD_HPI_FEATURES] & 0x1) &&
!(card->quirks & MMC_QUIRK_BROKEN_HPI)) {
card->ext_csd.hpi = 1;
if (ext_csd[EXT_CSD_HPI_FEATURES] & 0x2)
card->ext_csd.hpi_cmd = MMC_STOP_TRANSMISSION;
else
card->ext_csd.hpi_cmd = MMC_SEND_STATUS;
/*
* Indicate the maximum timeout to close
* a command interrupted by HPI
*/
card->ext_csd.out_of_int_time =
ext_csd[EXT_CSD_OUT_OF_INTERRUPT_TIME] * 10;
}
if (card->ext_csd.rev >= 5) {
/* Adjust production date as per JEDEC JESD84-B451 */
if (card->cid.year < 2010)
card->cid.year += 16;
/* check whether the eMMC card supports BKOPS */
if (ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1) {
if ((ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1) &&
card->ext_csd.hpi) {
card->ext_csd.bkops = 1;
card->ext_csd.man_bkops_en =
(ext_csd[EXT_CSD_BKOPS_EN] &
@ -1788,8 +1805,9 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
/*
* If cache size is higher than 0, this indicates
* the existence of cache and it can be turned on.
* If HPI is not supported then cache shouldn't be enabled.
*/
if (card->ext_csd.cache_size > 0) {
if (card->ext_csd.cache_size > 0 && card->ext_csd.hpi_en) {
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
EXT_CSD_CACHE_CTRL, 1,
card->ext_csd.generic_cmd6_time);

View file

@ -767,7 +767,7 @@ int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status)
unsigned int opcode;
int err;
if (!card->ext_csd.hpi) {
if (!card->ext_csd.hpi_en) {
pr_warn("%s: Card didn't support HPI command\n",
mmc_hostname(card->host));
return -EINVAL;

View file

@ -306,6 +306,8 @@ struct mmc_card {
#define MMC_QUIRK_TRIM_BROKEN (1<<12) /* Skip trim */
/* byte mode */
#define MMC_QUIRK_INAND_DATA_TIMEOUT (1<<13) /* For incorrect data timeout */
#define MMC_QUIRK_BROKEN_HPI (1 << 14) /* For devices which gets */
/* broken due to HPI feature */
unsigned int erase_size; /* erase size in sectors */