diff options
Diffstat (limited to 'drivers/pcmcia/sa11xx_base.c')
-rw-r--r-- | drivers/pcmcia/sa11xx_base.c | 99 |
1 files changed, 63 insertions, 36 deletions
diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c index e15d59f2d8a9..fc9a6527019b 100644 --- a/drivers/pcmcia/sa11xx_base.c +++ b/drivers/pcmcia/sa11xx_base.c | |||
@@ -171,12 +171,58 @@ 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 | 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 | EXPORT_SYMBOL(sa11xx_drv_pcmcia_add_one); | ||
199 | |||
200 | void sa11xx_drv_pcmcia_ops(struct pcmcia_low_level *ops) | ||
201 | { | ||
202 | /* | ||
203 | * set default MECR calculation if the board specific | ||
204 | * code did not specify one... | ||
205 | */ | ||
206 | if (!ops->get_timing) | ||
207 | ops->get_timing = sa1100_pcmcia_default_mecr_timing; | ||
208 | |||
209 | /* Provide our SA11x0 specific timing routines. */ | ||
210 | ops->set_timing = sa1100_pcmcia_set_timing; | ||
211 | ops->show_timing = sa1100_pcmcia_show_timing; | ||
212 | #ifdef CONFIG_CPU_FREQ | ||
213 | ops->frequency_change = sa1100_pcmcia_frequency_change; | ||
214 | #endif | ||
215 | } | ||
216 | EXPORT_SYMBOL(sa11xx_drv_pcmcia_ops); | ||
217 | |||
174 | int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, | 218 | int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, |
175 | int first, int nr) | 219 | int first, int nr) |
176 | { | 220 | { |
177 | struct skt_dev_info *sinfo; | 221 | struct skt_dev_info *sinfo; |
178 | struct soc_pcmcia_socket *skt; | 222 | struct soc_pcmcia_socket *skt; |
179 | int i; | 223 | int i, ret = 0; |
224 | |||
225 | sa11xx_drv_pcmcia_ops(ops); | ||
180 | 226 | ||
181 | sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL); | 227 | sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL); |
182 | if (!sinfo) | 228 | if (!sinfo) |
@@ -188,45 +234,26 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, | |||
188 | for (i = 0; i < nr; i++) { | 234 | for (i = 0; i < nr; i++) { |
189 | skt = &sinfo->skt[i]; | 235 | skt = &sinfo->skt[i]; |
190 | 236 | ||
191 | skt->nr = first + i; | 237 | skt->nr = first + i; |
192 | skt->irq = NO_IRQ; | 238 | skt->ops = ops; |
193 | 239 | skt->socket.owner = ops->owner; | |
194 | skt->res_skt.start = _PCMCIA(skt->nr); | 240 | skt->socket.dev.parent = dev; |
195 | skt->res_skt.end = _PCMCIA(skt->nr) + PCMCIASp - 1; | 241 | skt->socket.pci_irq = NO_IRQ; |
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 | 242 | ||
204 | skt->res_mem.start = _PCMCIAMem(skt->nr); | 243 | ret = sa11xx_drv_pcmcia_add_one(skt); |
205 | skt->res_mem.end = _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1; | 244 | if (ret) |
206 | skt->res_mem.name = "memory"; | 245 | break; |
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 | } | 246 | } |
214 | 247 | ||
215 | /* | 248 | if (ret) { |
216 | * set default MECR calculation if the board specific | 249 | while (--i >= 0) |
217 | * code did not specify one... | 250 | soc_pcmcia_remove_one(&sinfo->skt[i]); |
218 | */ | 251 | kfree(sinfo); |
219 | if (!ops->get_timing) | 252 | } else { |
220 | ops->get_timing = sa1100_pcmcia_default_mecr_timing; | 253 | dev_set_drvdata(dev, sinfo); |
221 | 254 | } | |
222 | /* Provide our SA11x0 specific timing routines. */ | ||
223 | ops->set_timing = sa1100_pcmcia_set_timing; | ||
224 | ops->show_timing = sa1100_pcmcia_show_timing; | ||
225 | #ifdef CONFIG_CPU_FREQ | ||
226 | ops->frequency_change = sa1100_pcmcia_frequency_change; | ||
227 | #endif | ||
228 | 255 | ||
229 | return soc_common_drv_pcmcia_probe(dev, ops, sinfo); | 256 | return ret; |
230 | } | 257 | } |
231 | EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe); | 258 | EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe); |
232 | 259 | ||