mmc: core: new discard feature support at eMMC v4.5
[pandora-kernel.git] / drivers / mmc / core / core.c
index d9836e5..772de2c 100644 (file)
@@ -1709,10 +1709,24 @@ int mmc_can_trim(struct mmc_card *card)
 {
        if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN)
                return 1;
+       if (mmc_can_discard(card))
+               return 1;
        return 0;
 }
 EXPORT_SYMBOL(mmc_can_trim);
 
+int mmc_can_discard(struct mmc_card *card)
+{
+       /*
+        * As there's no way to detect the discard support bit at v4.5
+        * use the s/w feature support filed.
+        */
+       if (card->ext_csd.feature_support & MMC_DISCARD_FEATURE)
+               return 1;
+       return 0;
+}
+EXPORT_SYMBOL(mmc_can_discard);
+
 int mmc_can_sanitize(struct mmc_card *card)
 {
        if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE)