From 0467657691ba046b492504272baf7c626d9a3713 Mon Sep 17 00:00:00 2001 From: Mursalin Akon Date: Fri, 27 Apr 2012 15:21:05 -0700 Subject: mmc: host: Disable SDIO card clock when idle for Tegra 3 only The CL disables SDIO card clock when idle for Tegra 3 only. Bonus: conditional build for some tegra 3 functionalities. Bug 975541 Change-Id: I097c4771f3565bf9137d7854ada10c1fe8535056 Signed-off-by: Mursalin Akon Reviewed-on: http://git-master/r/99707 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Allen Martin Reviewed-by: Peer Chen --- drivers/mmc/host/sdhci-tegra.c | 10 ++++++++++ drivers/mmc/host/sdhci.c | 12 ++++-------- drivers/mmc/host/sdhci.h | 1 + 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 5f8c4a809b97..b8f5630058f1 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -70,11 +70,14 @@ static unsigned int tegra_sdhost_min_freq; static unsigned int tegra_sdhost_std_freq; + +#ifdef CONFIG_ARCH_TEGRA_3x_SOC static void tegra_3x_sdhci_set_card_clock(struct sdhci_host *sdhci, unsigned int clock); static void tegra3_sdhci_post_reset_init(struct sdhci_host *sdhci); static unsigned int tegra3_sdhost_max_clk[4] = { 208000000, 104000000, 208000000, 104000000 }; +#endif struct tegra_sdhci_hw_ops{ /* Set the internal clk and card clk.*/ @@ -183,6 +186,7 @@ static unsigned int tegra_sdhci_get_ro(struct sdhci_host *sdhci) return gpio_get_value(plat->wp_gpio); } +#ifdef CONFIG_ARCH_TEGRA_3x_SOC static void tegra3_sdhci_post_reset_init(struct sdhci_host *sdhci) { u16 misc_ctrl; @@ -219,6 +223,7 @@ static void tegra3_sdhci_post_reset_init(struct sdhci_host *sdhci) SDHCI_VENDOR_MISC_CNTRL_ENABLE_SDR50_SUPPORT; sdhci_writew(sdhci, misc_ctrl, SDHCI_VENDOR_MISC_CNTRL); } +#endif static int tegra_sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs) @@ -395,6 +400,7 @@ static void tegra_sdhci_set_clk_rate(struct sdhci_host *sdhci, sdhci->max_clk = clk_get_rate(pltfm_host->clk); } +#ifdef CONFIG_ARCH_TEGRA_3x_SOC static void tegra_3x_sdhci_set_card_clock(struct sdhci_host *sdhci, unsigned int clock) { int div; @@ -479,6 +485,7 @@ set_clk: out: sdhci->clock = clock; } +#endif static void tegra_sdhci_set_clock(struct sdhci_host *sdhci, unsigned int clock) { @@ -881,6 +888,9 @@ static struct sdhci_ops tegra_sdhci_ops = { .read_w = tegra_sdhci_readw, .write_l = tegra_sdhci_writel, .platform_8bit_width = tegra_sdhci_8bit, +#ifdef CONFIG_ARCH_TEGRA_3x_SOC + .set_card_clock = tegra_3x_sdhci_set_card_clock, +#endif .set_clock = tegra_sdhci_set_clock, .suspend = tegra_sdhci_suspend, .resume = tegra_sdhci_resume, diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 6c6045879022..495586924d60 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1849,7 +1849,6 @@ static void sdhci_enable_preset_value(struct mmc_host *mmc, bool enable) int sdhci_enable(struct mmc_host *mmc) { struct sdhci_host *host = mmc_priv(mmc); - u16 clk; if (!mmc->card) return 0; @@ -1860,9 +1859,8 @@ int sdhci_enable(struct mmc_host *mmc) host->ops->set_clock(host, mmc->ios.clock); sdhci_set_clock(host, mmc->ios.clock); } else { - clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL); - clk |= SDHCI_CLOCK_CARD_EN; - sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); + if (host->ops->set_card_clock) + host->ops->set_card_clock(host, mmc->ios.clock); } } @@ -1872,7 +1870,6 @@ int sdhci_enable(struct mmc_host *mmc) int sdhci_disable(struct mmc_host *mmc, int lazy) { struct sdhci_host *host = mmc_priv(mmc); - u16 clk; if (!mmc->card) return 0; @@ -1883,9 +1880,8 @@ int sdhci_disable(struct mmc_host *mmc, int lazy) if (host->ops->set_clock) host->ops->set_clock(host, 0); } else { - clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL); - clk &= ~SDHCI_CLOCK_CARD_EN; - sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); + if (host->ops->set_card_clock) + host->ops->set_card_clock(host, 0); } return 0; diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index c00833de19da..bf48767e0ef2 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -260,6 +260,7 @@ struct sdhci_ops { #endif void (*set_clock)(struct sdhci_host *host, unsigned int clock); + void (*set_card_clock)(struct sdhci_host *host, unsigned int clock); int (*enable_dma)(struct sdhci_host *host); unsigned int (*get_max_clock)(struct sdhci_host *host); -- cgit v1.2.3