mmc: tegra: disable card clk before setting tap
Jeetesh Burman [Tue, 24 Mar 2015 17:22:02 +0000 (22:22 +0530)]
-disable card clk.
-update the tap value.
-enable card clk.

Bug 1559166

Change-Id: Ib77bfed5d8a8569d458aaf2cd0cd3c8a9e00a60e
Signed-off-by: Naveen Kumar Arepalli <naveenk@nvidia.com>
Reviewed-on: http://git-master/r/559812
(cherry picked from commit e2c098821a74ef1b5805c6bc5cb177a4fba05338)
Signed-off-by: Jeetesh Burman <jburman@nvidia.com>
Reviewed-on: http://git-master/r/721896
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>

drivers/mmc/host/sdhci-tegra.c

index c119e2e..30a44e8 100644 (file)
@@ -1747,6 +1747,7 @@ static void sdhci_tegra_set_tap_delay(struct sdhci_host *sdhci,
        unsigned int tap_delay)
 {
        u32 vendor_ctrl;
+       u16 clk;
 
        /* Max tap delay value is 255 */
        if (tap_delay > MAX_TAP_VALUES) {
@@ -1757,11 +1758,20 @@ static void sdhci_tegra_set_tap_delay(struct sdhci_host *sdhci,
                return;
        }
 
+       clk = sdhci_readw(sdhci, SDHCI_CLOCK_CONTROL);
+       clk &= ~SDHCI_CLOCK_CARD_EN;
+       sdhci_writew(sdhci, clk, SDHCI_CLOCK_CONTROL);
+
        vendor_ctrl = sdhci_readl(sdhci, SDHCI_VNDR_CLK_CTRL);
        vendor_ctrl &= ~(SDHCI_VNDR_CLK_CTRL_TAP_VALUE_MASK <<
                        SDHCI_VNDR_CLK_CTRL_TAP_VALUE_SHIFT);
        vendor_ctrl |= (tap_delay << SDHCI_VNDR_CLK_CTRL_TAP_VALUE_SHIFT);
        sdhci_writel(sdhci, vendor_ctrl, SDHCI_VNDR_CLK_CTRL);
+
+       clk = sdhci_readw(sdhci, SDHCI_CLOCK_CONTROL);
+       clk |= SDHCI_CLOCK_CARD_EN;
+       sdhci_writew(sdhci, clk, SDHCI_CLOCK_CONTROL);
+
 }
 
 static void sdhci_tegra_set_trim_delay(struct sdhci_host *sdhci,