mmc: mxs-mmc: copy wp_gpio in struct mxs_mmc_host

Copy wp_gpio from platform_data into struct mxs_mmc_host, so that
the use of platform_data can be limited in probe function, which
will ease the device tree probe.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Chris Ball <cjb@laptop.org>
This commit is contained in:
Shawn Guo 2012-05-06 13:33:40 +08:00
parent b60188c820
commit 31b0ff5e73

View File

@ -160,21 +160,17 @@ struct mxs_mmc_host {
unsigned char bus_width; unsigned char bus_width;
spinlock_t lock; spinlock_t lock;
int sdio_irq_en; int sdio_irq_en;
int wp_gpio;
}; };
static int mxs_mmc_get_ro(struct mmc_host *mmc) static int mxs_mmc_get_ro(struct mmc_host *mmc)
{ {
struct mxs_mmc_host *host = mmc_priv(mmc); struct mxs_mmc_host *host = mmc_priv(mmc);
struct mxs_mmc_platform_data *pdata =
mmc_dev(host->mmc)->platform_data;
if (!pdata) if (!gpio_is_valid(host->wp_gpio))
return -EFAULT;
if (!gpio_is_valid(pdata->wp_gpio))
return -EINVAL; return -EINVAL;
return gpio_get_value(pdata->wp_gpio); return gpio_get_value(host->wp_gpio);
} }
static int mxs_mmc_get_cd(struct mmc_host *mmc) static int mxs_mmc_get_cd(struct mmc_host *mmc)
@ -758,6 +754,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA; mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
if (pdata->flags & SLOTF_4_BIT_CAPABLE) if (pdata->flags & SLOTF_4_BIT_CAPABLE)
mmc->caps |= MMC_CAP_4_BIT_DATA; mmc->caps |= MMC_CAP_4_BIT_DATA;
host->wp_gpio = pdata->wp_gpio;
} }
mmc->f_min = 400000; mmc->f_min = 400000;