summaryrefslogtreecommitdiff
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
parent580eacc8cc0f0c3e80beeb1f7cc9a63167a9ffba (diff)
Enable GPIO support for MMC port used by wilink
-rw-r--r--arch/arm/boot/dts/imx6qdl-var-som.dtsi16
-rw-r--r--drivers/mmc/core/slot-gpio.c40
-rw-r--r--drivers/mmc/host/sdhci-esdhc-imx.c13
-rw-r--r--include/linux/mmc/slot-gpio.h2
-rw-r--r--include/linux/platform_data/mmc-esdhc-imx.h1
5 files changed, 57 insertions, 15 deletions
diff --git a/arch/arm/boot/dts/imx6qdl-var-som.dtsi b/arch/arm/boot/dts/imx6qdl-var-som.dtsi
index de69fd948a3c..02dd541a7a33 100644
--- a/arch/arm/boot/dts/imx6qdl-var-som.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-var-som.dtsi
@@ -77,20 +77,6 @@
/* if a 12xx card is there, configure the clock to WL12XX_REFCLOCK_38_XTAL */
board-ref-clock = <4>;
};
-
- wlan_en_reg: fixedregulator@2 {
- compatible = "regulator-fixed";
- regulator-name = "wlan-en-regulator";
- regulator-min-microvolt = <3300000>;
- regulator-max-microvolt = <3300000>;
-
- /* WLAN_EN GPIO for this board - Bank7, pin8 */
- gpio = <&gpio7 8 0>;
-
- /* WLAN card specific delay */
- startup-delay-us = <70000>;
- enable-active-high;
- };
};
gpio-keys {
@@ -687,7 +673,7 @@
pinctrl-0 = <&pinctrl_usdhc3_2>;
keep-power-in-suspend;
enable-sdio-wakeup;
- vqmmc-supply = <&wlan_en_reg>;
+ en-gpios = <&gpio7 8 0>;
non-removable;
cap-power-off-card;
max-frequency = <24000000>;
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;
diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h
index 7d88d27bfafa..622ba08c564f 100644
--- a/include/linux/mmc/slot-gpio.h
+++ b/include/linux/mmc/slot-gpio.h
@@ -20,5 +20,7 @@ void mmc_gpio_free_ro(struct mmc_host *host);
int mmc_gpio_get_cd(struct mmc_host *host);
int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio);
void mmc_gpio_free_cd(struct mmc_host *host);
+int mmc_gpio_set_en(struct mmc_host *host, unsigned int gpio);
+
#endif
diff --git a/include/linux/platform_data/mmc-esdhc-imx.h b/include/linux/platform_data/mmc-esdhc-imx.h
index e1571efa3f2b..334917a068f8 100644
--- a/include/linux/platform_data/mmc-esdhc-imx.h
+++ b/include/linux/platform_data/mmc-esdhc-imx.h
@@ -40,6 +40,7 @@ enum cd_types {
struct esdhc_platform_data {
unsigned int wp_gpio;
unsigned int cd_gpio;
+ unsigned int en_gpio;
enum wp_types wp_type;
enum cd_types cd_type;
int max_bus_width;