aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/axnet_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/axnet_cs.c')
-rw-r--r--drivers/net/pcmcia/axnet_cs.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 17f1040e255e..9d9d997f2e59 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -284,34 +284,16 @@ static int try_io_port(struct pcmcia_device *link)
284 } 284 }
285} 285}
286 286
287static int axnet_configcheck(struct pcmcia_device *p_dev, 287static int axnet_configcheck(struct pcmcia_device *p_dev, void *priv_data)
288 cistpl_cftable_entry_t *cfg,
289 cistpl_cftable_entry_t *dflt,
290 void *priv_data)
291{ 288{
292 int i; 289 if (p_dev->config_index == 0)
293 cistpl_io_t *io = &cfg->io; 290 return -EINVAL;
294
295 if (cfg->index == 0 || cfg->io.nwin == 0)
296 return -ENODEV;
297 291
298 p_dev->config_index = 0x05; 292 p_dev->config_index = 0x05;
299 /* For multifunction cards, by convention, we configure the 293 if (p_dev->resource[0]->end + p_dev->resource[1]->end < 32)
300 network function with window 0, and serial with window 1 */ 294 return -ENODEV;
301 if (io->nwin > 1) {
302 i = (io->win[1].len > io->win[0].len);
303 p_dev->resource[1]->start = io->win[1-i].base;
304 p_dev->resource[1]->end = io->win[1-i].len;
305 } else {
306 i = p_dev->resource[1]->end = 0;
307 }
308 p_dev->resource[0]->start = io->win[i].base;
309 p_dev->resource[0]->end = io->win[i].len;
310 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
311 if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32)
312 return try_io_port(p_dev);
313 295
314 return -ENODEV; 296 return try_io_port(p_dev);
315} 297}
316 298
317static int axnet_config(struct pcmcia_device *link) 299static int axnet_config(struct pcmcia_device *link)
@@ -324,6 +306,7 @@ static int axnet_config(struct pcmcia_device *link)
324 306
325 /* don't trust the CIS on this; Linksys got it wrong */ 307 /* don't trust the CIS on this; Linksys got it wrong */
326 link->config_regs = 0x63; 308 link->config_regs = 0x63;
309 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
327 ret = pcmcia_loop_config(link, axnet_configcheck, NULL); 310 ret = pcmcia_loop_config(link, axnet_configcheck, NULL);
328 if (ret != 0) 311 if (ret != 0)
329 goto failed; 312 goto failed;
@@ -331,7 +314,6 @@ static int axnet_config(struct pcmcia_device *link)
331 if (!link->irq) 314 if (!link->irq)
332 goto failed; 315 goto failed;
333 316
334 link->config_flags |= CONF_ENABLE_IRQ;
335 if (resource_size(link->resource[1]) == 8) 317 if (resource_size(link->resource[1]) == 8)
336 link->config_flags |= CONF_ENABLE_SPKR; 318 link->config_flags |= CONF_ENABLE_SPKR;
337 319