From a9bb5a4bf9f84256499c802fd397d56d55227e4f Mon Sep 17 00:00:00 2001 From: Russell King Date: Fri, 13 Jan 2012 22:56:32 +0000 Subject: PCMCIA: pxa: convert PXA socket drivers to use new irq/gpio management Convert all the PXA platform socket drivers to use the new irq/gpio management provided by soc_common. This relieves these drivers from having to do anything with these GPIOs other than provide the numbers to soc_common. Acked-by: Dominik Brodowski Signed-off-by: Russell King --- drivers/pcmcia/pxa2xx_e740.c | 70 ++++++++------------------------------------ 1 file changed, 12 insertions(+), 58 deletions(-) (limited to 'drivers/pcmcia/pxa2xx_e740.c') diff --git a/drivers/pcmcia/pxa2xx_e740.c b/drivers/pcmcia/pxa2xx_e740.c index 17cd2ce7428..24e00a503d0 100644 --- a/drivers/pcmcia/pxa2xx_e740.c +++ b/drivers/pcmcia/pxa2xx_e740.c @@ -23,52 +23,27 @@ #include "soc_common.h" -static struct pcmcia_irqs cd_irqs[] = { - { - .sock = 0, - .str = "CF card detect" - }, - { - .sock = 1, - .str = "Wifi switch" - }, -}; - static int e740_pcmcia_hw_init(struct soc_pcmcia_socket *skt) { - if (skt->nr == 0) - skt->socket.pci_irq = gpio_to_irq(GPIO_E740_PCMCIA_RDY0); - else - skt->socket.pci_irq = gpio_to_irq(GPIO_E740_PCMCIA_RDY1); - - cd_irqs[0].irq = gpio_to_irq(GPIO_E740_PCMCIA_CD0); - cd_irqs[1].irq = gpio_to_irq(GPIO_E740_PCMCIA_CD1); - - return soc_pcmcia_request_irqs(skt, &cd_irqs[skt->nr], 1); -} + 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"; + } 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"; + } -/* - * Release all resources. - */ -static void e740_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) -{ - soc_pcmcia_free_irqs(skt, &cd_irqs[skt->nr], 1); + return 0; } static void e740_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) { - if (skt->nr == 0) { - state->detect = gpio_get_value(GPIO_E740_PCMCIA_CD0) ? 0 : 1; - state->ready = gpio_get_value(GPIO_E740_PCMCIA_RDY0) ? 1 : 0; - } else { - state->detect = gpio_get_value(GPIO_E740_PCMCIA_CD1) ? 0 : 1; - state->ready = gpio_get_value(GPIO_E740_PCMCIA_RDY1) ? 1 : 0; - } - state->vs_3v = 1; - state->bvd1 = 1; - state->bvd2 = 1; state->wrprot = 0; state->vs_Xv = 0; } @@ -109,32 +84,11 @@ static int e740_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, return 0; } -/* - * Enable card status IRQs on (re-)initialisation. This can - * be called at initialisation, power management event, or - * pcmcia event. - */ -static void e740_pcmcia_socket_init(struct soc_pcmcia_socket *skt) -{ - soc_pcmcia_enable_irqs(skt, cd_irqs, ARRAY_SIZE(cd_irqs)); -} - -/* - * Disable card status IRQs on suspend. - */ -static void e740_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) -{ - soc_pcmcia_disable_irqs(skt, cd_irqs, ARRAY_SIZE(cd_irqs)); -} - static struct pcmcia_low_level e740_pcmcia_ops = { .owner = THIS_MODULE, .hw_init = e740_pcmcia_hw_init, - .hw_shutdown = e740_pcmcia_hw_shutdown, .socket_state = e740_pcmcia_socket_state, .configure_socket = e740_pcmcia_configure_socket, - .socket_init = e740_pcmcia_socket_init, - .socket_suspend = e740_pcmcia_socket_suspend, .nr = 2, }; -- cgit v1.2.3-18-g5258