diff options
Diffstat (limited to 'drivers/pcmcia/pxa2xx_cm_x255.c')
-rw-r--r-- | drivers/pcmcia/pxa2xx_cm_x255.c | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/drivers/pcmcia/pxa2xx_cm_x255.c b/drivers/pcmcia/pxa2xx_cm_x255.c index 31ab6ddf52c9..da40908b29dd 100644 --- a/drivers/pcmcia/pxa2xx_cm_x255.c +++ b/drivers/pcmcia/pxa2xx_cm_x255.c | |||
@@ -25,17 +25,6 @@ | |||
25 | #define GPIO_PCMCIA_S1_RDYINT (8) | 25 | #define GPIO_PCMCIA_S1_RDYINT (8) |
26 | #define GPIO_PCMCIA_RESET (9) | 26 | #define GPIO_PCMCIA_RESET (9) |
27 | 27 | ||
28 | #define PCMCIA_S0_CD_VALID gpio_to_irq(GPIO_PCMCIA_S0_CD_VALID) | ||
29 | #define PCMCIA_S1_CD_VALID gpio_to_irq(GPIO_PCMCIA_S1_CD_VALID) | ||
30 | #define PCMCIA_S0_RDYINT gpio_to_irq(GPIO_PCMCIA_S0_RDYINT) | ||
31 | #define PCMCIA_S1_RDYINT gpio_to_irq(GPIO_PCMCIA_S1_RDYINT) | ||
32 | |||
33 | |||
34 | static struct pcmcia_irqs irqs[] = { | ||
35 | { .sock = 0, .str = "PCMCIA0 CD" }, | ||
36 | { .sock = 1, .str = "PCMCIA1 CD" }, | ||
37 | }; | ||
38 | |||
39 | static int cmx255_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 28 | static int cmx255_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
40 | { | 29 | { |
41 | int ret = gpio_request(GPIO_PCMCIA_RESET, "PCCard reset"); | 30 | int ret = gpio_request(GPIO_PCMCIA_RESET, "PCCard reset"); |
@@ -43,19 +32,23 @@ static int cmx255_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
43 | return ret; | 32 | return ret; |
44 | gpio_direction_output(GPIO_PCMCIA_RESET, 0); | 33 | gpio_direction_output(GPIO_PCMCIA_RESET, 0); |
45 | 34 | ||
46 | skt->socket.pci_irq = skt->nr == 0 ? PCMCIA_S0_RDYINT : PCMCIA_S1_RDYINT; | 35 | if (skt->nr == 0) { |
47 | irqs[0].irq = PCMCIA_S0_CD_VALID; | 36 | skt->stat[SOC_STAT_CD].gpio = GPIO_PCMCIA_S0_CD_VALID; |
48 | irqs[1].irq = PCMCIA_S1_CD_VALID; | 37 | skt->stat[SOC_STAT_CD].name = "PCMCIA0 CD"; |
49 | ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 38 | skt->stat[SOC_STAT_RDY].gpio = GPIO_PCMCIA_S0_RDYINT; |
50 | if (!ret) | 39 | skt->stat[SOC_STAT_RDY].name = "PCMCIA0 RDY"; |
51 | gpio_free(GPIO_PCMCIA_RESET); | 40 | } else { |
41 | skt->stat[SOC_STAT_CD].gpio = GPIO_PCMCIA_S1_CD_VALID; | ||
42 | skt->stat[SOC_STAT_CD].name = "PCMCIA1 CD"; | ||
43 | skt->stat[SOC_STAT_RDY].gpio = GPIO_PCMCIA_S1_RDYINT; | ||
44 | skt->stat[SOC_STAT_RDY].name = "PCMCIA1 RDY"; | ||
45 | } | ||
52 | 46 | ||
53 | return ret; | 47 | return 0; |
54 | } | 48 | } |
55 | 49 | ||
56 | static void cmx255_pcmcia_shutdown(struct soc_pcmcia_socket *skt) | 50 | static void cmx255_pcmcia_shutdown(struct soc_pcmcia_socket *skt) |
57 | { | 51 | { |
58 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
59 | gpio_free(GPIO_PCMCIA_RESET); | 52 | gpio_free(GPIO_PCMCIA_RESET); |
60 | } | 53 | } |
61 | 54 | ||
@@ -63,16 +56,8 @@ static void cmx255_pcmcia_shutdown(struct soc_pcmcia_socket *skt) | |||
63 | static void cmx255_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | 56 | static void cmx255_pcmcia_socket_state(struct soc_pcmcia_socket *skt, |
64 | struct pcmcia_state *state) | 57 | struct pcmcia_state *state) |
65 | { | 58 | { |
66 | int cd = skt->nr ? GPIO_PCMCIA_S1_CD_VALID : GPIO_PCMCIA_S0_CD_VALID; | ||
67 | int rdy = skt->nr ? GPIO_PCMCIA_S1_RDYINT : GPIO_PCMCIA_S0_RDYINT; | ||
68 | |||
69 | state->detect = !gpio_get_value(cd); | ||
70 | state->ready = !!gpio_get_value(rdy); | ||
71 | state->bvd1 = 1; | ||
72 | state->bvd2 = 1; | ||
73 | state->vs_3v = 0; | 59 | state->vs_3v = 0; |
74 | state->vs_Xv = 0; | 60 | state->vs_Xv = 0; |
75 | state->wrprot = 0; /* not available */ | ||
76 | } | 61 | } |
77 | 62 | ||
78 | 63 | ||