diff options
author | Eric Nelson <eric.nelson@boundarydevices.com> | 2013-06-24 17:02:37 -0700 |
---|---|---|
committer | Eric Nelson <eric.nelson@boundarydevices.com> | 2013-07-07 10:29:51 -0700 |
commit | 6ca37a6dbbd683db03caa5fdfeb5c79b7f2cbec3 (patch) | |
tree | 02e627a482d274d85f863bd93fd0791e8e563d77 | |
parent | 4d98ebdfe6afc86fde88fa459c9f038d55e2f3be (diff) |
sdhci/sdhci-esdhc-imx: Allow platform-specific set_power callback
Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
-rw-r--r-- | arch/arm/mach-mx6/board-mx6_nitrogen6x.c | 8 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/esdhc.h | 1 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci-esdhc-imx.c | 15 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci.c | 4 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci.h | 2 |
5 files changed, 30 insertions, 0 deletions
diff --git a/arch/arm/mach-mx6/board-mx6_nitrogen6x.c b/arch/arm/mach-mx6/board-mx6_nitrogen6x.c index ae8e4d2cd14e..bcc96739a2db 100644 --- a/arch/arm/mach-mx6/board-mx6_nitrogen6x.c +++ b/arch/arm/mach-mx6/board-mx6_nitrogen6x.c @@ -217,6 +217,13 @@ static int plt_sd_pad_change(unsigned int index, int clock) return IOMUX_SETUP(sd_pads[i]); } +static void sdio_set_power(int on) +{ + pr_debug("%s:%s: set power(%d)\n", + __FILE__, __func__, on); + gpio_set_value(N6_WL1271_WL_EN,on); +} + #ifdef CONFIG_WL12XX_PLATFORM_DATA static struct esdhc_platform_data sd2_data = { .always_present = 1, @@ -225,6 +232,7 @@ static struct esdhc_platform_data sd2_data = { .keep_power_at_suspend = 0, .caps = MMC_CAP_POWER_OFF_CARD, .platform_pad_change = plt_sd_pad_change, + .set_power = sdio_set_power, }; #endif diff --git a/arch/arm/plat-mxc/include/mach/esdhc.h b/arch/arm/plat-mxc/include/mach/esdhc.h index 294e4cdc338e..019fde9100ea 100644 --- a/arch/arm/plat-mxc/include/mach/esdhc.h +++ b/arch/arm/plat-mxc/include/mach/esdhc.h @@ -37,5 +37,6 @@ struct esdhc_platform_data { unsigned int caps; unsigned int delay_line; int (*platform_pad_change)(unsigned int index, int clock); + void (*set_power)(int on); }; #endif /* __ASM_ARCH_IMX_ESDHC_H */ diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 7b08196eb4cf..49f427e81c89 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -753,6 +753,18 @@ static void plt_clk_ctrl(struct sdhci_host *host, bool enable) } } +static void sdhci_platform_set_power(struct sdhci_host *host, + int on) +{ + struct esdhc_platform_data *boarddata + = host->mmc->parent->platform_data; + pr_debug("%s----------------- %d: %p:%p\n", __func__, on, + boarddata, + boarddata ? boarddata->set_power : 0); + if (boarddata && boarddata->set_power) + boarddata->set_power(on); +} + static struct sdhci_ops sdhci_esdhc_ops = { .read_l = esdhc_readl_le, .read_w = esdhc_readw_le, @@ -764,6 +776,7 @@ static struct sdhci_ops sdhci_esdhc_ops = { .get_max_clock = esdhc_pltfm_get_max_clock, .get_min_clock = esdhc_pltfm_get_min_clock, .platform_8bit_width = plt_8bit_width, + .platform_set_power = sdhci_platform_set_power, .platform_clk_ctrl = plt_clk_ctrl, }; @@ -877,6 +890,8 @@ static int esdhc_pltfm_init(struct sdhci_host *host, struct sdhci_pltfm_data *pd reg &= ~SDHCI_MIX_CTRL_DDREN; writel(reg, host->ioaddr + SDHCI_MIX_CTRL); + pr_debug("-----------%s: boarddata %p, set_power %p\n", + __func__, boarddata, boarddata->set_power); if (boarddata) { /* Device is always present, e.x, populated emmc device */ if (boarddata->always_present) { diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index d34486e8c9f4..7d1f287c2a9f 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1343,6 +1343,10 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) sdhci_set_power(host, -1); else sdhci_set_power(host, ios->vdd); + if (host->ops->platform_set_power) + host->ops->platform_set_power + (host, + MMC_POWER_OFF != ios->power_mode); if (host->ops->platform_send_init_74_clocks) host->ops->platform_send_init_74_clocks(host, ios->power_mode); diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index ef45fa98dc90..a59721c1364e 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -267,6 +267,8 @@ struct sdhci_ops { unsigned int (*get_timeout_clock)(struct sdhci_host *host); int (*platform_8bit_width)(struct sdhci_host *host, int width); + void (*platform_set_power)(struct sdhci_host *host, + int on); void (*platform_send_init_74_clocks)(struct sdhci_host *host, u8 power_mode); unsigned int (*get_ro)(struct sdhci_host *host); |