diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 17:12:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 17:12:40 -0400 |
commit | 2be4ff2f084842839b041b793ed6237e8d1d315a (patch) | |
tree | 1d776ac1717edeff4ee7d59ab0aea2782cb86dba /drivers/net/pcmcia | |
parent | cf2fa66055d718ae13e62451bb546505f63906a2 (diff) | |
parent | a45b3fb19ba1e4dfc3fc53563a072612092930a9 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (49 commits)
pcmcia: ioctl-internal definitions
pcmcia: cistpl header cleanup
pcmcia: remove unused argument to pcmcia_parse_tuple()
pcmcia: card services header cleanup
pcmcia: device_id header cleanup
pcmcia: encapsulate ioaddr_t
pcmcia: cleanup device driver header file
pcmcia: cleanup socket services header file
pcmcia: merge ds_internal.h into cs_internal.h
pcmcia: cleanup cs_internal.h
pcmcia: cs_internal.h is internal
pcmcia: use dev_printk for cs_error()
pcmcia: remove CS_ error codes alltogether
pcmcia: deprecate CS_BAD_TUPLE
pcmcia: deprecate CS_BAD_ARGS
pcmcia: deprecate CS_BAD_BASE, CS_BAD_IRQ, CS_BAD_OFFSET and CS_BAD_SIZE
pcmcia: deprecate CS_BAD_ATTRIBUTE, CS_BAD_TYPE and CS_BAD_PAGE
pcmcia: deprecate CS_NO_MORE_ITEMS
pcmcia: deprecate CS_IN_USE
pcmcia: deprecate CS_CONFIGURATION_LOCKED
...
Fix trivial conflict in drivers/pcmcia/ds.c manually
Diffstat (limited to 'drivers/net/pcmcia')
-rw-r--r-- | drivers/net/pcmcia/3c574_cs.c | 7 | ||||
-rw-r--r-- | drivers/net/pcmcia/3c589_cs.c | 7 | ||||
-rw-r--r-- | drivers/net/pcmcia/axnet_cs.c | 80 | ||||
-rw-r--r-- | drivers/net/pcmcia/com20020_cs.c | 8 | ||||
-rw-r--r-- | drivers/net/pcmcia/fmvj18x_cs.c | 21 | ||||
-rw-r--r-- | drivers/net/pcmcia/ibmtr_cs.c | 2 | ||||
-rw-r--r-- | drivers/net/pcmcia/nmclan_cs.c | 2 | ||||
-rw-r--r-- | drivers/net/pcmcia/pcnet_cs.c | 86 | ||||
-rw-r--r-- | drivers/net/pcmcia/smc91c92_cs.c | 151 | ||||
-rw-r--r-- | drivers/net/pcmcia/xirc2ps_cs.c | 79 |
10 files changed, 215 insertions, 228 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index 7112fd5e0e1b..08c4dd896077 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c | |||
@@ -355,9 +355,10 @@ static int tc574_config(struct pcmcia_device *link) | |||
355 | for (i = j = 0; j < 0x400; j += 0x20) { | 355 | for (i = j = 0; j < 0x400; j += 0x20) { |
356 | link->io.BasePort1 = j ^ 0x300; | 356 | link->io.BasePort1 = j ^ 0x300; |
357 | i = pcmcia_request_io(link, &link->io); | 357 | i = pcmcia_request_io(link, &link->io); |
358 | if (i == CS_SUCCESS) break; | 358 | if (i == 0) |
359 | break; | ||
359 | } | 360 | } |
360 | if (i != CS_SUCCESS) { | 361 | if (i != 0) { |
361 | cs_error(link, RequestIO, i); | 362 | cs_error(link, RequestIO, i); |
362 | goto failed; | 363 | goto failed; |
363 | } | 364 | } |
@@ -377,7 +378,7 @@ static int tc574_config(struct pcmcia_device *link) | |||
377 | tuple.TupleDataMax = 64; | 378 | tuple.TupleDataMax = 64; |
378 | tuple.TupleOffset = 0; | 379 | tuple.TupleOffset = 0; |
379 | tuple.DesiredTuple = 0x88; | 380 | tuple.DesiredTuple = 0x88; |
380 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { | 381 | if (pcmcia_get_first_tuple(link, &tuple) == 0) { |
381 | pcmcia_get_tuple_data(link, &tuple); | 382 | pcmcia_get_tuple_data(link, &tuple); |
382 | for (i = 0; i < 3; i++) | 383 | for (i = 0; i < 3; i++) |
383 | phys_addr[i] = htons(le16_to_cpu(buf[i])); | 384 | phys_addr[i] = htons(le16_to_cpu(buf[i])); |
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 549a64558420..0b28d0d8ffa8 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -278,9 +278,10 @@ static int tc589_config(struct pcmcia_device *link) | |||
278 | if (multi && (j & 0x80)) continue; | 278 | if (multi && (j & 0x80)) continue; |
279 | link->io.BasePort1 = j ^ 0x300; | 279 | link->io.BasePort1 = j ^ 0x300; |
280 | i = pcmcia_request_io(link, &link->io); | 280 | i = pcmcia_request_io(link, &link->io); |
281 | if (i == CS_SUCCESS) break; | 281 | if (i == 0) |
282 | break; | ||
282 | } | 283 | } |
283 | if (i != CS_SUCCESS) { | 284 | if (i != 0) { |
284 | cs_error(link, RequestIO, i); | 285 | cs_error(link, RequestIO, i); |
285 | goto failed; | 286 | goto failed; |
286 | } | 287 | } |
@@ -295,7 +296,7 @@ static int tc589_config(struct pcmcia_device *link) | |||
295 | /* The 3c589 has an extra EEPROM for configuration info, including | 296 | /* The 3c589 has an extra EEPROM for configuration info, including |
296 | the hardware address. The 3c562 puts the address in the CIS. */ | 297 | the hardware address. The 3c562 puts the address in the CIS. */ |
297 | tuple.DesiredTuple = 0x88; | 298 | tuple.DesiredTuple = 0x88; |
298 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { | 299 | if (pcmcia_get_first_tuple(link, &tuple) == 0) { |
299 | pcmcia_get_tuple_data(link, &tuple); | 300 | pcmcia_get_tuple_data(link, &tuple); |
300 | for (i = 0; i < 3; i++) | 301 | for (i = 0; i < 3; i++) |
301 | phys_addr[i] = htons(le16_to_cpu(buf[i])); | 302 | phys_addr[i] = htons(le16_to_cpu(buf[i])); |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 52bf11b73c6e..b37a498939ae 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -262,7 +262,7 @@ static int try_io_port(struct pcmcia_device *link) | |||
262 | if (link->io.NumPorts2 > 0) { | 262 | if (link->io.NumPorts2 > 0) { |
263 | /* for master/slave multifunction cards */ | 263 | /* for master/slave multifunction cards */ |
264 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 264 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; |
265 | link->irq.Attributes = | 265 | link->irq.Attributes = |
266 | IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; | 266 | IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; |
267 | } | 267 | } |
268 | } else { | 268 | } else { |
@@ -276,7 +276,8 @@ static int try_io_port(struct pcmcia_device *link) | |||
276 | link->io.BasePort1 = j ^ 0x300; | 276 | link->io.BasePort1 = j ^ 0x300; |
277 | link->io.BasePort2 = (j ^ 0x300) + 0x10; | 277 | link->io.BasePort2 = (j ^ 0x300) + 0x10; |
278 | ret = pcmcia_request_io(link, &link->io); | 278 | ret = pcmcia_request_io(link, &link->io); |
279 | if (ret == CS_SUCCESS) return ret; | 279 | if (ret == 0) |
280 | return ret; | ||
280 | } | 281 | } |
281 | return ret; | 282 | return ret; |
282 | } else { | 283 | } else { |
@@ -284,59 +285,50 @@ static int try_io_port(struct pcmcia_device *link) | |||
284 | } | 285 | } |
285 | } | 286 | } |
286 | 287 | ||
288 | static int axnet_configcheck(struct pcmcia_device *p_dev, | ||
289 | cistpl_cftable_entry_t *cfg, | ||
290 | cistpl_cftable_entry_t *dflt, | ||
291 | unsigned int vcc, | ||
292 | void *priv_data) | ||
293 | { | ||
294 | int i; | ||
295 | cistpl_io_t *io = &cfg->io; | ||
296 | |||
297 | if (cfg->index == 0 || cfg->io.nwin == 0) | ||
298 | return -ENODEV; | ||
299 | |||
300 | p_dev->conf.ConfigIndex = 0x05; | ||
301 | /* For multifunction cards, by convention, we configure the | ||
302 | network function with window 0, and serial with window 1 */ | ||
303 | if (io->nwin > 1) { | ||
304 | i = (io->win[1].len > io->win[0].len); | ||
305 | p_dev->io.BasePort2 = io->win[1-i].base; | ||
306 | p_dev->io.NumPorts2 = io->win[1-i].len; | ||
307 | } else { | ||
308 | i = p_dev->io.NumPorts2 = 0; | ||
309 | } | ||
310 | p_dev->io.BasePort1 = io->win[i].base; | ||
311 | p_dev->io.NumPorts1 = io->win[i].len; | ||
312 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
313 | if (p_dev->io.NumPorts1 + p_dev->io.NumPorts2 >= 32) | ||
314 | return try_io_port(p_dev); | ||
315 | |||
316 | return -ENODEV; | ||
317 | } | ||
318 | |||
287 | static int axnet_config(struct pcmcia_device *link) | 319 | static int axnet_config(struct pcmcia_device *link) |
288 | { | 320 | { |
289 | struct net_device *dev = link->priv; | 321 | struct net_device *dev = link->priv; |
290 | axnet_dev_t *info = PRIV(dev); | 322 | axnet_dev_t *info = PRIV(dev); |
291 | tuple_t tuple; | ||
292 | cisparse_t parse; | ||
293 | int i, j, last_ret, last_fn; | 323 | int i, j, last_ret, last_fn; |
294 | u_short buf[64]; | ||
295 | DECLARE_MAC_BUF(mac); | 324 | DECLARE_MAC_BUF(mac); |
296 | 325 | ||
297 | DEBUG(0, "axnet_config(0x%p)\n", link); | 326 | DEBUG(0, "axnet_config(0x%p)\n", link); |
298 | 327 | ||
299 | tuple.Attributes = 0; | ||
300 | tuple.TupleData = (cisdata_t *)buf; | ||
301 | tuple.TupleDataMax = sizeof(buf); | ||
302 | tuple.TupleOffset = 0; | ||
303 | |||
304 | /* don't trust the CIS on this; Linksys got it wrong */ | 328 | /* don't trust the CIS on this; Linksys got it wrong */ |
305 | link->conf.Present = 0x63; | 329 | link->conf.Present = 0x63; |
306 | 330 | last_ret = pcmcia_loop_config(link, axnet_configcheck, NULL); | |
307 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 331 | if (last_ret != 0) { |
308 | tuple.Attributes = 0; | ||
309 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
310 | while (last_ret == CS_SUCCESS) { | ||
311 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | ||
312 | cistpl_io_t *io = &(parse.cftable_entry.io); | ||
313 | |||
314 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || | ||
315 | pcmcia_parse_tuple(link, &tuple, &parse) != 0 || | ||
316 | cfg->index == 0 || cfg->io.nwin == 0) | ||
317 | goto next_entry; | ||
318 | |||
319 | link->conf.ConfigIndex = 0x05; | ||
320 | /* For multifunction cards, by convention, we configure the | ||
321 | network function with window 0, and serial with window 1 */ | ||
322 | if (io->nwin > 1) { | ||
323 | i = (io->win[1].len > io->win[0].len); | ||
324 | link->io.BasePort2 = io->win[1-i].base; | ||
325 | link->io.NumPorts2 = io->win[1-i].len; | ||
326 | } else { | ||
327 | i = link->io.NumPorts2 = 0; | ||
328 | } | ||
329 | link->io.BasePort1 = io->win[i].base; | ||
330 | link->io.NumPorts1 = io->win[i].len; | ||
331 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
332 | if (link->io.NumPorts1 + link->io.NumPorts2 >= 32) { | ||
333 | last_ret = try_io_port(link); | ||
334 | if (last_ret == CS_SUCCESS) break; | ||
335 | } | ||
336 | next_entry: | ||
337 | last_ret = pcmcia_get_next_tuple(link, &tuple); | ||
338 | } | ||
339 | if (last_ret != CS_SUCCESS) { | ||
340 | cs_error(link, RequestIO, last_ret); | 332 | cs_error(link, RequestIO, last_ret); |
341 | goto failed; | 333 | goto failed; |
342 | } | 334 | } |
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index ea9414c4d900..831090c75622 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c | |||
@@ -260,21 +260,21 @@ static int com20020_config(struct pcmcia_device *link) | |||
260 | DEBUG(0, "com20020_config(0x%p)\n", link); | 260 | DEBUG(0, "com20020_config(0x%p)\n", link); |
261 | 261 | ||
262 | DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1); | 262 | DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1); |
263 | i = !CS_SUCCESS; | 263 | i = -ENODEV; |
264 | if (!link->io.BasePort1) | 264 | if (!link->io.BasePort1) |
265 | { | 265 | { |
266 | for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10) | 266 | for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10) |
267 | { | 267 | { |
268 | link->io.BasePort1 = ioaddr; | 268 | link->io.BasePort1 = ioaddr; |
269 | i = pcmcia_request_io(link, &link->io); | 269 | i = pcmcia_request_io(link, &link->io); |
270 | if (i == CS_SUCCESS) | 270 | if (i == 0) |
271 | break; | 271 | break; |
272 | } | 272 | } |
273 | } | 273 | } |
274 | else | 274 | else |
275 | i = pcmcia_request_io(link, &link->io); | 275 | i = pcmcia_request_io(link, &link->io); |
276 | 276 | ||
277 | if (i != CS_SUCCESS) | 277 | if (i != 0) |
278 | { | 278 | { |
279 | DEBUG(1,"arcnet: requestIO failed totally!\n"); | 279 | DEBUG(1,"arcnet: requestIO failed totally!\n"); |
280 | goto failed; | 280 | goto failed; |
@@ -287,7 +287,7 @@ static int com20020_config(struct pcmcia_device *link) | |||
287 | link->irq.AssignedIRQ, | 287 | link->irq.AssignedIRQ, |
288 | link->irq.IRQInfo1, link->irq.IRQInfo2); | 288 | link->irq.IRQInfo1, link->irq.IRQInfo2); |
289 | i = pcmcia_request_irq(link, &link->irq); | 289 | i = pcmcia_request_irq(link, &link->irq); |
290 | if (i != CS_SUCCESS) | 290 | if (i != 0) |
291 | { | 291 | { |
292 | DEBUG(1,"arcnet: requestIRQ failed totally!\n"); | 292 | DEBUG(1,"arcnet: requestIRQ failed totally!\n"); |
293 | goto failed; | 293 | goto failed; |
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index a550c9bd126f..69d916daa7bb 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c | |||
@@ -309,7 +309,8 @@ static int mfc_try_io_port(struct pcmcia_device *link) | |||
309 | printk(KERN_NOTICE "fmvj18x_cs: out of resource for serial\n"); | 309 | printk(KERN_NOTICE "fmvj18x_cs: out of resource for serial\n"); |
310 | } | 310 | } |
311 | ret = pcmcia_request_io(link, &link->io); | 311 | ret = pcmcia_request_io(link, &link->io); |
312 | if (ret == CS_SUCCESS) return ret; | 312 | if (ret == 0) |
313 | return ret; | ||
313 | } | 314 | } |
314 | return ret; | 315 | return ret; |
315 | } | 316 | } |
@@ -325,7 +326,7 @@ static int ungermann_try_io_port(struct pcmcia_device *link) | |||
325 | for (ioaddr = 0x300; ioaddr < 0x3e0; ioaddr += 0x20) { | 326 | for (ioaddr = 0x300; ioaddr < 0x3e0; ioaddr += 0x20) { |
326 | link->io.BasePort1 = ioaddr; | 327 | link->io.BasePort1 = ioaddr; |
327 | ret = pcmcia_request_io(link, &link->io); | 328 | ret = pcmcia_request_io(link, &link->io); |
328 | if (ret == CS_SUCCESS) { | 329 | if (ret == 0) { |
329 | /* calculate ConfigIndex value */ | 330 | /* calculate ConfigIndex value */ |
330 | link->conf.ConfigIndex = | 331 | link->conf.ConfigIndex = |
331 | ((link->io.BasePort1 & 0x0f0) >> 3) | 0x22; | 332 | ((link->io.BasePort1 & 0x0f0) >> 3) | 0x22; |
@@ -356,12 +357,12 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
356 | tuple.TupleOffset = 0; | 357 | tuple.TupleOffset = 0; |
357 | tuple.DesiredTuple = CISTPL_FUNCE; | 358 | tuple.DesiredTuple = CISTPL_FUNCE; |
358 | tuple.TupleOffset = 0; | 359 | tuple.TupleOffset = 0; |
359 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { | 360 | if (pcmcia_get_first_tuple(link, &tuple) == 0) { |
360 | /* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */ | 361 | /* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */ |
361 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 362 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
362 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 363 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
363 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | 364 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
364 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 365 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(&tuple, &parse)); |
365 | link->conf.ConfigIndex = parse.cftable_entry.index; | 366 | link->conf.ConfigIndex = parse.cftable_entry.index; |
366 | switch (link->manf_id) { | 367 | switch (link->manf_id) { |
367 | case MANFID_TDK: | 368 | case MANFID_TDK: |
@@ -430,10 +431,10 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
430 | link->irq.Attributes = | 431 | link->irq.Attributes = |
431 | IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED|IRQ_HANDLE_PRESENT; | 432 | IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED|IRQ_HANDLE_PRESENT; |
432 | ret = mfc_try_io_port(link); | 433 | ret = mfc_try_io_port(link); |
433 | if (ret != CS_SUCCESS) goto cs_failed; | 434 | if (ret != 0) goto cs_failed; |
434 | } else if (cardtype == UNGERMANN) { | 435 | } else if (cardtype == UNGERMANN) { |
435 | ret = ungermann_try_io_port(link); | 436 | ret = ungermann_try_io_port(link); |
436 | if (ret != CS_SUCCESS) goto cs_failed; | 437 | if (ret != 0) goto cs_failed; |
437 | } else { | 438 | } else { |
438 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); | 439 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); |
439 | } | 440 | } |
@@ -565,7 +566,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) | |||
565 | req.Base = 0; req.Size = 0; | 566 | req.Base = 0; req.Size = 0; |
566 | req.AccessSpeed = 0; | 567 | req.AccessSpeed = 0; |
567 | i = pcmcia_request_window(&link, &req, &link->win); | 568 | i = pcmcia_request_window(&link, &req, &link->win); |
568 | if (i != CS_SUCCESS) { | 569 | if (i != 0) { |
569 | cs_error(link, RequestWindow, i); | 570 | cs_error(link, RequestWindow, i); |
570 | return -1; | 571 | return -1; |
571 | } | 572 | } |
@@ -599,7 +600,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) | |||
599 | 600 | ||
600 | iounmap(base); | 601 | iounmap(base); |
601 | j = pcmcia_release_window(link->win); | 602 | j = pcmcia_release_window(link->win); |
602 | if (j != CS_SUCCESS) | 603 | if (j != 0) |
603 | cs_error(link, ReleaseWindow, j); | 604 | cs_error(link, ReleaseWindow, j); |
604 | return (i != 0x200) ? 0 : -1; | 605 | return (i != 0x200) ? 0 : -1; |
605 | 606 | ||
@@ -620,7 +621,7 @@ static int fmvj18x_setup_mfc(struct pcmcia_device *link) | |||
620 | req.Base = 0; req.Size = 0; | 621 | req.Base = 0; req.Size = 0; |
621 | req.AccessSpeed = 0; | 622 | req.AccessSpeed = 0; |
622 | i = pcmcia_request_window(&link, &req, &link->win); | 623 | i = pcmcia_request_window(&link, &req, &link->win); |
623 | if (i != CS_SUCCESS) { | 624 | if (i != 0) { |
624 | cs_error(link, RequestWindow, i); | 625 | cs_error(link, RequestWindow, i); |
625 | return -1; | 626 | return -1; |
626 | } | 627 | } |
@@ -642,7 +643,7 @@ static int fmvj18x_setup_mfc(struct pcmcia_device *link) | |||
642 | 643 | ||
643 | iounmap(base); | 644 | iounmap(base); |
644 | j = pcmcia_release_window(link->win); | 645 | j = pcmcia_release_window(link->win); |
645 | if (j != CS_SUCCESS) | 646 | if (j != 0) |
646 | cs_error(link, ReleaseWindow, j); | 647 | cs_error(link, ReleaseWindow, j); |
647 | return 0; | 648 | return 0; |
648 | 649 | ||
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index 4eafa4f42cff..cf3cca4642f2 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c | |||
@@ -238,7 +238,7 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
238 | /* Try PRIMARY card at 0xA20-0xA23 */ | 238 | /* Try PRIMARY card at 0xA20-0xA23 */ |
239 | link->io.BasePort1 = 0xA20; | 239 | link->io.BasePort1 = 0xA20; |
240 | i = pcmcia_request_io(link, &link->io); | 240 | i = pcmcia_request_io(link, &link->io); |
241 | if (i != CS_SUCCESS) { | 241 | if (i != 0) { |
242 | /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ | 242 | /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ |
243 | link->io.BasePort1 = 0xA24; | 243 | link->io.BasePort1 = 0xA24; |
244 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); | 244 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index cfcbea9b7e2e..54df34f21c5f 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -925,7 +925,7 @@ static void mace_tx_timeout(struct net_device *dev) | |||
925 | printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name); | 925 | printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name); |
926 | #if RESET_ON_TIMEOUT | 926 | #if RESET_ON_TIMEOUT |
927 | printk("resetting card\n"); | 927 | printk("resetting card\n"); |
928 | pcmcia_reset_card(link, NULL); | 928 | pcmcia_reset_card(link->socket); |
929 | #else /* #if RESET_ON_TIMEOUT */ | 929 | #else /* #if RESET_ON_TIMEOUT */ |
930 | printk("NOT resetting card\n"); | 930 | printk("NOT resetting card\n"); |
931 | #endif /* #if RESET_ON_TIMEOUT */ | 931 | #endif /* #if RESET_ON_TIMEOUT */ |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index ebc1ae6bcbe5..e40d6301aa7a 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -310,7 +310,7 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link) | |||
310 | req.Base = 0; req.Size = 0; | 310 | req.Base = 0; req.Size = 0; |
311 | req.AccessSpeed = 0; | 311 | req.AccessSpeed = 0; |
312 | i = pcmcia_request_window(&link, &req, &link->win); | 312 | i = pcmcia_request_window(&link, &req, &link->win); |
313 | if (i != CS_SUCCESS) { | 313 | if (i != 0) { |
314 | cs_error(link, RequestWindow, i); | 314 | cs_error(link, RequestWindow, i); |
315 | return NULL; | 315 | return NULL; |
316 | } | 316 | } |
@@ -333,7 +333,7 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link) | |||
333 | 333 | ||
334 | iounmap(virt); | 334 | iounmap(virt); |
335 | j = pcmcia_release_window(link->win); | 335 | j = pcmcia_release_window(link->win); |
336 | if (j != CS_SUCCESS) | 336 | if (j != 0) |
337 | cs_error(link, ReleaseWindow, j); | 337 | cs_error(link, ReleaseWindow, j); |
338 | return (i < NR_INFO) ? hw_info+i : NULL; | 338 | return (i < NR_INFO) ? hw_info+i : NULL; |
339 | } /* get_hwinfo */ | 339 | } /* get_hwinfo */ |
@@ -504,7 +504,8 @@ static int try_io_port(struct pcmcia_device *link) | |||
504 | link->io.BasePort1 = j ^ 0x300; | 504 | link->io.BasePort1 = j ^ 0x300; |
505 | link->io.BasePort2 = (j ^ 0x300) + 0x10; | 505 | link->io.BasePort2 = (j ^ 0x300) + 0x10; |
506 | ret = pcmcia_request_io(link, &link->io); | 506 | ret = pcmcia_request_io(link, &link->io); |
507 | if (ret == CS_SUCCESS) return ret; | 507 | if (ret == 0) |
508 | return ret; | ||
508 | } | 509 | } |
509 | return ret; | 510 | return ret; |
510 | } else { | 511 | } else { |
@@ -512,58 +513,53 @@ static int try_io_port(struct pcmcia_device *link) | |||
512 | } | 513 | } |
513 | } | 514 | } |
514 | 515 | ||
516 | static int pcnet_confcheck(struct pcmcia_device *p_dev, | ||
517 | cistpl_cftable_entry_t *cfg, | ||
518 | cistpl_cftable_entry_t *dflt, | ||
519 | unsigned int vcc, | ||
520 | void *priv_data) | ||
521 | { | ||
522 | int *has_shmem = priv_data; | ||
523 | int i; | ||
524 | cistpl_io_t *io = &cfg->io; | ||
525 | |||
526 | if (cfg->index == 0 || cfg->io.nwin == 0) | ||
527 | return -EINVAL; | ||
528 | |||
529 | /* For multifunction cards, by convention, we configure the | ||
530 | network function with window 0, and serial with window 1 */ | ||
531 | if (io->nwin > 1) { | ||
532 | i = (io->win[1].len > io->win[0].len); | ||
533 | p_dev->io.BasePort2 = io->win[1-i].base; | ||
534 | p_dev->io.NumPorts2 = io->win[1-i].len; | ||
535 | } else { | ||
536 | i = p_dev->io.NumPorts2 = 0; | ||
537 | } | ||
538 | |||
539 | *has_shmem = ((cfg->mem.nwin == 1) && | ||
540 | (cfg->mem.win[0].len >= 0x4000)); | ||
541 | p_dev->io.BasePort1 = io->win[i].base; | ||
542 | p_dev->io.NumPorts1 = io->win[i].len; | ||
543 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
544 | if (p_dev->io.NumPorts1 + p_dev->io.NumPorts2 >= 32) | ||
545 | return try_io_port(p_dev); | ||
546 | |||
547 | return 0; | ||
548 | } | ||
549 | |||
515 | static int pcnet_config(struct pcmcia_device *link) | 550 | static int pcnet_config(struct pcmcia_device *link) |
516 | { | 551 | { |
517 | struct net_device *dev = link->priv; | 552 | struct net_device *dev = link->priv; |
518 | pcnet_dev_t *info = PRIV(dev); | 553 | pcnet_dev_t *info = PRIV(dev); |
519 | tuple_t tuple; | 554 | int last_ret, last_fn, start_pg, stop_pg, cm_offset; |
520 | cisparse_t parse; | ||
521 | int i, last_ret, last_fn, start_pg, stop_pg, cm_offset; | ||
522 | int has_shmem = 0; | 555 | int has_shmem = 0; |
523 | u_short buf[64]; | ||
524 | hw_info_t *local_hw_info; | 556 | hw_info_t *local_hw_info; |
525 | DECLARE_MAC_BUF(mac); | 557 | DECLARE_MAC_BUF(mac); |
526 | 558 | ||
527 | DEBUG(0, "pcnet_config(0x%p)\n", link); | 559 | DEBUG(0, "pcnet_config(0x%p)\n", link); |
528 | 560 | ||
529 | tuple.TupleData = (cisdata_t *)buf; | 561 | last_ret = pcmcia_loop_config(link, pcnet_confcheck, &has_shmem); |
530 | tuple.TupleDataMax = sizeof(buf); | 562 | if (last_ret) { |
531 | tuple.TupleOffset = 0; | ||
532 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
533 | tuple.Attributes = 0; | ||
534 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
535 | while (last_ret == CS_SUCCESS) { | ||
536 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | ||
537 | cistpl_io_t *io = &(parse.cftable_entry.io); | ||
538 | |||
539 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || | ||
540 | pcmcia_parse_tuple(link, &tuple, &parse) != 0 || | ||
541 | cfg->index == 0 || cfg->io.nwin == 0) | ||
542 | goto next_entry; | ||
543 | |||
544 | link->conf.ConfigIndex = cfg->index; | ||
545 | /* For multifunction cards, by convention, we configure the | ||
546 | network function with window 0, and serial with window 1 */ | ||
547 | if (io->nwin > 1) { | ||
548 | i = (io->win[1].len > io->win[0].len); | ||
549 | link->io.BasePort2 = io->win[1-i].base; | ||
550 | link->io.NumPorts2 = io->win[1-i].len; | ||
551 | } else { | ||
552 | i = link->io.NumPorts2 = 0; | ||
553 | } | ||
554 | has_shmem = ((cfg->mem.nwin == 1) && | ||
555 | (cfg->mem.win[0].len >= 0x4000)); | ||
556 | link->io.BasePort1 = io->win[i].base; | ||
557 | link->io.NumPorts1 = io->win[i].len; | ||
558 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
559 | if (link->io.NumPorts1 + link->io.NumPorts2 >= 32) { | ||
560 | last_ret = try_io_port(link); | ||
561 | if (last_ret == CS_SUCCESS) break; | ||
562 | } | ||
563 | next_entry: | ||
564 | last_ret = pcmcia_get_next_tuple(link, &tuple); | ||
565 | } | ||
566 | if (last_ret != CS_SUCCESS) { | ||
567 | cs_error(link, RequestIO, last_ret); | 563 | cs_error(link, RequestIO, last_ret); |
568 | goto failed; | 564 | goto failed; |
569 | } | 565 | } |
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 250eb1954c34..c74d6656d266 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -409,10 +409,13 @@ static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, | |||
409 | { | 409 | { |
410 | int i; | 410 | int i; |
411 | 411 | ||
412 | if ((i = pcmcia_get_first_tuple(handle, tuple)) != CS_SUCCESS || | 412 | i = pcmcia_get_first_tuple(handle, tuple); |
413 | (i = pcmcia_get_tuple_data(handle, tuple)) != CS_SUCCESS) | 413 | if (i != 0) |
414 | return i; | 414 | return i; |
415 | return pcmcia_parse_tuple(handle, tuple, parse); | 415 | i = pcmcia_get_tuple_data(handle, tuple); |
416 | if (i != 0) | ||
417 | return i; | ||
418 | return pcmcia_parse_tuple(tuple, parse); | ||
416 | } | 419 | } |
417 | 420 | ||
418 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, | 421 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, |
@@ -420,10 +423,10 @@ static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, | |||
420 | { | 423 | { |
421 | int i; | 424 | int i; |
422 | 425 | ||
423 | if ((i = pcmcia_get_next_tuple(handle, tuple)) != CS_SUCCESS || | 426 | if ((i = pcmcia_get_next_tuple(handle, tuple)) != 0 || |
424 | (i = pcmcia_get_tuple_data(handle, tuple)) != CS_SUCCESS) | 427 | (i = pcmcia_get_tuple_data(handle, tuple)) != 0) |
425 | return i; | 428 | return i; |
426 | return pcmcia_parse_tuple(handle, tuple, parse); | 429 | return pcmcia_parse_tuple(tuple, parse); |
427 | } | 430 | } |
428 | 431 | ||
429 | /*====================================================================== | 432 | /*====================================================================== |
@@ -459,27 +462,36 @@ static int mhz_3288_power(struct pcmcia_device *link) | |||
459 | return 0; | 462 | return 0; |
460 | } | 463 | } |
461 | 464 | ||
465 | static int mhz_mfc_config_check(struct pcmcia_device *p_dev, | ||
466 | cistpl_cftable_entry_t *cf, | ||
467 | cistpl_cftable_entry_t *dflt, | ||
468 | unsigned int vcc, | ||
469 | void *priv_data) | ||
470 | { | ||
471 | int k; | ||
472 | p_dev->io.BasePort2 = cf->io.win[0].base; | ||
473 | for (k = 0; k < 0x400; k += 0x10) { | ||
474 | if (k & 0x80) | ||
475 | continue; | ||
476 | p_dev->io.BasePort1 = k ^ 0x300; | ||
477 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | ||
478 | return 0; | ||
479 | } | ||
480 | return -ENODEV; | ||
481 | } | ||
482 | |||
462 | static int mhz_mfc_config(struct pcmcia_device *link) | 483 | static int mhz_mfc_config(struct pcmcia_device *link) |
463 | { | 484 | { |
464 | struct net_device *dev = link->priv; | 485 | struct net_device *dev = link->priv; |
465 | struct smc_private *smc = netdev_priv(dev); | 486 | struct smc_private *smc = netdev_priv(dev); |
466 | struct smc_cfg_mem *cfg_mem; | 487 | struct smc_cfg_mem *cfg_mem; |
467 | tuple_t *tuple; | ||
468 | cisparse_t *parse; | ||
469 | cistpl_cftable_entry_t *cf; | ||
470 | u_char *buf; | ||
471 | win_req_t req; | 488 | win_req_t req; |
472 | memreq_t mem; | 489 | memreq_t mem; |
473 | int i, k; | 490 | int i; |
474 | 491 | ||
475 | cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL); | 492 | cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL); |
476 | if (!cfg_mem) | 493 | if (!cfg_mem) |
477 | return CS_OUT_OF_RESOURCE; | 494 | return -ENOMEM; |
478 | |||
479 | tuple = &cfg_mem->tuple; | ||
480 | parse = &cfg_mem->parse; | ||
481 | cf = &parse->cftable_entry; | ||
482 | buf = cfg_mem->buf; | ||
483 | 495 | ||
484 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 496 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
485 | link->conf.Status = CCSR_AUDIO_ENA; | 497 | link->conf.Status = CCSR_AUDIO_ENA; |
@@ -489,27 +501,9 @@ static int mhz_mfc_config(struct pcmcia_device *link) | |||
489 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 501 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; |
490 | link->io.NumPorts2 = 8; | 502 | link->io.NumPorts2 = 8; |
491 | 503 | ||
492 | tuple->Attributes = tuple->TupleOffset = 0; | ||
493 | tuple->TupleData = (cisdata_t *)buf; | ||
494 | tuple->TupleDataMax = 255; | ||
495 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
496 | |||
497 | i = first_tuple(link, tuple, parse); | ||
498 | /* The Megahertz combo cards have modem-like CIS entries, so | 504 | /* The Megahertz combo cards have modem-like CIS entries, so |
499 | we have to explicitly try a bunch of port combinations. */ | 505 | we have to explicitly try a bunch of port combinations. */ |
500 | while (i == CS_SUCCESS) { | 506 | if (pcmcia_loop_config(link, mhz_mfc_config_check, NULL)) |
501 | link->conf.ConfigIndex = cf->index; | ||
502 | link->io.BasePort2 = cf->io.win[0].base; | ||
503 | for (k = 0; k < 0x400; k += 0x10) { | ||
504 | if (k & 0x80) continue; | ||
505 | link->io.BasePort1 = k ^ 0x300; | ||
506 | i = pcmcia_request_io(link, &link->io); | ||
507 | if (i == CS_SUCCESS) break; | ||
508 | } | ||
509 | if (i == CS_SUCCESS) break; | ||
510 | i = next_tuple(link, tuple, parse); | ||
511 | } | ||
512 | if (i != CS_SUCCESS) | ||
513 | goto free_cfg_mem; | 507 | goto free_cfg_mem; |
514 | dev->base_addr = link->io.BasePort1; | 508 | dev->base_addr = link->io.BasePort1; |
515 | 509 | ||
@@ -518,7 +512,7 @@ static int mhz_mfc_config(struct pcmcia_device *link) | |||
518 | req.Base = req.Size = 0; | 512 | req.Base = req.Size = 0; |
519 | req.AccessSpeed = 0; | 513 | req.AccessSpeed = 0; |
520 | i = pcmcia_request_window(&link, &req, &link->win); | 514 | i = pcmcia_request_window(&link, &req, &link->win); |
521 | if (i != CS_SUCCESS) | 515 | if (i != 0) |
522 | goto free_cfg_mem; | 516 | goto free_cfg_mem; |
523 | smc->base = ioremap(req.Base, req.Size); | 517 | smc->base = ioremap(req.Base, req.Size); |
524 | mem.CardOffset = mem.Page = 0; | 518 | mem.CardOffset = mem.Page = 0; |
@@ -526,14 +520,14 @@ static int mhz_mfc_config(struct pcmcia_device *link) | |||
526 | mem.CardOffset = link->conf.ConfigBase; | 520 | mem.CardOffset = link->conf.ConfigBase; |
527 | i = pcmcia_map_mem_page(link->win, &mem); | 521 | i = pcmcia_map_mem_page(link->win, &mem); |
528 | 522 | ||
529 | if ((i == CS_SUCCESS) | 523 | if ((i == 0) |
530 | && (smc->manfid == MANFID_MEGAHERTZ) | 524 | && (smc->manfid == MANFID_MEGAHERTZ) |
531 | && (smc->cardid == PRODID_MEGAHERTZ_EM3288)) | 525 | && (smc->cardid == PRODID_MEGAHERTZ_EM3288)) |
532 | mhz_3288_power(link); | 526 | mhz_3288_power(link); |
533 | 527 | ||
534 | free_cfg_mem: | 528 | free_cfg_mem: |
535 | kfree(cfg_mem); | 529 | kfree(cfg_mem); |
536 | return i; | 530 | return -ENODEV; |
537 | } | 531 | } |
538 | 532 | ||
539 | static int mhz_setup(struct pcmcia_device *link) | 533 | static int mhz_setup(struct pcmcia_device *link) |
@@ -560,12 +554,12 @@ static int mhz_setup(struct pcmcia_device *link) | |||
560 | /* Read the station address from the CIS. It is stored as the last | 554 | /* Read the station address from the CIS. It is stored as the last |
561 | (fourth) string in the Version 1 Version/ID tuple. */ | 555 | (fourth) string in the Version 1 Version/ID tuple. */ |
562 | tuple->DesiredTuple = CISTPL_VERS_1; | 556 | tuple->DesiredTuple = CISTPL_VERS_1; |
563 | if (first_tuple(link, tuple, parse) != CS_SUCCESS) { | 557 | if (first_tuple(link, tuple, parse) != 0) { |
564 | rc = -1; | 558 | rc = -1; |
565 | goto free_cfg_mem; | 559 | goto free_cfg_mem; |
566 | } | 560 | } |
567 | /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */ | 561 | /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */ |
568 | if (next_tuple(link, tuple, parse) != CS_SUCCESS) | 562 | if (next_tuple(link, tuple, parse) != 0) |
569 | first_tuple(link, tuple, parse); | 563 | first_tuple(link, tuple, parse); |
570 | if (parse->version_1.ns > 3) { | 564 | if (parse->version_1.ns > 3) { |
571 | station_addr = parse->version_1.str + parse->version_1.ofs[3]; | 565 | station_addr = parse->version_1.str + parse->version_1.ofs[3]; |
@@ -577,11 +571,11 @@ static int mhz_setup(struct pcmcia_device *link) | |||
577 | 571 | ||
578 | /* Another possibility: for the EM3288, in a special tuple */ | 572 | /* Another possibility: for the EM3288, in a special tuple */ |
579 | tuple->DesiredTuple = 0x81; | 573 | tuple->DesiredTuple = 0x81; |
580 | if (pcmcia_get_first_tuple(link, tuple) != CS_SUCCESS) { | 574 | if (pcmcia_get_first_tuple(link, tuple) != 0) { |
581 | rc = -1; | 575 | rc = -1; |
582 | goto free_cfg_mem; | 576 | goto free_cfg_mem; |
583 | } | 577 | } |
584 | if (pcmcia_get_tuple_data(link, tuple) != CS_SUCCESS) { | 578 | if (pcmcia_get_tuple_data(link, tuple) != 0) { |
585 | rc = -1; | 579 | rc = -1; |
586 | goto free_cfg_mem; | 580 | goto free_cfg_mem; |
587 | } | 581 | } |
@@ -660,46 +654,27 @@ static int mot_setup(struct pcmcia_device *link) | |||
660 | 654 | ||
661 | /*====================================================================*/ | 655 | /*====================================================================*/ |
662 | 656 | ||
657 | static int smc_configcheck(struct pcmcia_device *p_dev, | ||
658 | cistpl_cftable_entry_t *cf, | ||
659 | cistpl_cftable_entry_t *dflt, | ||
660 | unsigned int vcc, | ||
661 | void *priv_data) | ||
662 | { | ||
663 | p_dev->io.BasePort1 = cf->io.win[0].base; | ||
664 | p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; | ||
665 | return pcmcia_request_io(p_dev, &p_dev->io); | ||
666 | } | ||
667 | |||
663 | static int smc_config(struct pcmcia_device *link) | 668 | static int smc_config(struct pcmcia_device *link) |
664 | { | 669 | { |
665 | struct net_device *dev = link->priv; | 670 | struct net_device *dev = link->priv; |
666 | struct smc_cfg_mem *cfg_mem; | ||
667 | tuple_t *tuple; | ||
668 | cisparse_t *parse; | ||
669 | cistpl_cftable_entry_t *cf; | ||
670 | u_char *buf; | ||
671 | int i; | 671 | int i; |
672 | 672 | ||
673 | cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL); | ||
674 | if (!cfg_mem) | ||
675 | return CS_OUT_OF_RESOURCE; | ||
676 | |||
677 | tuple = &cfg_mem->tuple; | ||
678 | parse = &cfg_mem->parse; | ||
679 | cf = &parse->cftable_entry; | ||
680 | buf = cfg_mem->buf; | ||
681 | |||
682 | tuple->Attributes = tuple->TupleOffset = 0; | ||
683 | tuple->TupleData = (cisdata_t *)buf; | ||
684 | tuple->TupleDataMax = 255; | ||
685 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
686 | |||
687 | link->io.NumPorts1 = 16; | 673 | link->io.NumPorts1 = 16; |
688 | i = first_tuple(link, tuple, parse); | 674 | i = pcmcia_loop_config(link, smc_configcheck, NULL); |
689 | while (i != CS_NO_MORE_ITEMS) { | 675 | if (!i) |
690 | if (i == CS_SUCCESS) { | 676 | dev->base_addr = link->io.BasePort1; |
691 | link->conf.ConfigIndex = cf->index; | ||
692 | link->io.BasePort1 = cf->io.win[0].base; | ||
693 | link->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; | ||
694 | i = pcmcia_request_io(link, &link->io); | ||
695 | if (i == CS_SUCCESS) break; | ||
696 | } | ||
697 | i = next_tuple(link, tuple, parse); | ||
698 | } | ||
699 | if (i == CS_SUCCESS) | ||
700 | dev->base_addr = link->io.BasePort1; | ||
701 | 677 | ||
702 | kfree(cfg_mem); | ||
703 | return i; | 678 | return i; |
704 | } | 679 | } |
705 | 680 | ||
@@ -715,7 +690,7 @@ static int smc_setup(struct pcmcia_device *link) | |||
715 | 690 | ||
716 | cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL); | 691 | cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL); |
717 | if (!cfg_mem) | 692 | if (!cfg_mem) |
718 | return CS_OUT_OF_RESOURCE; | 693 | return -ENOMEM; |
719 | 694 | ||
720 | tuple = &cfg_mem->tuple; | 695 | tuple = &cfg_mem->tuple; |
721 | parse = &cfg_mem->parse; | 696 | parse = &cfg_mem->parse; |
@@ -728,12 +703,12 @@ static int smc_setup(struct pcmcia_device *link) | |||
728 | /* Check for a LAN function extension tuple */ | 703 | /* Check for a LAN function extension tuple */ |
729 | tuple->DesiredTuple = CISTPL_FUNCE; | 704 | tuple->DesiredTuple = CISTPL_FUNCE; |
730 | i = first_tuple(link, tuple, parse); | 705 | i = first_tuple(link, tuple, parse); |
731 | while (i == CS_SUCCESS) { | 706 | while (i == 0) { |
732 | if (parse->funce.type == CISTPL_FUNCE_LAN_NODE_ID) | 707 | if (parse->funce.type == CISTPL_FUNCE_LAN_NODE_ID) |
733 | break; | 708 | break; |
734 | i = next_tuple(link, tuple, parse); | 709 | i = next_tuple(link, tuple, parse); |
735 | } | 710 | } |
736 | if (i == CS_SUCCESS) { | 711 | if (i == 0) { |
737 | node_id = (cistpl_lan_node_id_t *)parse->funce.data; | 712 | node_id = (cistpl_lan_node_id_t *)parse->funce.data; |
738 | if (node_id->nb == 6) { | 713 | if (node_id->nb == 6) { |
739 | for (i = 0; i < 6; i++) | 714 | for (i = 0; i < 6; i++) |
@@ -780,9 +755,10 @@ static int osi_config(struct pcmcia_device *link) | |||
780 | for (i = j = 0; j < 4; j++) { | 755 | for (i = j = 0; j < 4; j++) { |
781 | link->io.BasePort2 = com[j]; | 756 | link->io.BasePort2 = com[j]; |
782 | i = pcmcia_request_io(link, &link->io); | 757 | i = pcmcia_request_io(link, &link->io); |
783 | if (i == CS_SUCCESS) break; | 758 | if (i == 0) |
759 | break; | ||
784 | } | 760 | } |
785 | if (i != CS_SUCCESS) { | 761 | if (i != 0) { |
786 | /* Fallback: turn off hard decode */ | 762 | /* Fallback: turn off hard decode */ |
787 | link->conf.ConfigIndex = 0x03; | 763 | link->conf.ConfigIndex = 0x03; |
788 | link->io.NumPorts2 = 0; | 764 | link->io.NumPorts2 = 0; |
@@ -815,13 +791,13 @@ static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid) | |||
815 | /* Read the station address from tuple 0x90, subtuple 0x04 */ | 791 | /* Read the station address from tuple 0x90, subtuple 0x04 */ |
816 | tuple->DesiredTuple = 0x90; | 792 | tuple->DesiredTuple = 0x90; |
817 | i = pcmcia_get_first_tuple(link, tuple); | 793 | i = pcmcia_get_first_tuple(link, tuple); |
818 | while (i == CS_SUCCESS) { | 794 | while (i == 0) { |
819 | i = pcmcia_get_tuple_data(link, tuple); | 795 | i = pcmcia_get_tuple_data(link, tuple); |
820 | if ((i != CS_SUCCESS) || (buf[0] == 0x04)) | 796 | if ((i != 0) || (buf[0] == 0x04)) |
821 | break; | 797 | break; |
822 | i = pcmcia_get_next_tuple(link, tuple); | 798 | i = pcmcia_get_next_tuple(link, tuple); |
823 | } | 799 | } |
824 | if (i != CS_SUCCESS) { | 800 | if (i != 0) { |
825 | rc = -1; | 801 | rc = -1; |
826 | goto free_cfg_mem; | 802 | goto free_cfg_mem; |
827 | } | 803 | } |
@@ -959,8 +935,11 @@ static int check_sig(struct pcmcia_device *link) | |||
959 | 935 | ||
960 | ======================================================================*/ | 936 | ======================================================================*/ |
961 | 937 | ||
962 | #define CS_EXIT_TEST(ret, svc, label) \ | 938 | #define CS_EXIT_TEST(ret, svc, label) \ |
963 | if (ret != CS_SUCCESS) { cs_error(link, svc, ret); goto label; } | 939 | if (ret != 0) { \ |
940 | cs_error(link, svc, ret); \ | ||
941 | goto label; \ | ||
942 | } | ||
964 | 943 | ||
965 | static int smc91c92_config(struct pcmcia_device *link) | 944 | static int smc91c92_config(struct pcmcia_device *link) |
966 | { | 945 | { |
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index c33a3d523566..e1fd585e7131 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -377,7 +377,7 @@ first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | |||
377 | 377 | ||
378 | if ((err = pcmcia_get_first_tuple(handle, tuple)) == 0 && | 378 | if ((err = pcmcia_get_first_tuple(handle, tuple)) == 0 && |
379 | (err = pcmcia_get_tuple_data(handle, tuple)) == 0) | 379 | (err = pcmcia_get_tuple_data(handle, tuple)) == 0) |
380 | err = pcmcia_parse_tuple(handle, tuple, parse); | 380 | err = pcmcia_parse_tuple(tuple, parse); |
381 | return err; | 381 | return err; |
382 | } | 382 | } |
383 | 383 | ||
@@ -388,7 +388,7 @@ next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | |||
388 | 388 | ||
389 | if ((err = pcmcia_get_next_tuple(handle, tuple)) == 0 && | 389 | if ((err = pcmcia_get_next_tuple(handle, tuple)) == 0 && |
390 | (err = pcmcia_get_tuple_data(handle, tuple)) == 0) | 390 | (err = pcmcia_get_tuple_data(handle, tuple)) == 0) |
391 | err = pcmcia_parse_tuple(handle, tuple, parse); | 391 | err = pcmcia_parse_tuple(tuple, parse); |
392 | return err; | 392 | return err; |
393 | } | 393 | } |
394 | 394 | ||
@@ -715,6 +715,47 @@ has_ce2_string(struct pcmcia_device * p_dev) | |||
715 | return 0; | 715 | return 0; |
716 | } | 716 | } |
717 | 717 | ||
718 | static int | ||
719 | xirc2ps_config_modem(struct pcmcia_device *p_dev, | ||
720 | cistpl_cftable_entry_t *cf, | ||
721 | cistpl_cftable_entry_t *dflt, | ||
722 | unsigned int vcc, | ||
723 | void *priv_data) | ||
724 | { | ||
725 | unsigned int ioaddr; | ||
726 | |||
727 | if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { | ||
728 | for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { | ||
729 | p_dev->io.BasePort2 = cf->io.win[0].base; | ||
730 | p_dev->io.BasePort1 = ioaddr; | ||
731 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | ||
732 | return 0; | ||
733 | } | ||
734 | } | ||
735 | return -ENODEV; | ||
736 | } | ||
737 | |||
738 | static int | ||
739 | xirc2ps_config_check(struct pcmcia_device *p_dev, | ||
740 | cistpl_cftable_entry_t *cf, | ||
741 | cistpl_cftable_entry_t *dflt, | ||
742 | unsigned int vcc, | ||
743 | void *priv_data) | ||
744 | { | ||
745 | int *pass = priv_data; | ||
746 | |||
747 | if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { | ||
748 | p_dev->io.BasePort2 = cf->io.win[0].base; | ||
749 | p_dev->io.BasePort1 = p_dev->io.BasePort2 | ||
750 | + (*pass ? (cf->index & 0x20 ? -24:8) | ||
751 | : (cf->index & 0x20 ? 8:-24)); | ||
752 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | ||
753 | return 0; | ||
754 | } | ||
755 | return -ENODEV; | ||
756 | |||
757 | } | ||
758 | |||
718 | /**************** | 759 | /**************** |
719 | * xirc2ps_config() is scheduled to run after a CARD_INSERTION event | 760 | * xirc2ps_config() is scheduled to run after a CARD_INSERTION event |
720 | * is received, to configure the PCMCIA socket, and to make the | 761 | * is received, to configure the PCMCIA socket, and to make the |
@@ -725,13 +766,12 @@ xirc2ps_config(struct pcmcia_device * link) | |||
725 | { | 766 | { |
726 | struct net_device *dev = link->priv; | 767 | struct net_device *dev = link->priv; |
727 | local_info_t *local = netdev_priv(dev); | 768 | local_info_t *local = netdev_priv(dev); |
769 | unsigned int ioaddr; | ||
728 | tuple_t tuple; | 770 | tuple_t tuple; |
729 | cisparse_t parse; | 771 | cisparse_t parse; |
730 | unsigned int ioaddr; | ||
731 | int err, i; | 772 | int err, i; |
732 | u_char buf[64]; | 773 | u_char buf[64]; |
733 | cistpl_lan_node_id_t *node_id = (cistpl_lan_node_id_t*)parse.funce.data; | 774 | cistpl_lan_node_id_t *node_id = (cistpl_lan_node_id_t*)parse.funce.data; |
734 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; | ||
735 | DECLARE_MAC_BUF(mac); | 775 | DECLARE_MAC_BUF(mac); |
736 | 776 | ||
737 | local->dingo_ccr = NULL; | 777 | local->dingo_ccr = NULL; |
@@ -846,19 +886,8 @@ xirc2ps_config(struct pcmcia_device * link) | |||
846 | /* Take the Modem IO port from the CIS and scan for a free | 886 | /* Take the Modem IO port from the CIS and scan for a free |
847 | * Ethernet port */ | 887 | * Ethernet port */ |
848 | link->io.NumPorts1 = 16; /* no Mako stuff anymore */ | 888 | link->io.NumPorts1 = 16; /* no Mako stuff anymore */ |
849 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 889 | if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) |
850 | for (err = first_tuple(link, &tuple, &parse); !err; | 890 | goto port_found; |
851 | err = next_tuple(link, &tuple, &parse)) { | ||
852 | if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { | ||
853 | for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { | ||
854 | link->conf.ConfigIndex = cf->index ; | ||
855 | link->io.BasePort2 = cf->io.win[0].base; | ||
856 | link->io.BasePort1 = ioaddr; | ||
857 | if (!(err=pcmcia_request_io(link, &link->io))) | ||
858 | goto port_found; | ||
859 | } | ||
860 | } | ||
861 | } | ||
862 | } else { | 891 | } else { |
863 | link->io.NumPorts1 = 18; | 892 | link->io.NumPorts1 = 18; |
864 | /* We do 2 passes here: The first one uses the regular mapping and | 893 | /* We do 2 passes here: The first one uses the regular mapping and |
@@ -866,21 +895,9 @@ xirc2ps_config(struct pcmcia_device * link) | |||
866 | * mirrored every 32 bytes. Actually we use a mirrored port for | 895 | * mirrored every 32 bytes. Actually we use a mirrored port for |
867 | * the Mako if (on the first pass) the COR bit 5 is set. | 896 | * the Mako if (on the first pass) the COR bit 5 is set. |
868 | */ | 897 | */ |
869 | for (pass=0; pass < 2; pass++) { | 898 | for (pass=0; pass < 2; pass++) |
870 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 899 | if (!pcmcia_loop_config(link, xirc2ps_config_check, &pass)) |
871 | for (err = first_tuple(link, &tuple, &parse); !err; | ||
872 | err = next_tuple(link, &tuple, &parse)){ | ||
873 | if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8){ | ||
874 | link->conf.ConfigIndex = cf->index ; | ||
875 | link->io.BasePort2 = cf->io.win[0].base; | ||
876 | link->io.BasePort1 = link->io.BasePort2 | ||
877 | + (pass ? (cf->index & 0x20 ? -24:8) | ||
878 | : (cf->index & 0x20 ? 8:-24)); | ||
879 | if (!(err=pcmcia_request_io(link, &link->io))) | ||
880 | goto port_found; | 900 | goto port_found; |
881 | } | ||
882 | } | ||
883 | } | ||
884 | /* if special option: | 901 | /* if special option: |
885 | * try to configure as Ethernet only. | 902 | * try to configure as Ethernet only. |
886 | * .... */ | 903 | * .... */ |