aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorEric Miao <eric.y.miao@gmail.com>2009-12-25 23:32:38 -0500
committerEric Miao <eric.y.miao@gmail.com>2010-03-01 18:40:50 -0500
commit08fa159003aa510027951671b94aadc380ab2d2a (patch)
tree6160d90c065f6bfb51c0e99d524fe4d845e85d67 /drivers/pcmcia
parentac609d266e4af4ebf586d610bd76e04dddae0c4c (diff)
[ARM] sa1111: avoid using hardcoded IRQ numbers for PCMCIA driver
The IRQs for card detect and status change are currently hardcoded in SA1111 PCMCIA driver, which can be actually obtained from the .irq[] from 'struct sa1111_dev' to keep it generic. Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/sa1111_generic.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c
index de6bc333d299..db79ca61cf96 100644
--- a/drivers/pcmcia/sa1111_generic.c
+++ b/drivers/pcmcia/sa1111_generic.c
@@ -21,11 +21,18 @@
21 21
22#include "sa1111_generic.h" 22#include "sa1111_generic.h"
23 23
24#define IDX_IRQ_S0_READY_NINT (0)
25#define IDX_IRQ_S0_CD_VALID (1)
26#define IDX_IRQ_S0_BVD1_STSCHG (2)
27#define IDX_IRQ_S1_READY_NINT (3)
28#define IDX_IRQ_S1_CD_VALID (4)
29#define IDX_IRQ_S1_BVD1_STSCHG (5)
30
24static struct pcmcia_irqs irqs[] = { 31static struct pcmcia_irqs irqs[] = {
25 { 0, IRQ_S0_CD_VALID, "SA1111 PCMCIA card detect" }, 32 { 0, NO_IRQ, "SA1111 PCMCIA card detect" },
26 { 0, IRQ_S0_BVD1_STSCHG, "SA1111 PCMCIA BVD1" }, 33 { 0, NO_IRQ, "SA1111 PCMCIA BVD1" },
27 { 1, IRQ_S1_CD_VALID, "SA1111 CF card detect" }, 34 { 1, NO_IRQ, "SA1111 CF card detect" },
28 { 1, IRQ_S1_BVD1_STSCHG, "SA1111 CF BVD1" }, 35 { 1, NO_IRQ, "SA1111 CF BVD1" },
29}; 36};
30 37
31static int sa1111_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 38static int sa1111_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
@@ -136,7 +143,9 @@ int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops,
136 s->soc.ops = ops; 143 s->soc.ops = ops;
137 s->soc.socket.owner = ops->owner; 144 s->soc.socket.owner = ops->owner;
138 s->soc.socket.dev.parent = &dev->dev; 145 s->soc.socket.dev.parent = &dev->dev;
139 s->soc.socket.pci_irq = s->soc.nr ? IRQ_S1_READY_NINT : IRQ_S0_READY_NINT; 146 s->soc.socket.pci_irq = s->soc.nr ?
147 dev->irq[IDX_IRQ_S0_READY_NINT] :
148 dev->irq[IDX_IRQ_S1_READY_NINT];
140 s->dev = dev; 149 s->dev = dev;
141 150
142 ret = add(&s->soc); 151 ret = add(&s->soc);
@@ -162,6 +171,12 @@ static int pcmcia_probe(struct sa1111_dev *dev)
162 171
163 base = dev->mapbase; 172 base = dev->mapbase;
164 173
174 /* Initialize PCMCIA IRQs */
175 irqs[0].irq = dev->irq[IDX_IRQ_S0_CD_VALID];
176 irqs[1].irq = dev->irq[IDX_IRQ_S0_BVD1_STSCHG];
177 irqs[2].irq = dev->irq[IDX_IRQ_S1_CD_VALID];
178 irqs[3].irq = dev->irq[IDX_IRQ_S1_BVD1_STSCHG];
179
165 /* 180 /*
166 * Initialise the suspend state. 181 * Initialise the suspend state.
167 */ 182 */