sdhci: Add option for non std freq tuning
Pavan Kunapuli [Fri, 13 Jan 2012 09:57:24 +0000 (14:57 +0530)]
Adding option for non std freq tuning for
host controllers that have deviation in the
tuning procedure.

Bug 920089

Change-Id: I8ca6962c6f0380c1160460e5094c47aee241d6e3

Reviewed-on: http://git-master/r/72603
Reviewed-by: Pradeep Goudagunta <pgoudagunta@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Change-Id: I97cceb39fd27b159823ebce6706c5e74e53deccd
Reviewed-on: http://git-master/r/77303
Reviewed-by: Automatic_Commit_Validation_User

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

index 417fdd1..b1dd628 100644 (file)
@@ -1632,6 +1632,14 @@ static int sdhci_execute_tuning(struct mmc_host *mmc)
        disable_irq(host->irq);
        spin_lock(&host->lock);
 
+       if ((host->quirks & SDHCI_QUIRK_NON_STANDARD_TUNING) &&
+               host->ops->execute_freq_tuning) {
+               err = host->ops->execute_freq_tuning(host);
+               spin_unlock(&host->lock);
+               enable_irq(host->irq);
+               return err;
+       }
+
        ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
 
        /*
index 1c12419..bdf4b10 100644 (file)
@@ -277,6 +277,7 @@ struct sdhci_ops {
        int     (*resume)(struct sdhci_host *host);
        int     (*switch_signal_voltage)(struct sdhci_host *host,
                                unsigned int signal_voltage);
+       int     (*execute_freq_tuning)(struct sdhci_host *sdhci);
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
index 85e7850..19abcca 100644 (file)
@@ -89,6 +89,8 @@ struct sdhci_host {
 #define SDHCI_QUIRK_UNSTABLE_RO_DETECT                 (1ULL<<31)
 /* Controller cannot report the line status in present state register */
 #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)
 
        int irq;                /* Device IRQ */
        void __iomem *ioaddr;   /* Mapped address */