summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2016-09-03 23:16:32 +0100
committerRussell King <rmk+kernel@armlinux.org.uk>2020-10-12 21:55:26 +0100
commita89aa5b47f502d8d0483d9876328a30a73fe7244 (patch)
tree45a734b0ed9b3531be0fd40fb074d1938174bc23
parentc48c142be69a3891cbd9bcc9c3ab5816f8152723 (diff)
ARM: pxa/e740: convert to gpiod APIs
Switch the E740 machine to use the gpiod APIs rather than hard-coding the GPIO numbers in the board specific PCMCIA driver. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r--arch/arm/mach-pxa/eseries.c20
-rw-r--r--drivers/pcmcia/pxa2xx_e740.c43
2 files changed, 35 insertions, 28 deletions
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index f37c44b6139d..c9c53ea16236 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -496,6 +496,25 @@ static unsigned long e740_pin_config[] __initdata = {
GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
};
+static struct gpiod_lookup_table e740_pcmcia_gpio_table = {
+ .dev_id = "pxa2xx-pcmcia",
+ .table = {
+ GPIO_LOOKUP("GPIO", GPIO_E740_PCMCIA_CD0,
+ "adetect", GPIO_ACTIVE_LOW),
+ GPIO_LOOKUP("GPIO", GPIO_E740_PCMCIA_RDY0,
+ "aready", GPIO_ACTIVE_HIGH),
+ GPIO_LOOKUP("GPIO", GPIO_E740_PCMCIA_RST0,
+ "areset", GPIO_ACTIVE_HIGH),
+ GPIO_LOOKUP("GPIO", GPIO_E740_PCMCIA_CD1,
+ "bdetect", GPIO_ACTIVE_LOW),
+ GPIO_LOOKUP("GPIO", GPIO_E740_PCMCIA_RDY1,
+ "bready", GPIO_ACTIVE_HIGH),
+ GPIO_LOOKUP("GPIO", GPIO_E740_PCMCIA_RST1,
+ "breset", GPIO_ACTIVE_HIGH),
+ { },
+ },
+};
+
/* -------------------- e740 t7l66xb parameters -------------------- */
static struct t7l66xb_platform_data e740_t7l66xb_info = {
@@ -532,6 +551,7 @@ static struct platform_device *e740_devices[] __initdata = {
static void __init e740_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config));
+ gpiod_add_lookup_table(&e740_pcmcia_gpio_table);
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);
diff --git a/drivers/pcmcia/pxa2xx_e740.c b/drivers/pcmcia/pxa2xx_e740.c
index 72caa6d05ab9..a97c030aed94 100644
--- a/drivers/pcmcia/pxa2xx_e740.c
+++ b/drivers/pcmcia/pxa2xx_e740.c
@@ -5,6 +5,7 @@
* (c) 2004 Ian Molton <spyro@f2s.com>
*/
+#include <linux/gpio/consumer.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
@@ -22,43 +23,29 @@
static int e740_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
+ const char *reset_name;
+
if (skt->nr == 0) {
- skt->stat[SOC_STAT_CD].gpio = GPIO_E740_PCMCIA_CD0;
- skt->stat[SOC_STAT_CD].name = "CF card detect";
- skt->stat[SOC_STAT_RDY].gpio = GPIO_E740_PCMCIA_RDY0;
- skt->stat[SOC_STAT_RDY].name = "CF ready";
+ skt->stat[SOC_STAT_CD].name = "adetect";
+ skt->stat[SOC_STAT_RDY].name = "aready";
+ reset_name = "areset";
} else {
- skt->stat[SOC_STAT_CD].gpio = GPIO_E740_PCMCIA_CD1;
- skt->stat[SOC_STAT_CD].name = "Wifi switch";
- skt->stat[SOC_STAT_RDY].gpio = GPIO_E740_PCMCIA_RDY1;
- skt->stat[SOC_STAT_RDY].name = "Wifi ready";
+ skt->stat[SOC_STAT_CD].name = "bdetect";
+ skt->stat[SOC_STAT_RDY].name = "bready";
+ reset_name = "breset";
}
- return 0;
-}
+ skt->gpio_reset = devm_gpiod_get(skt->socket.dev.parent, reset_name,
+ GPIOD_OUT_HIGH);
+ if (IS_ERR(skt->gpio_reset))
+ return PTR_ERR(skt->gpio_reset);
-static void e740_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
- struct pcmcia_state *state)
-{
- state->vs_3v = 1;
- state->vs_Xv = 0;
+ return soc_pcmcia_request_gpiods(skt);
}
static int e740_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
const socket_state_t *state)
{
- if (state->flags & SS_RESET) {
- if (skt->nr == 0)
- gpio_set_value(GPIO_E740_PCMCIA_RST0, 1);
- else
- gpio_set_value(GPIO_E740_PCMCIA_RST1, 1);
- } else {
- if (skt->nr == 0)
- gpio_set_value(GPIO_E740_PCMCIA_RST0, 0);
- else
- gpio_set_value(GPIO_E740_PCMCIA_RST1, 0);
- }
-
switch (state->Vcc) {
case 0: /* Socket off */
if (skt->nr == 0)
@@ -83,7 +70,7 @@ static int e740_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
static struct pcmcia_low_level e740_pcmcia_ops = {
.owner = THIS_MODULE,
.hw_init = e740_pcmcia_hw_init,
- .socket_state = e740_pcmcia_socket_state,
+ .socket_state = soc_common_cf_socket_state,
.configure_socket = e740_pcmcia_configure_socket,
.nr = 2,
};