diff options
author | Russell King - ARM Linux <linux@arm.linux.org.uk> | 2009-03-29 14:23:42 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2009-11-09 02:30:11 -0500 |
commit | da4f007375197d6683461b995d404b01a7fdf2f5 (patch) | |
tree | 310c773abd405610c2dfcb952c1dead23885e6d9 /drivers/pcmcia/sa11xx_base.c | |
parent | be85458edce0f165cff62622f5e73b1d17b1e228 (diff) |
PCMCIA: soc_common: push socket probe down into SoC specific support
Move the individual socket probing and initialization down into the
SoC specific support files, thereby allowing soc_common_drv_pcmcia_probe
to be eliminated. soc_common.c now no longer deals with distinct groups
of sockets.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/sa11xx_base.c')
-rw-r--r-- | drivers/pcmcia/sa11xx_base.c | 91 |
1 files changed, 56 insertions, 35 deletions
diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c index e15d59f2d8a9..92a43486adc6 100644 --- a/drivers/pcmcia/sa11xx_base.c +++ b/drivers/pcmcia/sa11xx_base.c | |||
@@ -171,6 +171,31 @@ static const char *skt_names[] = { | |||
171 | #define SKT_DEV_INFO_SIZE(n) \ | 171 | #define SKT_DEV_INFO_SIZE(n) \ |
172 | (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket)) | 172 | (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket)) |
173 | 173 | ||
174 | static int sa11xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt) | ||
175 | { | ||
176 | skt->res_skt.start = _PCMCIA(skt->nr); | ||
177 | skt->res_skt.end = _PCMCIA(skt->nr) + PCMCIASp - 1; | ||
178 | skt->res_skt.name = skt_names[skt->nr]; | ||
179 | skt->res_skt.flags = IORESOURCE_MEM; | ||
180 | |||
181 | skt->res_io.start = _PCMCIAIO(skt->nr); | ||
182 | skt->res_io.end = _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1; | ||
183 | skt->res_io.name = "io"; | ||
184 | skt->res_io.flags = IORESOURCE_MEM | IORESOURCE_BUSY; | ||
185 | |||
186 | skt->res_mem.start = _PCMCIAMem(skt->nr); | ||
187 | skt->res_mem.end = _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1; | ||
188 | skt->res_mem.name = "memory"; | ||
189 | skt->res_mem.flags = IORESOURCE_MEM; | ||
190 | |||
191 | skt->res_attr.start = _PCMCIAAttr(skt->nr); | ||
192 | skt->res_attr.end = _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1; | ||
193 | skt->res_attr.name = "attribute"; | ||
194 | skt->res_attr.flags = IORESOURCE_MEM; | ||
195 | |||
196 | return soc_pcmcia_add_one(skt); | ||
197 | } | ||
198 | |||
174 | int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, | 199 | int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, |
175 | int first, int nr) | 200 | int first, int nr) |
176 | { | 201 | { |
@@ -178,40 +203,6 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, | |||
178 | struct soc_pcmcia_socket *skt; | 203 | struct soc_pcmcia_socket *skt; |
179 | int i; | 204 | int i; |
180 | 205 | ||
181 | sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL); | ||
182 | if (!sinfo) | ||
183 | return -ENOMEM; | ||
184 | |||
185 | sinfo->nskt = nr; | ||
186 | |||
187 | /* Initiliaze processor specific parameters */ | ||
188 | for (i = 0; i < nr; i++) { | ||
189 | skt = &sinfo->skt[i]; | ||
190 | |||
191 | skt->nr = first + i; | ||
192 | skt->irq = NO_IRQ; | ||
193 | |||
194 | skt->res_skt.start = _PCMCIA(skt->nr); | ||
195 | skt->res_skt.end = _PCMCIA(skt->nr) + PCMCIASp - 1; | ||
196 | skt->res_skt.name = skt_names[skt->nr]; | ||
197 | skt->res_skt.flags = IORESOURCE_MEM; | ||
198 | |||
199 | skt->res_io.start = _PCMCIAIO(skt->nr); | ||
200 | skt->res_io.end = _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1; | ||
201 | skt->res_io.name = "io"; | ||
202 | skt->res_io.flags = IORESOURCE_MEM | IORESOURCE_BUSY; | ||
203 | |||
204 | skt->res_mem.start = _PCMCIAMem(skt->nr); | ||
205 | skt->res_mem.end = _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1; | ||
206 | skt->res_mem.name = "memory"; | ||
207 | skt->res_mem.flags = IORESOURCE_MEM; | ||
208 | |||
209 | skt->res_attr.start = _PCMCIAAttr(skt->nr); | ||
210 | skt->res_attr.end = _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1; | ||
211 | skt->res_attr.name = "attribute"; | ||
212 | skt->res_attr.flags = IORESOURCE_MEM; | ||
213 | } | ||
214 | |||
215 | /* | 206 | /* |
216 | * set default MECR calculation if the board specific | 207 | * set default MECR calculation if the board specific |
217 | * code did not specify one... | 208 | * code did not specify one... |
@@ -226,7 +217,37 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, | |||
226 | ops->frequency_change = sa1100_pcmcia_frequency_change; | 217 | ops->frequency_change = sa1100_pcmcia_frequency_change; |
227 | #endif | 218 | #endif |
228 | 219 | ||
229 | return soc_common_drv_pcmcia_probe(dev, ops, sinfo); | 220 | sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL); |
221 | if (!sinfo) | ||
222 | return -ENOMEM; | ||
223 | |||
224 | sinfo->nskt = nr; | ||
225 | |||
226 | /* Initiliaze processor specific parameters */ | ||
227 | for (i = 0; i < nr; i++) { | ||
228 | skt = &sinfo->skt[i]; | ||
229 | |||
230 | skt->nr = first + i; | ||
231 | skt->irq = NO_IRQ; | ||
232 | skt->dev = dev; | ||
233 | skt->ops = ops; | ||
234 | skt->socket.owner = ops->owner; | ||
235 | skt->socket.dev.parent = dev; | ||
236 | |||
237 | ret = sa11xx_drv_pcmcia_add_one(skt); | ||
238 | if (ret) | ||
239 | break; | ||
240 | } | ||
241 | |||
242 | if (ret) { | ||
243 | while (--i >= 0) | ||
244 | soc_pcmcia_remove_one(&sinfo->skt[i]); | ||
245 | kfree(sinfo); | ||
246 | } else { | ||
247 | dev_set_drvdata(dev, sinfo); | ||
248 | } | ||
249 | |||
250 | return ret; | ||
230 | } | 251 | } |
231 | EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe); | 252 | EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe); |
232 | 253 | ||