diff options
Diffstat (limited to 'drivers/char/pcmcia/cm4040_cs.c')
-rw-r--r-- | drivers/char/pcmcia/cm4040_cs.c | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index c0775c844e08..815cde1d0570 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
30 | #include <asm/io.h> | 30 | #include <asm/io.h> |
31 | 31 | ||
32 | #include <pcmcia/cs_types.h> | ||
33 | #include <pcmcia/cs.h> | 32 | #include <pcmcia/cs.h> |
34 | #include <pcmcia/cistpl.h> | 33 | #include <pcmcia/cistpl.h> |
35 | #include <pcmcia/cisreg.h> | 34 | #include <pcmcia/cisreg.h> |
@@ -110,7 +109,7 @@ static inline unsigned char xinb(unsigned short port) | |||
110 | static void cm4040_do_poll(unsigned long dummy) | 109 | static void cm4040_do_poll(unsigned long dummy) |
111 | { | 110 | { |
112 | struct reader_dev *dev = (struct reader_dev *) dummy; | 111 | struct reader_dev *dev = (struct reader_dev *) dummy; |
113 | unsigned int obs = xinb(dev->p_dev->io.BasePort1 | 112 | unsigned int obs = xinb(dev->p_dev->resource[0]->start |
114 | + REG_OFFSET_BUFFER_STATUS); | 113 | + REG_OFFSET_BUFFER_STATUS); |
115 | 114 | ||
116 | if ((obs & BSR_BULK_IN_FULL)) { | 115 | if ((obs & BSR_BULK_IN_FULL)) { |
@@ -141,7 +140,7 @@ static void cm4040_stop_poll(struct reader_dev *dev) | |||
141 | static int wait_for_bulk_out_ready(struct reader_dev *dev) | 140 | static int wait_for_bulk_out_ready(struct reader_dev *dev) |
142 | { | 141 | { |
143 | int i, rc; | 142 | int i, rc; |
144 | int iobase = dev->p_dev->io.BasePort1; | 143 | int iobase = dev->p_dev->resource[0]->start; |
145 | 144 | ||
146 | for (i = 0; i < POLL_LOOP_COUNT; i++) { | 145 | for (i = 0; i < POLL_LOOP_COUNT; i++) { |
147 | if ((xinb(iobase + REG_OFFSET_BUFFER_STATUS) | 146 | if ((xinb(iobase + REG_OFFSET_BUFFER_STATUS) |
@@ -171,7 +170,7 @@ static int wait_for_bulk_out_ready(struct reader_dev *dev) | |||
171 | /* Write to Sync Control Register */ | 170 | /* Write to Sync Control Register */ |
172 | static int write_sync_reg(unsigned char val, struct reader_dev *dev) | 171 | static int write_sync_reg(unsigned char val, struct reader_dev *dev) |
173 | { | 172 | { |
174 | int iobase = dev->p_dev->io.BasePort1; | 173 | int iobase = dev->p_dev->resource[0]->start; |
175 | int rc; | 174 | int rc; |
176 | 175 | ||
177 | rc = wait_for_bulk_out_ready(dev); | 176 | rc = wait_for_bulk_out_ready(dev); |
@@ -189,7 +188,7 @@ static int write_sync_reg(unsigned char val, struct reader_dev *dev) | |||
189 | static int wait_for_bulk_in_ready(struct reader_dev *dev) | 188 | static int wait_for_bulk_in_ready(struct reader_dev *dev) |
190 | { | 189 | { |
191 | int i, rc; | 190 | int i, rc; |
192 | int iobase = dev->p_dev->io.BasePort1; | 191 | int iobase = dev->p_dev->resource[0]->start; |
193 | 192 | ||
194 | for (i = 0; i < POLL_LOOP_COUNT; i++) { | 193 | for (i = 0; i < POLL_LOOP_COUNT; i++) { |
195 | if ((xinb(iobase + REG_OFFSET_BUFFER_STATUS) | 194 | if ((xinb(iobase + REG_OFFSET_BUFFER_STATUS) |
@@ -219,7 +218,7 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf, | |||
219 | size_t count, loff_t *ppos) | 218 | size_t count, loff_t *ppos) |
220 | { | 219 | { |
221 | struct reader_dev *dev = filp->private_data; | 220 | struct reader_dev *dev = filp->private_data; |
222 | int iobase = dev->p_dev->io.BasePort1; | 221 | int iobase = dev->p_dev->resource[0]->start; |
223 | size_t bytes_to_read; | 222 | size_t bytes_to_read; |
224 | unsigned long i; | 223 | unsigned long i; |
225 | size_t min_bytes_to_read; | 224 | size_t min_bytes_to_read; |
@@ -321,7 +320,7 @@ static ssize_t cm4040_write(struct file *filp, const char __user *buf, | |||
321 | size_t count, loff_t *ppos) | 320 | size_t count, loff_t *ppos) |
322 | { | 321 | { |
323 | struct reader_dev *dev = filp->private_data; | 322 | struct reader_dev *dev = filp->private_data; |
324 | int iobase = dev->p_dev->io.BasePort1; | 323 | int iobase = dev->p_dev->resource[0]->start; |
325 | ssize_t rc; | 324 | ssize_t rc; |
326 | int i; | 325 | int i; |
327 | unsigned int bytes_to_write; | 326 | unsigned int bytes_to_write; |
@@ -528,16 +527,12 @@ static int cm4040_config_check(struct pcmcia_device *p_dev, | |||
528 | return -ENODEV; | 527 | return -ENODEV; |
529 | 528 | ||
530 | /* Get the IOaddr */ | 529 | /* Get the IOaddr */ |
531 | p_dev->io.BasePort1 = cfg->io.win[0].base; | 530 | p_dev->resource[0]->start = cfg->io.win[0].base; |
532 | p_dev->io.NumPorts1 = cfg->io.win[0].len; | 531 | p_dev->resource[0]->end = cfg->io.win[0].len; |
533 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 532 | p_dev->resource[0]->flags |= pcmcia_io_cfg_data_width(cfg->io.flags); |
534 | if (!(cfg->io.flags & CISTPL_IO_8BIT)) | 533 | p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK; |
535 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 534 | rc = pcmcia_request_io(p_dev); |
536 | if (!(cfg->io.flags & CISTPL_IO_16BIT)) | 535 | |
537 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
538 | p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK; | ||
539 | |||
540 | rc = pcmcia_request_io(p_dev, &p_dev->io); | ||
541 | dev_printk(KERN_INFO, &p_dev->dev, | 536 | dev_printk(KERN_INFO, &p_dev->dev, |
542 | "pcmcia_request_io returned 0x%x\n", rc); | 537 | "pcmcia_request_io returned 0x%x\n", rc); |
543 | return rc; | 538 | return rc; |
@@ -549,10 +544,6 @@ static int reader_config(struct pcmcia_device *link, int devno) | |||
549 | struct reader_dev *dev; | 544 | struct reader_dev *dev; |
550 | int fail_rc; | 545 | int fail_rc; |
551 | 546 | ||
552 | link->io.BasePort2 = 0; | ||
553 | link->io.NumPorts2 = 0; | ||
554 | link->io.Attributes2 = 0; | ||
555 | |||
556 | if (pcmcia_loop_config(link, cm4040_config_check, NULL)) | 547 | if (pcmcia_loop_config(link, cm4040_config_check, NULL)) |
557 | goto cs_release; | 548 | goto cs_release; |
558 | 549 | ||
@@ -568,8 +559,8 @@ static int reader_config(struct pcmcia_device *link, int devno) | |||
568 | 559 | ||
569 | dev = link->priv; | 560 | dev = link->priv; |
570 | 561 | ||
571 | DEBUGP(2, dev, "device " DEVICE_NAME "%d at 0x%.4x-0x%.4x\n", devno, | 562 | DEBUGP(2, dev, "device " DEVICE_NAME "%d at %pR\n", devno, |
572 | link->io.BasePort1, link->io.BasePort1+link->io.NumPorts1); | 563 | link->resource[0]); |
573 | DEBUGP(2, dev, "<- reader_config (succ)\n"); | 564 | DEBUGP(2, dev, "<- reader_config (succ)\n"); |
574 | 565 | ||
575 | return 0; | 566 | return 0; |