Skip to content

Commit

Permalink
sdhci/sdhci-esdhc-imx: Allow platform-specific set_power callback
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
  • Loading branch information
ericnelsonaz committed Jun 25, 2013
1 parent a7ddca5 commit cdee0ec
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arch/arm/mach-mx6/board-mx6_nitrogen6x.c
Expand Up @@ -216,6 +216,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 mx6_sabrelite_sd2_data = {
.always_present = 1,
Expand All @@ -224,6 +231,7 @@ static struct esdhc_platform_data mx6_sabrelite_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

Expand Down
1 change: 1 addition & 0 deletions arch/arm/plat-mxc/include/mach/esdhc.h
Expand Up @@ -38,5 +38,6 @@ struct esdhc_platform_data {
unsigned int delay_line;
bool runtime_pm;
int (*platform_pad_change)(unsigned int index, int clock);
void (*set_power)(int on);
};
#endif /* __ASM_ARCH_IMX_ESDHC_H */
15 changes: 15 additions & 0 deletions drivers/mmc/host/sdhci-esdhc-imx.c
Expand Up @@ -760,6 +760,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,
Expand All @@ -771,6 +783,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,
};

Expand Down Expand Up @@ -883,6 +896,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) {
Expand Down
4 changes: 4 additions & 0 deletions drivers/mmc/host/sdhci.c
Expand Up @@ -1353,6 +1353,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);
Expand Down
2 changes: 2 additions & 0 deletions drivers/mmc/host/sdhci.h
Expand Up @@ -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);
Expand Down

0 comments on commit cdee0ec

Please sign in to comment.