summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorNikita Kiryanov <nikita@compulab.co.il>2012-12-03 02:19:47 +0000
committerTom Rini <trini@ti.com>2013-03-08 16:41:13 -0500
commite3913f56a26dbb49758370320dac477ab0324631 (patch)
treeb2a989a6483ef53c309b0e16f774b8d2007c9bfd /drivers/mmc
parentd23d8d7e069c3aca071b7f68d9c15d11f8d4c84d (diff)
downloadu-boot-imx-e3913f56a26dbb49758370320dac477ab0324631.zip
u-boot-imx-e3913f56a26dbb49758370320dac477ab0324631.tar.gz
u-boot-imx-e3913f56a26dbb49758370320dac477ab0324631.tar.bz2
omap_hsmmc: add driver check for write protection
Add check for write protection in omap mmc driver. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il> Reviewed-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/omap_hsmmc.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index fcbd133..d0b2820 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -42,6 +42,7 @@
struct omap_hsmmc_data {
struct hsmmc *base_addr;
int cd_gpio;
+ int wp_gpio;
};
/* If we fail after 1 second wait, something is really bad */
@@ -74,6 +75,12 @@ static int omap_mmc_getcd(struct mmc *mmc)
int cd_gpio = ((struct omap_hsmmc_data *)mmc->priv)->cd_gpio;
return gpio_get_value(cd_gpio);
}
+
+static int omap_mmc_getwp(struct mmc *mmc)
+{
+ int wp_gpio = ((struct omap_hsmmc_data *)mmc->priv)->wp_gpio;
+ return gpio_get_value(wp_gpio);
+}
#else
static inline int omap_mmc_setup_gpio_in(int gpio, const char *label)
{
@@ -81,6 +88,7 @@ static inline int omap_mmc_setup_gpio_in(int gpio, const char *label)
}
#define omap_mmc_getcd NULL
+#define omap_mmc_getwp NULL
#endif
#if defined(CONFIG_OMAP44XX) && defined(CONFIG_TWL6030_POWER)
@@ -580,7 +588,8 @@ static void mmc_set_ios(struct mmc *mmc)
writel(readl(&mmc_base->sysctl) | CEN_ENABLE, &mmc_base->sysctl);
}
-int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio)
+int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio,
+ int wp_gpio)
{
struct mmc *mmc = &hsmmc_dev[dev_index];
struct omap_hsmmc_data *priv_data = &hsmmc_dev_data[dev_index];
@@ -590,7 +599,7 @@ int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio)
mmc->set_ios = mmc_set_ios;
mmc->init = mmc_init_setup;
mmc->getcd = omap_mmc_getcd;
- mmc->getwp = NULL;
+ mmc->getwp = omap_mmc_getwp;
mmc->priv = priv_data;
switch (dev_index) {
@@ -612,6 +621,7 @@ int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio)
return 1;
}
priv_data->cd_gpio = omap_mmc_setup_gpio_in(cd_gpio, "mmc_cd");
+ priv_data->wp_gpio = omap_mmc_setup_gpio_in(wp_gpio, "mmc_wp");
mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
mmc->host_caps = (MMC_MODE_4BIT | MMC_MODE_HS_52MHz | MMC_MODE_HS |
MMC_MODE_HC) & ~host_caps_mask;