diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-12-19 18:04:22 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-02-04 09:32:23 -0500 |
commit | 81f33c65e6c09597e748288010476861ac5bd166 (patch) | |
tree | fdc080d5d7ca25dfe4a033f31f419d8bb1124e7d /drivers/pcmcia/sa1111_generic.c | |
parent | a9bb5a4bf9f84256499c802fd397d56d55227e4f (diff) |
PCMCIA: sa1111: use new per-socket irq/gpio infrastructure
Convert sa1111 PCMCIA drivers to use the new per-socket irq/gpio
infrastructure. As the core takes care of handling the IRQs, we
can get rid of sa1111_pcmcia_socket_init(), sa1111_pcmcia_socket_suspend(),
sa1111_pcmcia_hw_init() and sa1111_pcmcia_hw_shutdown(), as well
as the private IRQ table.
We remove the NCR_0 setting in Neponset, as this is duplicating
what's already done via configure_socket in suspend.
Acked-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/pcmcia/sa1111_generic.c')
-rw-r--r-- | drivers/pcmcia/sa1111_generic.c | 52 |
1 files changed, 13 insertions, 39 deletions
diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c index 7d6d3d423ef0..7510d506b8c3 100644 --- a/drivers/pcmcia/sa1111_generic.c +++ b/drivers/pcmcia/sa1111_generic.c | |||
@@ -29,23 +29,6 @@ | |||
29 | #define IDX_IRQ_S1_CD_VALID (4) | 29 | #define IDX_IRQ_S1_CD_VALID (4) |
30 | #define IDX_IRQ_S1_BVD1_STSCHG (5) | 30 | #define IDX_IRQ_S1_BVD1_STSCHG (5) |
31 | 31 | ||
32 | static struct pcmcia_irqs irqs[] = { | ||
33 | { 0, NO_IRQ, "SA1111 PCMCIA card detect" }, | ||
34 | { 0, NO_IRQ, "SA1111 PCMCIA BVD1" }, | ||
35 | { 1, NO_IRQ, "SA1111 CF card detect" }, | ||
36 | { 1, NO_IRQ, "SA1111 CF BVD1" }, | ||
37 | }; | ||
38 | |||
39 | static int sa1111_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | ||
40 | { | ||
41 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
42 | } | ||
43 | |||
44 | static void sa1111_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | ||
45 | { | ||
46 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
47 | } | ||
48 | |||
49 | void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) | 32 | void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) |
50 | { | 33 | { |
51 | struct sa1111_pcmcia_socket *s = to_skt(skt); | 34 | struct sa1111_pcmcia_socket *s = to_skt(skt); |
@@ -114,26 +97,13 @@ int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_s | |||
114 | return 0; | 97 | return 0; |
115 | } | 98 | } |
116 | 99 | ||
117 | void sa1111_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | ||
118 | { | ||
119 | soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
120 | } | ||
121 | |||
122 | static void sa1111_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | ||
123 | { | ||
124 | soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
125 | } | ||
126 | |||
127 | int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops, | 100 | int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops, |
128 | int (*add)(struct soc_pcmcia_socket *)) | 101 | int (*add)(struct soc_pcmcia_socket *)) |
129 | { | 102 | { |
130 | struct sa1111_pcmcia_socket *s; | 103 | struct sa1111_pcmcia_socket *s; |
131 | int i, ret = 0; | 104 | int i, ret = 0; |
132 | 105 | ||
133 | ops->hw_init = sa1111_pcmcia_hw_init; | ||
134 | ops->hw_shutdown = sa1111_pcmcia_hw_shutdown; | ||
135 | ops->socket_state = sa1111_pcmcia_socket_state; | 106 | ops->socket_state = sa1111_pcmcia_socket_state; |
136 | ops->socket_suspend = sa1111_pcmcia_socket_suspend; | ||
137 | 107 | ||
138 | for (i = 0; i < ops->nr; i++) { | 108 | for (i = 0; i < ops->nr; i++) { |
139 | s = kzalloc(sizeof(*s), GFP_KERNEL); | 109 | s = kzalloc(sizeof(*s), GFP_KERNEL); |
@@ -142,10 +112,20 @@ int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops, | |||
142 | 112 | ||
143 | s->soc.nr = ops->first + i; | 113 | s->soc.nr = ops->first + i; |
144 | soc_pcmcia_init_one(&s->soc, ops, &dev->dev); | 114 | soc_pcmcia_init_one(&s->soc, ops, &dev->dev); |
145 | s->soc.socket.pci_irq = s->soc.nr ? | ||
146 | dev->irq[IDX_IRQ_S0_READY_NINT] : | ||
147 | dev->irq[IDX_IRQ_S1_READY_NINT]; | ||
148 | s->dev = dev; | 115 | s->dev = dev; |
116 | if (s->soc.nr) { | ||
117 | s->soc.socket.pci_irq = dev->irq[IDX_IRQ_S1_READY_NINT]; | ||
118 | s->soc.stat[SOC_STAT_CD].irq = dev->irq[IDX_IRQ_S1_CD_VALID]; | ||
119 | s->soc.stat[SOC_STAT_CD].name = "SA1111 CF card detect"; | ||
120 | s->soc.stat[SOC_STAT_BVD1].irq = dev->irq[IDX_IRQ_S1_BVD1_STSCHG]; | ||
121 | s->soc.stat[SOC_STAT_BVD1].name = "SA1111 CF BVD1"; | ||
122 | } else { | ||
123 | s->soc.socket.pci_irq = dev->irq[IDX_IRQ_S0_READY_NINT]; | ||
124 | s->soc.stat[SOC_STAT_CD].irq = dev->irq[IDX_IRQ_S0_CD_VALID]; | ||
125 | s->soc.stat[SOC_STAT_CD].name = "SA1111 PCMCIA card detect"; | ||
126 | s->soc.stat[SOC_STAT_BVD1].irq = dev->irq[IDX_IRQ_S0_BVD1_STSCHG]; | ||
127 | s->soc.stat[SOC_STAT_BVD1].name = "SA1111 PCMCIA BVD1"; | ||
128 | } | ||
149 | 129 | ||
150 | ret = add(&s->soc); | 130 | ret = add(&s->soc); |
151 | if (ret == 0) { | 131 | if (ret == 0) { |
@@ -170,12 +150,6 @@ static int pcmcia_probe(struct sa1111_dev *dev) | |||
170 | 150 | ||
171 | base = dev->mapbase; | 151 | base = dev->mapbase; |
172 | 152 | ||
173 | /* Initialize PCMCIA IRQs */ | ||
174 | irqs[0].irq = dev->irq[IDX_IRQ_S0_CD_VALID]; | ||
175 | irqs[1].irq = dev->irq[IDX_IRQ_S0_BVD1_STSCHG]; | ||
176 | irqs[2].irq = dev->irq[IDX_IRQ_S1_CD_VALID]; | ||
177 | irqs[3].irq = dev->irq[IDX_IRQ_S1_BVD1_STSCHG]; | ||
178 | |||
179 | /* | 153 | /* |
180 | * Initialise the suspend state. | 154 | * Initialise the suspend state. |
181 | */ | 155 | */ |