From 696d14b5dee46679980c9a41883d29feb19fa9b4 Mon Sep 17 00:00:00 2001 From: Rahul Bansal Date: Wed, 27 Oct 2010 18:10:15 +0530 Subject: [arm/tegra] Support for Wake-On-Wireless Event. Support for device wakeup on receiving SDIO interrupt in LP1/LP0 for incoming wifi pakcket. Bug: 730157 Change-Id: Ia2e9bf2af215f33d6d6d8d78ba0cdf2d71011917 Reviewed-on: http://git-master/r/9813 Reviewed-by: Rahul Bansal Tested-by: Rahul Bansal Reviewed-by: Rakesh Kumar Tested-by: Rakesh Kumar Reviewed-by: Udaykumar Rameshchan Raval Reviewed-by: Pavan Kunapuli Reviewed-by: Yu-Huan Hsu Reviewed-by: Varun Colbert Tested-by: Varun Colbert --- drivers/mmc/host/sdhci-tegra.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'drivers') diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 7d4006084eb1..60d23213e7d1 100755 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -23,6 +23,8 @@ #define NV_DEBUG 0 #include +#include + #include #include #include @@ -461,29 +463,26 @@ static int tegra_sdhci_suspend(struct device *dev) int ret = 0; if (host->card_always_on && is_card_sdio(sdhost->mmc->card)) { - struct mmc_ios ios; - ios.clock = 0; - ios.vdd = 0; - ios.power_mode = MMC_POWER_OFF; - ios.bus_width = MMC_BUS_WIDTH_1; - ios.timing = MMC_TIMING_LEGACY; + int div; + u16 clk; + unsigned int clock = 100000; /* save interrupt status before suspending */ host->sdhci_ints = sdhci_readl(sdhost, SDHCI_INT_ENABLE); - sdhost->mmc->ops->set_ios(sdhost->mmc, &ios); - /* keep CARD_INT enabled - if used as wakeup source */ - if (host->sdhci_ints & SDHCI_INT_CARD_INT) { - u32 ier = sdhci_readl(sdhost, SDHCI_INT_ENABLE); - ier |= SDHCI_INT_CARD_INT; - sdhci_writel(sdhost, ier, SDHCI_INT_ENABLE); - sdhci_writel(sdhost, ier, SDHCI_SIGNAL_ENABLE); - - if (sdhost->quirks & SDHCI_QUIRK_ENABLE_INTERRUPT_AT_BLOCK_GAP) { - u8 gap_ctrl = sdhci_readb(sdhost, SDHCI_BLOCK_GAP_CONTROL); - gap_ctrl |= 0x8; - sdhci_writeb(sdhost, gap_ctrl, SDHCI_BLOCK_GAP_CONTROL); - } + + /* reduce host controller clk and card clk to 100 KHz */ + tegra_sdhci_set_clock(sdhost, clock); + sdhci_writew(sdhost, 0, SDHCI_CLOCK_CONTROL); + + for (div = 1;div < 256;div *= 2) { + if ((sdhost->max_clk / div) <= clock) + break; } + div >>= 1; + + clk = div << SDHCI_DIVIDER_SHIFT; + clk |= SDHCI_CLOCK_INT_EN | SDHCI_CLOCK_CARD_EN; + sdhci_writew(sdhost, clk, SDHCI_CLOCK_CONTROL); return ret; } -- cgit v1.2.3