summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorvarigit <ron.d@variscite.com>2014-06-30 16:32:00 +0300
committervarigit <ron.d@variscite.com>2014-06-30 16:32:00 +0300
commita83de481c2c4f00fc1baf9b31864be4953f16f1c (patch)
tree52feaf3fc1e6550e2eb1ddce526bb633c2bf62f1 /drivers/mmc
parent580eacc8cc0f0c3e80beeb1f7cc9a63167a9ffba (diff)
Enable GPIO support for MMC port used by wilink
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/slot-gpio.c40
-rw-r--r--drivers/mmc/host/sdhci-esdhc-imx.c13
2 files changed, 53 insertions, 0 deletions
diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
index 324235105519..806dc41782b5 100644
--- a/drivers/mmc/core/slot-gpio.c
+++ b/drivers/mmc/core/slot-gpio.c
@@ -195,6 +195,46 @@ int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio)
}
EXPORT_SYMBOL(mmc_gpio_request_cd);
+
+
+/**
+ * mmc_gpio_set_en- request a gpio for enable
+ * @host: mmc host
+ * @gpio: gpio number requested
+ *
+ * As devm_* managed functions are used in mmc_gpio_set_en(), client
+ *
+ * Returns zero on success, else an error.
+ */
+int mmc_gpio_set_en(struct mmc_host *host, unsigned int gpio)
+{
+ struct mmc_gpio *ctx;
+ int ret;
+
+ ret = mmc_gpio_alloc(host);
+ if (ret < 0)
+ return ret;
+
+ ctx = host->slot.handler_priv;
+
+ ret = devm_gpio_request_one(&host->class_dev, gpio, GPIOF_DIR_OUT,
+ ctx->cd_label);
+ if (ret < 0)
+ /*
+ * don't bother freeing memory. It might still get used by other
+ * slot functions, in any case it will be freed, when the device
+ * is destroyed.
+ */
+ return ret;
+
+ gpio_set_value_cansleep(gpio, 1);
+
+
+ return 0;
+}
+EXPORT_SYMBOL(mmc_gpio_set_en);
+
+
/**
* mmc_gpio_free_ro - free the write-protection gpio
* @host: mmc host
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index d2eb8911dc98..ff1103b6820f 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -966,6 +966,8 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
if (gpio_is_valid(boarddata->wp_gpio))
boarddata->wp_type = ESDHC_WP_GPIO;
+ boarddata->en_gpio = of_get_named_gpio(np, "en-gpios", 0);
+
of_property_read_u32(np, "bus-width", &boarddata->max_bus_width);
if (of_find_property(np, "no-1-8-v", NULL))
@@ -1144,6 +1146,17 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
break;
}
+ /* enable_gpio */
+ if (gpio_is_valid(boarddata->en_gpio)){
+ err = mmc_gpio_set_en(host->mmc, boarddata->en_gpio);
+ if (err) {
+ dev_err(mmc_dev(host->mmc),
+ "failed to request enable gpio!\n");
+ goto disable_clk;
+ }
+
+ }
+
switch (boarddata->max_bus_width) {
case 8:
host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA;