@@ -318,6 +318,18 @@ static int mmc_read_ext_csd(struct mmc_card *card)
ext_csd[EXT_CSD_BKOPS_EN];
}
+ /* check whether the eMMC card support HPI */
+ if (ext_csd[EXT_CSD_HPI_FEATURES] & 0x1) {
+ card->ext_csd.hpi = 1;
+ card->ext_csd.hpi_en =
+ ext_csd[EXT_CSD_HPI_MGMT];
+ 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;
+ }
}
if (ext_csd[EXT_CSD_ERASED_MEM_CONT])
@@ -510,6 +522,25 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
}
/*
+ * enable HPI feature if eMMC card support
+ */
+ if (card->ext_csd.hpi) {
+ if (!card->ext_csd.hpi_en) {
+ err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
+ EXT_CSD_HPI_MGMT, 1);
+ if (err && err != -EBADMSG)
+ goto free_card;
+
+ if (err) {
+ card->ext_csd.hpi_en = 0;
+ err = 0;
+ } else {
+ card->ext_csd.hpi_en = 1;
+ }
+ }
+ }
+
+ /*
* Activate high speed (if supported)
*/
if ((card->ext_csd.hs_max_dtr != 0) &&
@@ -57,6 +57,8 @@ struct mmc_ext_csd {
unsigned int bkops:1; /* background support bit */
unsigned int bkops_en:1; /* background enable bit */
unsigned int hpi_en:1; /* HPI enable bit */
+ unsigned int hpi:1; /* HPI support bit */
+ unsigned int hpi_cmd; /* cmd used to for HPI */
};
struct sd_scr {
@@ -258,6 +258,7 @@ struct _mmc_csd {
* EXT_CSD fields
*/
+#define EXT_CSD_HPI_MGMT 161 /* R/W */
#define EXT_CSD_BKOPS_EN 163 /* R/W */
#define EXT_CSD_BKOPS_START 164 /* W */
#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
@@ -276,6 +277,7 @@ struct _mmc_csd {
#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */
#define EXT_CSD_TRIM_MULT 232 /* RO */
#define EXT_CSD_BKOPS_SUPPORT 502 /* RO */
+#define EXT_CSD_HPI_FEATURES 503 /* RO */
/*
* EXT_CSD field definitions