aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/pcnet_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/pcnet_cs.c')
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c63
1 files changed, 28 insertions, 35 deletions
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index bfdef72c5d5e..c3edfe4c2651 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -42,7 +42,6 @@
42#include <linux/mii.h> 42#include <linux/mii.h>
43#include "../8390.h" 43#include "../8390.h"
44 44
45#include <pcmcia/cs_types.h>
46#include <pcmcia/cs.h> 45#include <pcmcia/cs.h>
47#include <pcmcia/cistpl.h> 46#include <pcmcia/cistpl.h>
48#include <pcmcia/ciscode.h> 47#include <pcmcia/ciscode.h>
@@ -113,8 +112,6 @@ static int setup_dma_config(struct pcmcia_device *link, int start_pg,
113 112
114static void pcnet_detach(struct pcmcia_device *p_dev); 113static void pcnet_detach(struct pcmcia_device *p_dev);
115 114
116static dev_info_t dev_info = "pcnet_cs";
117
118/*====================================================================*/ 115/*====================================================================*/
119 116
120typedef struct hw_info_t { 117typedef struct hw_info_t {
@@ -304,7 +301,6 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link)
304{ 301{
305 struct net_device *dev = link->priv; 302 struct net_device *dev = link->priv;
306 win_req_t req; 303 win_req_t req;
307 memreq_t mem;
308 u_char __iomem *base, *virt; 304 u_char __iomem *base, *virt;
309 int i, j; 305 int i, j;
310 306
@@ -317,10 +313,8 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link)
317 return NULL; 313 return NULL;
318 314
319 virt = ioremap(req.Base, req.Size); 315 virt = ioremap(req.Base, req.Size);
320 mem.Page = 0;
321 for (i = 0; i < NR_INFO; i++) { 316 for (i = 0; i < NR_INFO; i++) {
322 mem.CardOffset = hw_info[i].offset & ~(req.Size-1); 317 pcmcia_map_mem_page(link, link->win, hw_info[i].offset & ~(req.Size-1));
323 pcmcia_map_mem_page(link, link->win, &mem);
324 base = &virt[hw_info[i].offset & (req.Size-1)]; 318 base = &virt[hw_info[i].offset & (req.Size-1)];
325 if ((readb(base+0) == hw_info[i].a0) && 319 if ((readb(base+0) == hw_info[i].a0) &&
326 (readb(base+2) == hw_info[i].a1) && 320 (readb(base+2) == hw_info[i].a1) &&
@@ -480,29 +474,31 @@ static hw_info_t *get_hwired(struct pcmcia_device *link)
480static int try_io_port(struct pcmcia_device *link) 474static int try_io_port(struct pcmcia_device *link)
481{ 475{
482 int j, ret; 476 int j, ret;
483 if (link->io.NumPorts1 == 32) { 477 link->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
484 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 478 link->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
485 if (link->io.NumPorts2 > 0) { 479 if (link->resource[0]->end == 32) {
480 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
481 if (link->resource[1]->end > 0) {
486 /* for master/slave multifunction cards */ 482 /* for master/slave multifunction cards */
487 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 483 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
488 } 484 }
489 } else { 485 } else {
490 /* This should be two 16-port windows */ 486 /* This should be two 16-port windows */
491 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 487 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
492 link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; 488 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_16;
493 } 489 }
494 if (link->io.BasePort1 == 0) { 490 if (link->resource[0]->start == 0) {
495 link->io.IOAddrLines = 16;
496 for (j = 0; j < 0x400; j += 0x20) { 491 for (j = 0; j < 0x400; j += 0x20) {
497 link->io.BasePort1 = j ^ 0x300; 492 link->resource[0]->start = j ^ 0x300;
498 link->io.BasePort2 = (j ^ 0x300) + 0x10; 493 link->resource[1]->start = (j ^ 0x300) + 0x10;
499 ret = pcmcia_request_io(link, &link->io); 494 link->io_lines = 16;
495 ret = pcmcia_request_io(link);
500 if (ret == 0) 496 if (ret == 0)
501 return ret; 497 return ret;
502 } 498 }
503 return ret; 499 return ret;
504 } else { 500 } else {
505 return pcmcia_request_io(link, &link->io); 501 return pcmcia_request_io(link);
506 } 502 }
507} 503}
508 504
@@ -523,18 +519,18 @@ static int pcnet_confcheck(struct pcmcia_device *p_dev,
523 network function with window 0, and serial with window 1 */ 519 network function with window 0, and serial with window 1 */
524 if (io->nwin > 1) { 520 if (io->nwin > 1) {
525 i = (io->win[1].len > io->win[0].len); 521 i = (io->win[1].len > io->win[0].len);
526 p_dev->io.BasePort2 = io->win[1-i].base; 522 p_dev->resource[1]->start = io->win[1-i].base;
527 p_dev->io.NumPorts2 = io->win[1-i].len; 523 p_dev->resource[1]->end = io->win[1-i].len;
528 } else { 524 } else {
529 i = p_dev->io.NumPorts2 = 0; 525 i = p_dev->resource[1]->end = 0;
530 } 526 }
531 527
532 *has_shmem = ((cfg->mem.nwin == 1) && 528 *has_shmem = ((cfg->mem.nwin == 1) &&
533 (cfg->mem.win[0].len >= 0x4000)); 529 (cfg->mem.win[0].len >= 0x4000));
534 p_dev->io.BasePort1 = io->win[i].base; 530 p_dev->resource[0]->start = io->win[i].base;
535 p_dev->io.NumPorts1 = io->win[i].len; 531 p_dev->resource[0]->end = io->win[i].len;
536 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 532 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
537 if (p_dev->io.NumPorts1 + p_dev->io.NumPorts2 >= 32) 533 if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32)
538 return try_io_port(p_dev); 534 return try_io_port(p_dev);
539 535
540 return 0; 536 return 0;
@@ -557,7 +553,7 @@ static int pcnet_config(struct pcmcia_device *link)
557 if (!link->irq) 553 if (!link->irq)
558 goto failed; 554 goto failed;
559 555
560 if (link->io.NumPorts2 == 8) { 556 if (resource_size(link->resource[1]) == 8) {
561 link->conf.Attributes |= CONF_ENABLE_SPKR; 557 link->conf.Attributes |= CONF_ENABLE_SPKR;
562 link->conf.Status = CCSR_AUDIO_ENA; 558 link->conf.Status = CCSR_AUDIO_ENA;
563 } 559 }
@@ -569,7 +565,7 @@ static int pcnet_config(struct pcmcia_device *link)
569 if (ret) 565 if (ret)
570 goto failed; 566 goto failed;
571 dev->irq = link->irq; 567 dev->irq = link->irq;
572 dev->base_addr = link->io.BasePort1; 568 dev->base_addr = link->resource[0]->start;
573 if (info->flags & HAS_MISC_REG) { 569 if (info->flags & HAS_MISC_REG) {
574 if ((if_port == 1) || (if_port == 2)) 570 if ((if_port == 1) || (if_port == 2))
575 dev->if_port = if_port; 571 dev->if_port = if_port;
@@ -956,7 +952,7 @@ static int pcnet_open(struct net_device *dev)
956 set_misc_reg(dev); 952 set_misc_reg(dev);
957 953
958 outb_p(0xFF, nic_base + EN0_ISR); /* Clear bogus intr. */ 954 outb_p(0xFF, nic_base + EN0_ISR); /* Clear bogus intr. */
959 ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev_info, dev); 955 ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev->name, dev);
960 if (ret) 956 if (ret)
961 return ret; 957 return ret;
962 958
@@ -1464,7 +1460,6 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
1464 struct net_device *dev = link->priv; 1460 struct net_device *dev = link->priv;
1465 pcnet_dev_t *info = PRIV(dev); 1461 pcnet_dev_t *info = PRIV(dev);
1466 win_req_t req; 1462 win_req_t req;
1467 memreq_t mem;
1468 int i, window_size, offset, ret; 1463 int i, window_size, offset, ret;
1469 1464
1470 window_size = (stop_pg - start_pg) << 8; 1465 window_size = (stop_pg - start_pg) << 8;
@@ -1483,11 +1478,9 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
1483 if (ret) 1478 if (ret)
1484 goto failed; 1479 goto failed;
1485 1480
1486 mem.CardOffset = (start_pg << 8) + cm_offset; 1481 offset = (start_pg << 8) + cm_offset;
1487 offset = mem.CardOffset % window_size; 1482 offset -= offset % window_size;
1488 mem.CardOffset -= offset; 1483 ret = pcmcia_map_mem_page(link, link->win, offset);
1489 mem.Page = 0;
1490 ret = pcmcia_map_mem_page(link, link->win, &mem);
1491 if (ret) 1484 if (ret)
1492 goto failed; 1485 goto failed;
1493 1486