mmc: sdhci: quirk for not calculate max_discard_to
Shridhar Rasal [Tue, 7 Feb 2012 15:32:47 +0000 (20:32 +0530)]
Adding SDHCI_QUIRK_NO_CALC_MAX_DISCARD_TO for not to calculate
max_discard_to which is deviation in setting max_discard.

For some host controllers, combination of
1) calculated non-zero value of max_discard_to and
2) erase_group_def not set
can result into setting  max_discard value to pref_erase in
sectors which is very less, so it takes long time for erase.

With this change host controller can specify to calculate
max_discard_to and based on that max_discard value will be set.

bug 930767

Change-Id: I2c64ef8a6821620f2a65c06e25d2af68e3554a75
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-on: http://git-master/r/79839
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sachin Nikam <snikam@nvidia.com>

drivers/mmc/host/sdhci.c
include/linux/mmc/sdhci.h

index b1dd628..50a268e 100644 (file)
@@ -2589,7 +2589,8 @@ int sdhci_add_host(struct sdhci_host *host)
        if (host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK)
                host->timeout_clk = mmc->f_max / 1000;
 
-       mmc->max_discard_to = (1 << 27) / host->timeout_clk;
+       if (!(host->quirks & SDHCI_QUIRK_NO_CALC_MAX_DISCARD_TO))
+               mmc->max_discard_to = (1 << 27) / host->timeout_clk;
 
        if (host->quirks & SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12)
                host->flags |= SDHCI_AUTO_CMD12;
index 19abcca..061f70e 100644 (file)
@@ -91,6 +91,8 @@ struct sdhci_host {
 #define SDHCI_QUIRK_NON_STD_VOLTAGE_SWITCHING          (1ULL<<32)
 /* Controller doesn't follow the standard frequency tuning procedure */
 #define SDHCI_QUIRK_NON_STANDARD_TUNING                (1LL<<33)
+/* Controller doesn't calculate max_discard_to */
+#define SDHCI_QUIRK_NO_CALC_MAX_DISCARD_TO             (1LL<<34)
 
        int irq;                /* Device IRQ */
        void __iomem *ioaddr;   /* Mapped address */