diff options
Diffstat (limited to 'drivers')
86 files changed, 1120 insertions, 2742 deletions
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 118c28e8abaf..e944aa0c5517 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/ata.h> | 34 | #include <linux/ata.h> |
35 | #include <linux/libata.h> | 35 | #include <linux/libata.h> |
36 | 36 | ||
37 | #include <pcmcia/cs_types.h> | ||
38 | #include <pcmcia/cs.h> | 37 | #include <pcmcia/cs.h> |
39 | #include <pcmcia/cistpl.h> | 38 | #include <pcmcia/cistpl.h> |
40 | #include <pcmcia/ds.h> | 39 | #include <pcmcia/ds.h> |
@@ -201,23 +200,25 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, | |||
201 | 200 | ||
202 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 201 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
203 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 202 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
204 | pdev->io.BasePort1 = io->win[0].base; | 203 | pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; |
205 | pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | 204 | pdev->resource[0]->start = io->win[0].base; |
206 | if (!(io->flags & CISTPL_IO_16BIT)) | 205 | if (!(io->flags & CISTPL_IO_16BIT)) { |
207 | pdev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 206 | pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
207 | pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; | ||
208 | } | ||
208 | if (io->nwin == 2) { | 209 | if (io->nwin == 2) { |
209 | pdev->io.NumPorts1 = 8; | 210 | pdev->resource[0]->end = 8; |
210 | pdev->io.BasePort2 = io->win[1].base; | 211 | pdev->resource[1]->start = io->win[1].base; |
211 | pdev->io.NumPorts2 = (stk->is_kme) ? 2 : 1; | 212 | pdev->resource[1]->end = (stk->is_kme) ? 2 : 1; |
212 | if (pcmcia_request_io(pdev, &pdev->io) != 0) | 213 | if (pcmcia_request_io(pdev) != 0) |
213 | return -ENODEV; | 214 | return -ENODEV; |
214 | stk->ctl_base = pdev->io.BasePort2; | 215 | stk->ctl_base = pdev->resource[1]->start; |
215 | } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { | 216 | } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { |
216 | pdev->io.NumPorts1 = io->win[0].len; | 217 | pdev->resource[0]->end = io->win[0].len; |
217 | pdev->io.NumPorts2 = 0; | 218 | pdev->resource[1]->end = 0; |
218 | if (pcmcia_request_io(pdev, &pdev->io) != 0) | 219 | if (pcmcia_request_io(pdev) != 0) |
219 | return -ENODEV; | 220 | return -ENODEV; |
220 | stk->ctl_base = pdev->io.BasePort1 + 0x0e; | 221 | stk->ctl_base = pdev->resource[0]->start + 0x0e; |
221 | } else | 222 | } else |
222 | return -ENODEV; | 223 | return -ENODEV; |
223 | /* If we've got this far, we're done */ | 224 | /* If we've got this far, we're done */ |
@@ -246,9 +247,8 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) | |||
246 | struct ata_port_operations *ops = &pcmcia_port_ops; | 247 | struct ata_port_operations *ops = &pcmcia_port_ops; |
247 | 248 | ||
248 | /* Set up attributes in order to probe card and get resources */ | 249 | /* Set up attributes in order to probe card and get resources */ |
249 | pdev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 250 | pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
250 | pdev->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 251 | pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; |
251 | pdev->io.IOAddrLines = 3; | ||
252 | pdev->conf.Attributes = CONF_ENABLE_IRQ; | 252 | pdev->conf.Attributes = CONF_ENABLE_IRQ; |
253 | pdev->conf.IntType = INT_MEMORY_AND_IO; | 253 | pdev->conf.IntType = INT_MEMORY_AND_IO; |
254 | 254 | ||
@@ -271,7 +271,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) | |||
271 | if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) | 271 | if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) |
272 | goto failed; /* No suitable config found */ | 272 | goto failed; /* No suitable config found */ |
273 | } | 273 | } |
274 | io_base = pdev->io.BasePort1; | 274 | io_base = pdev->resource[0]->start; |
275 | ctl_base = stk->ctl_base; | 275 | ctl_base = stk->ctl_base; |
276 | if (!pdev->irq) | 276 | if (!pdev->irq) |
277 | goto failed; | 277 | goto failed; |
@@ -294,7 +294,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) | |||
294 | 294 | ||
295 | /* FIXME: Could be more ports at base + 0x10 but we only deal with | 295 | /* FIXME: Could be more ports at base + 0x10 but we only deal with |
296 | one right now */ | 296 | one right now */ |
297 | if (pdev->io.NumPorts1 >= 0x20) | 297 | if (resource_size(pdev->resource[0]) >= 0x20) |
298 | n_ports = 2; | 298 | n_ports = 2; |
299 | 299 | ||
300 | if (pdev->manf_id == 0x0097 && pdev->card_id == 0x1620) | 300 | if (pdev->manf_id == 0x0097 && pdev->card_id == 0x1620) |
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index 6d34f405a2f3..d52e90a5a617 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <linux/skbuff.h> | 39 | #include <linux/skbuff.h> |
40 | #include <linux/io.h> | 40 | #include <linux/io.h> |
41 | 41 | ||
42 | #include <pcmcia/cs_types.h> | ||
43 | #include <pcmcia/cs.h> | 42 | #include <pcmcia/cs.h> |
44 | #include <pcmcia/cistpl.h> | 43 | #include <pcmcia/cistpl.h> |
45 | #include <pcmcia/ciscode.h> | 44 | #include <pcmcia/ciscode.h> |
@@ -160,7 +159,7 @@ static void bluecard_detach(struct pcmcia_device *p_dev); | |||
160 | static void bluecard_activity_led_timeout(u_long arg) | 159 | static void bluecard_activity_led_timeout(u_long arg) |
161 | { | 160 | { |
162 | bluecard_info_t *info = (bluecard_info_t *)arg; | 161 | bluecard_info_t *info = (bluecard_info_t *)arg; |
163 | unsigned int iobase = info->p_dev->io.BasePort1; | 162 | unsigned int iobase = info->p_dev->resource[0]->start; |
164 | 163 | ||
165 | if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) | 164 | if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) |
166 | return; | 165 | return; |
@@ -177,7 +176,7 @@ static void bluecard_activity_led_timeout(u_long arg) | |||
177 | 176 | ||
178 | static void bluecard_enable_activity_led(bluecard_info_t *info) | 177 | static void bluecard_enable_activity_led(bluecard_info_t *info) |
179 | { | 178 | { |
180 | unsigned int iobase = info->p_dev->io.BasePort1; | 179 | unsigned int iobase = info->p_dev->resource[0]->start; |
181 | 180 | ||
182 | if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) | 181 | if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) |
183 | return; | 182 | return; |
@@ -233,7 +232,7 @@ static void bluecard_write_wakeup(bluecard_info_t *info) | |||
233 | } | 232 | } |
234 | 233 | ||
235 | do { | 234 | do { |
236 | register unsigned int iobase = info->p_dev->io.BasePort1; | 235 | register unsigned int iobase = info->p_dev->resource[0]->start; |
237 | register unsigned int offset; | 236 | register unsigned int offset; |
238 | register unsigned char command; | 237 | register unsigned char command; |
239 | register unsigned long ready_bit; | 238 | register unsigned long ready_bit; |
@@ -380,7 +379,7 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset) | |||
380 | return; | 379 | return; |
381 | } | 380 | } |
382 | 381 | ||
383 | iobase = info->p_dev->io.BasePort1; | 382 | iobase = info->p_dev->resource[0]->start; |
384 | 383 | ||
385 | if (test_bit(XMIT_SENDING_READY, &(info->tx_state))) | 384 | if (test_bit(XMIT_SENDING_READY, &(info->tx_state))) |
386 | bluecard_enable_activity_led(info); | 385 | bluecard_enable_activity_led(info); |
@@ -509,7 +508,7 @@ static irqreturn_t bluecard_interrupt(int irq, void *dev_inst) | |||
509 | if (!test_bit(CARD_READY, &(info->hw_state))) | 508 | if (!test_bit(CARD_READY, &(info->hw_state))) |
510 | return IRQ_HANDLED; | 509 | return IRQ_HANDLED; |
511 | 510 | ||
512 | iobase = info->p_dev->io.BasePort1; | 511 | iobase = info->p_dev->resource[0]->start; |
513 | 512 | ||
514 | spin_lock(&(info->lock)); | 513 | spin_lock(&(info->lock)); |
515 | 514 | ||
@@ -623,7 +622,7 @@ static int bluecard_hci_flush(struct hci_dev *hdev) | |||
623 | static int bluecard_hci_open(struct hci_dev *hdev) | 622 | static int bluecard_hci_open(struct hci_dev *hdev) |
624 | { | 623 | { |
625 | bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data); | 624 | bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data); |
626 | unsigned int iobase = info->p_dev->io.BasePort1; | 625 | unsigned int iobase = info->p_dev->resource[0]->start; |
627 | 626 | ||
628 | if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) | 627 | if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) |
629 | bluecard_hci_set_baud_rate(hdev, DEFAULT_BAUD_RATE); | 628 | bluecard_hci_set_baud_rate(hdev, DEFAULT_BAUD_RATE); |
@@ -643,7 +642,7 @@ static int bluecard_hci_open(struct hci_dev *hdev) | |||
643 | static int bluecard_hci_close(struct hci_dev *hdev) | 642 | static int bluecard_hci_close(struct hci_dev *hdev) |
644 | { | 643 | { |
645 | bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data); | 644 | bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data); |
646 | unsigned int iobase = info->p_dev->io.BasePort1; | 645 | unsigned int iobase = info->p_dev->resource[0]->start; |
647 | 646 | ||
648 | if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags))) | 647 | if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags))) |
649 | return 0; | 648 | return 0; |
@@ -710,7 +709,7 @@ static int bluecard_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned l | |||
710 | 709 | ||
711 | static int bluecard_open(bluecard_info_t *info) | 710 | static int bluecard_open(bluecard_info_t *info) |
712 | { | 711 | { |
713 | unsigned int iobase = info->p_dev->io.BasePort1; | 712 | unsigned int iobase = info->p_dev->resource[0]->start; |
714 | struct hci_dev *hdev; | 713 | struct hci_dev *hdev; |
715 | unsigned char id; | 714 | unsigned char id; |
716 | 715 | ||
@@ -829,7 +828,7 @@ static int bluecard_open(bluecard_info_t *info) | |||
829 | 828 | ||
830 | static int bluecard_close(bluecard_info_t *info) | 829 | static int bluecard_close(bluecard_info_t *info) |
831 | { | 830 | { |
832 | unsigned int iobase = info->p_dev->io.BasePort1; | 831 | unsigned int iobase = info->p_dev->resource[0]->start; |
833 | struct hci_dev *hdev = info->hdev; | 832 | struct hci_dev *hdev = info->hdev; |
834 | 833 | ||
835 | if (!hdev) | 834 | if (!hdev) |
@@ -866,9 +865,6 @@ static int bluecard_probe(struct pcmcia_device *link) | |||
866 | info->p_dev = link; | 865 | info->p_dev = link; |
867 | link->priv = info; | 866 | link->priv = info; |
868 | 867 | ||
869 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
870 | link->io.NumPorts1 = 8; | ||
871 | |||
872 | link->conf.Attributes = CONF_ENABLE_IRQ; | 868 | link->conf.Attributes = CONF_ENABLE_IRQ; |
873 | link->conf.IntType = INT_MEMORY_AND_IO; | 869 | link->conf.IntType = INT_MEMORY_AND_IO; |
874 | 870 | ||
@@ -891,12 +887,14 @@ static int bluecard_config(struct pcmcia_device *link) | |||
891 | int i, n; | 887 | int i, n; |
892 | 888 | ||
893 | link->conf.ConfigIndex = 0x20; | 889 | link->conf.ConfigIndex = 0x20; |
894 | link->io.NumPorts1 = 64; | 890 | |
895 | link->io.IOAddrLines = 6; | 891 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
892 | link->resource[0]->end = 64; | ||
893 | link->io_lines = 6; | ||
896 | 894 | ||
897 | for (n = 0; n < 0x400; n += 0x40) { | 895 | for (n = 0; n < 0x400; n += 0x40) { |
898 | link->io.BasePort1 = n ^ 0x300; | 896 | link->resource[0]->start = n ^ 0x300; |
899 | i = pcmcia_request_io(link, &link->io); | 897 | i = pcmcia_request_io(link); |
900 | if (i == 0) | 898 | if (i == 0) |
901 | break; | 899 | break; |
902 | } | 900 | } |
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 21e05fdc9121..7ab8f29d5e0d 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <linux/device.h> | 45 | #include <linux/device.h> |
46 | #include <linux/firmware.h> | 46 | #include <linux/firmware.h> |
47 | 47 | ||
48 | #include <pcmcia/cs_types.h> | ||
49 | #include <pcmcia/cs.h> | 48 | #include <pcmcia/cs.h> |
50 | #include <pcmcia/cistpl.h> | 49 | #include <pcmcia/cistpl.h> |
51 | #include <pcmcia/ciscode.h> | 50 | #include <pcmcia/ciscode.h> |
@@ -189,7 +188,7 @@ static void bt3c_write_wakeup(bt3c_info_t *info) | |||
189 | return; | 188 | return; |
190 | 189 | ||
191 | do { | 190 | do { |
192 | register unsigned int iobase = info->p_dev->io.BasePort1; | 191 | register unsigned int iobase = info->p_dev->resource[0]->start; |
193 | register struct sk_buff *skb; | 192 | register struct sk_buff *skb; |
194 | register int len; | 193 | register int len; |
195 | 194 | ||
@@ -227,7 +226,7 @@ static void bt3c_receive(bt3c_info_t *info) | |||
227 | return; | 226 | return; |
228 | } | 227 | } |
229 | 228 | ||
230 | iobase = info->p_dev->io.BasePort1; | 229 | iobase = info->p_dev->resource[0]->start; |
231 | 230 | ||
232 | avail = bt3c_read(iobase, 0x7006); | 231 | avail = bt3c_read(iobase, 0x7006); |
233 | //printk("bt3c_cs: receiving %d bytes\n", avail); | 232 | //printk("bt3c_cs: receiving %d bytes\n", avail); |
@@ -348,7 +347,7 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst) | |||
348 | /* our irq handler is shared */ | 347 | /* our irq handler is shared */ |
349 | return IRQ_NONE; | 348 | return IRQ_NONE; |
350 | 349 | ||
351 | iobase = info->p_dev->io.BasePort1; | 350 | iobase = info->p_dev->resource[0]->start; |
352 | 351 | ||
353 | spin_lock(&(info->lock)); | 352 | spin_lock(&(info->lock)); |
354 | 353 | ||
@@ -481,7 +480,7 @@ static int bt3c_load_firmware(bt3c_info_t *info, const unsigned char *firmware, | |||
481 | unsigned int iobase, size, addr, fcs, tmp; | 480 | unsigned int iobase, size, addr, fcs, tmp; |
482 | int i, err = 0; | 481 | int i, err = 0; |
483 | 482 | ||
484 | iobase = info->p_dev->io.BasePort1; | 483 | iobase = info->p_dev->resource[0]->start; |
485 | 484 | ||
486 | /* Reset */ | 485 | /* Reset */ |
487 | bt3c_io_write(iobase, 0x8040, 0x0404); | 486 | bt3c_io_write(iobase, 0x8040, 0x0404); |
@@ -658,8 +657,8 @@ static int bt3c_probe(struct pcmcia_device *link) | |||
658 | info->p_dev = link; | 657 | info->p_dev = link; |
659 | link->priv = info; | 658 | link->priv = info; |
660 | 659 | ||
661 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 660 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
662 | link->io.NumPorts1 = 8; | 661 | link->resource[0]->end = 8; |
663 | 662 | ||
664 | link->conf.Attributes = CONF_ENABLE_IRQ; | 663 | link->conf.Attributes = CONF_ENABLE_IRQ; |
665 | link->conf.IntType = INT_MEMORY_AND_IO; | 664 | link->conf.IntType = INT_MEMORY_AND_IO; |
@@ -684,14 +683,14 @@ static int bt3c_check_config(struct pcmcia_device *p_dev, | |||
684 | { | 683 | { |
685 | unsigned long try = (unsigned long) priv_data; | 684 | unsigned long try = (unsigned long) priv_data; |
686 | 685 | ||
686 | p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; | ||
687 | |||
687 | if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) | 688 | if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) |
688 | p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; | 689 | p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; |
689 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && | 690 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && |
690 | (cf->io.win[0].base != 0)) { | 691 | (cf->io.win[0].base != 0)) { |
691 | p_dev->io.BasePort1 = cf->io.win[0].base; | 692 | p_dev->resource[0]->start = cf->io.win[0].base; |
692 | p_dev->io.IOAddrLines = (try == 0) ? 16 : | 693 | if (!pcmcia_request_io(p_dev)) |
693 | cf->io.flags & CISTPL_IO_LINES_MASK; | ||
694 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | ||
695 | return 0; | 694 | return 0; |
696 | } | 695 | } |
697 | return -ENODEV; | 696 | return -ENODEV; |
@@ -708,9 +707,9 @@ static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev, | |||
708 | 707 | ||
709 | if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { | 708 | if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { |
710 | for (j = 0; j < 5; j++) { | 709 | for (j = 0; j < 5; j++) { |
711 | p_dev->io.BasePort1 = base[j]; | 710 | p_dev->resource[0]->start = base[j]; |
712 | p_dev->io.IOAddrLines = base[j] ? 16 : 3; | 711 | p_dev->io_lines = base[j] ? 16 : 3; |
713 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | 712 | if (!pcmcia_request_io(p_dev)) |
714 | return 0; | 713 | return 0; |
715 | } | 714 | } |
716 | } | 715 | } |
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 4ed7288f99db..1c4f5e863b03 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <asm/system.h> | 41 | #include <asm/system.h> |
42 | #include <asm/io.h> | 42 | #include <asm/io.h> |
43 | 43 | ||
44 | #include <pcmcia/cs_types.h> | ||
45 | #include <pcmcia/cs.h> | 44 | #include <pcmcia/cs.h> |
46 | #include <pcmcia/cistpl.h> | 45 | #include <pcmcia/cistpl.h> |
47 | #include <pcmcia/ciscode.h> | 46 | #include <pcmcia/ciscode.h> |
@@ -143,7 +142,7 @@ static void btuart_write_wakeup(btuart_info_t *info) | |||
143 | } | 142 | } |
144 | 143 | ||
145 | do { | 144 | do { |
146 | register unsigned int iobase = info->p_dev->io.BasePort1; | 145 | register unsigned int iobase = info->p_dev->resource[0]->start; |
147 | register struct sk_buff *skb; | 146 | register struct sk_buff *skb; |
148 | register int len; | 147 | register int len; |
149 | 148 | ||
@@ -184,7 +183,7 @@ static void btuart_receive(btuart_info_t *info) | |||
184 | return; | 183 | return; |
185 | } | 184 | } |
186 | 185 | ||
187 | iobase = info->p_dev->io.BasePort1; | 186 | iobase = info->p_dev->resource[0]->start; |
188 | 187 | ||
189 | do { | 188 | do { |
190 | info->hdev->stat.byte_rx++; | 189 | info->hdev->stat.byte_rx++; |
@@ -298,7 +297,7 @@ static irqreturn_t btuart_interrupt(int irq, void *dev_inst) | |||
298 | /* our irq handler is shared */ | 297 | /* our irq handler is shared */ |
299 | return IRQ_NONE; | 298 | return IRQ_NONE; |
300 | 299 | ||
301 | iobase = info->p_dev->io.BasePort1; | 300 | iobase = info->p_dev->resource[0]->start; |
302 | 301 | ||
303 | spin_lock(&(info->lock)); | 302 | spin_lock(&(info->lock)); |
304 | 303 | ||
@@ -355,7 +354,7 @@ static void btuart_change_speed(btuart_info_t *info, unsigned int speed) | |||
355 | return; | 354 | return; |
356 | } | 355 | } |
357 | 356 | ||
358 | iobase = info->p_dev->io.BasePort1; | 357 | iobase = info->p_dev->resource[0]->start; |
359 | 358 | ||
360 | spin_lock_irqsave(&(info->lock), flags); | 359 | spin_lock_irqsave(&(info->lock), flags); |
361 | 360 | ||
@@ -479,7 +478,7 @@ static int btuart_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned lon | |||
479 | static int btuart_open(btuart_info_t *info) | 478 | static int btuart_open(btuart_info_t *info) |
480 | { | 479 | { |
481 | unsigned long flags; | 480 | unsigned long flags; |
482 | unsigned int iobase = info->p_dev->io.BasePort1; | 481 | unsigned int iobase = info->p_dev->resource[0]->start; |
483 | struct hci_dev *hdev; | 482 | struct hci_dev *hdev; |
484 | 483 | ||
485 | spin_lock_init(&(info->lock)); | 484 | spin_lock_init(&(info->lock)); |
@@ -549,7 +548,7 @@ static int btuart_open(btuart_info_t *info) | |||
549 | static int btuart_close(btuart_info_t *info) | 548 | static int btuart_close(btuart_info_t *info) |
550 | { | 549 | { |
551 | unsigned long flags; | 550 | unsigned long flags; |
552 | unsigned int iobase = info->p_dev->io.BasePort1; | 551 | unsigned int iobase = info->p_dev->resource[0]->start; |
553 | struct hci_dev *hdev = info->hdev; | 552 | struct hci_dev *hdev = info->hdev; |
554 | 553 | ||
555 | if (!hdev) | 554 | if (!hdev) |
@@ -587,8 +586,8 @@ static int btuart_probe(struct pcmcia_device *link) | |||
587 | info->p_dev = link; | 586 | info->p_dev = link; |
588 | link->priv = info; | 587 | link->priv = info; |
589 | 588 | ||
590 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 589 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
591 | link->io.NumPorts1 = 8; | 590 | link->resource[0]->end = 8; |
592 | 591 | ||
593 | link->conf.Attributes = CONF_ENABLE_IRQ; | 592 | link->conf.Attributes = CONF_ENABLE_IRQ; |
594 | link->conf.IntType = INT_MEMORY_AND_IO; | 593 | link->conf.IntType = INT_MEMORY_AND_IO; |
@@ -613,14 +612,14 @@ static int btuart_check_config(struct pcmcia_device *p_dev, | |||
613 | { | 612 | { |
614 | int *try = priv_data; | 613 | int *try = priv_data; |
615 | 614 | ||
615 | p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; | ||
616 | |||
616 | if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) | 617 | if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) |
617 | p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; | 618 | p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; |
618 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && | 619 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && |
619 | (cf->io.win[0].base != 0)) { | 620 | (cf->io.win[0].base != 0)) { |
620 | p_dev->io.BasePort1 = cf->io.win[0].base; | 621 | p_dev->resource[0]->start = cf->io.win[0].base; |
621 | p_dev->io.IOAddrLines = (*try == 0) ? 16 : | 622 | if (!pcmcia_request_io(p_dev)) |
622 | cf->io.flags & CISTPL_IO_LINES_MASK; | ||
623 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | ||
624 | return 0; | 623 | return 0; |
625 | } | 624 | } |
626 | return -ENODEV; | 625 | return -ENODEV; |
@@ -637,9 +636,9 @@ static int btuart_check_config_notpicky(struct pcmcia_device *p_dev, | |||
637 | 636 | ||
638 | if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { | 637 | if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { |
639 | for (j = 0; j < 5; j++) { | 638 | for (j = 0; j < 5; j++) { |
640 | p_dev->io.BasePort1 = base[j]; | 639 | p_dev->resource[0]->start = base[j]; |
641 | p_dev->io.IOAddrLines = base[j] ? 16 : 3; | 640 | p_dev->io_lines = base[j] ? 16 : 3; |
642 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | 641 | if (!pcmcia_request_io(p_dev)) |
643 | return 0; | 642 | return 0; |
644 | } | 643 | } |
645 | } | 644 | } |
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index cbe9e44a42e9..db7c8db695fc 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <asm/system.h> | 41 | #include <asm/system.h> |
42 | #include <asm/io.h> | 42 | #include <asm/io.h> |
43 | 43 | ||
44 | #include <pcmcia/cs_types.h> | ||
45 | #include <pcmcia/cs.h> | 44 | #include <pcmcia/cs.h> |
46 | #include <pcmcia/cistpl.h> | 45 | #include <pcmcia/cistpl.h> |
47 | #include <pcmcia/ciscode.h> | 46 | #include <pcmcia/ciscode.h> |
@@ -150,7 +149,7 @@ static void dtl1_write_wakeup(dtl1_info_t *info) | |||
150 | } | 149 | } |
151 | 150 | ||
152 | do { | 151 | do { |
153 | register unsigned int iobase = info->p_dev->io.BasePort1; | 152 | register unsigned int iobase = info->p_dev->resource[0]->start; |
154 | register struct sk_buff *skb; | 153 | register struct sk_buff *skb; |
155 | register int len; | 154 | register int len; |
156 | 155 | ||
@@ -215,7 +214,7 @@ static void dtl1_receive(dtl1_info_t *info) | |||
215 | return; | 214 | return; |
216 | } | 215 | } |
217 | 216 | ||
218 | iobase = info->p_dev->io.BasePort1; | 217 | iobase = info->p_dev->resource[0]->start; |
219 | 218 | ||
220 | do { | 219 | do { |
221 | info->hdev->stat.byte_rx++; | 220 | info->hdev->stat.byte_rx++; |
@@ -302,7 +301,7 @@ static irqreturn_t dtl1_interrupt(int irq, void *dev_inst) | |||
302 | /* our irq handler is shared */ | 301 | /* our irq handler is shared */ |
303 | return IRQ_NONE; | 302 | return IRQ_NONE; |
304 | 303 | ||
305 | iobase = info->p_dev->io.BasePort1; | 304 | iobase = info->p_dev->resource[0]->start; |
306 | 305 | ||
307 | spin_lock(&(info->lock)); | 306 | spin_lock(&(info->lock)); |
308 | 307 | ||
@@ -462,7 +461,7 @@ static int dtl1_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long | |||
462 | static int dtl1_open(dtl1_info_t *info) | 461 | static int dtl1_open(dtl1_info_t *info) |
463 | { | 462 | { |
464 | unsigned long flags; | 463 | unsigned long flags; |
465 | unsigned int iobase = info->p_dev->io.BasePort1; | 464 | unsigned int iobase = info->p_dev->resource[0]->start; |
466 | struct hci_dev *hdev; | 465 | struct hci_dev *hdev; |
467 | 466 | ||
468 | spin_lock_init(&(info->lock)); | 467 | spin_lock_init(&(info->lock)); |
@@ -509,7 +508,8 @@ static int dtl1_open(dtl1_info_t *info) | |||
509 | outb(UART_LCR_WLEN8, iobase + UART_LCR); /* Reset DLAB */ | 508 | outb(UART_LCR_WLEN8, iobase + UART_LCR); /* Reset DLAB */ |
510 | outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase + UART_MCR); | 509 | outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase + UART_MCR); |
511 | 510 | ||
512 | info->ri_latch = inb(info->p_dev->io.BasePort1 + UART_MSR) & UART_MSR_RI; | 511 | info->ri_latch = inb(info->p_dev->resource[0]->start + UART_MSR) |
512 | & UART_MSR_RI; | ||
513 | 513 | ||
514 | /* Turn on interrupts */ | 514 | /* Turn on interrupts */ |
515 | outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER); | 515 | outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER); |
@@ -534,7 +534,7 @@ static int dtl1_open(dtl1_info_t *info) | |||
534 | static int dtl1_close(dtl1_info_t *info) | 534 | static int dtl1_close(dtl1_info_t *info) |
535 | { | 535 | { |
536 | unsigned long flags; | 536 | unsigned long flags; |
537 | unsigned int iobase = info->p_dev->io.BasePort1; | 537 | unsigned int iobase = info->p_dev->resource[0]->start; |
538 | struct hci_dev *hdev = info->hdev; | 538 | struct hci_dev *hdev = info->hdev; |
539 | 539 | ||
540 | if (!hdev) | 540 | if (!hdev) |
@@ -572,8 +572,8 @@ static int dtl1_probe(struct pcmcia_device *link) | |||
572 | info->p_dev = link; | 572 | info->p_dev = link; |
573 | link->priv = info; | 573 | link->priv = info; |
574 | 574 | ||
575 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 575 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
576 | link->io.NumPorts1 = 8; | 576 | link->resource[0]->end = 8; |
577 | 577 | ||
578 | link->conf.Attributes = CONF_ENABLE_IRQ; | 578 | link->conf.Attributes = CONF_ENABLE_IRQ; |
579 | link->conf.IntType = INT_MEMORY_AND_IO; | 579 | link->conf.IntType = INT_MEMORY_AND_IO; |
@@ -597,14 +597,13 @@ static int dtl1_confcheck(struct pcmcia_device *p_dev, | |||
597 | unsigned int vcc, | 597 | unsigned int vcc, |
598 | void *priv_data) | 598 | void *priv_data) |
599 | { | 599 | { |
600 | if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { | 600 | if ((cf->io.nwin != 1) || (cf->io.win[0].len <= 8)) |
601 | p_dev->io.BasePort1 = cf->io.win[0].base; | 601 | return -ENODEV; |
602 | p_dev->io.NumPorts1 = cf->io.win[0].len; /*yo */ | 602 | |
603 | p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; | 603 | p_dev->resource[0]->start = cf->io.win[0].base; |
604 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | 604 | p_dev->resource[0]->end = cf->io.win[0].len; /*yo */ |
605 | return 0; | 605 | p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; |
606 | } | 606 | return pcmcia_request_io(p_dev); |
607 | return -ENODEV; | ||
608 | } | 607 | } |
609 | 608 | ||
610 | static int dtl1_config(struct pcmcia_device *link) | 609 | static int dtl1_config(struct pcmcia_device *link) |
@@ -613,7 +612,7 @@ static int dtl1_config(struct pcmcia_device *link) | |||
613 | int i; | 612 | int i; |
614 | 613 | ||
615 | /* Look for a generic full-sized window */ | 614 | /* Look for a generic full-sized window */ |
616 | link->io.NumPorts1 = 8; | 615 | link->resource[0]->end = 8; |
617 | if (pcmcia_loop_config(link, dtl1_confcheck, NULL) < 0) | 616 | if (pcmcia_loop_config(link, dtl1_confcheck, NULL) < 0) |
618 | goto failed; | 617 | goto failed; |
619 | 618 | ||
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index e7956acf2ad6..ec73d9f6d9ed 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/uaccess.h> | 34 | #include <linux/uaccess.h> |
35 | #include <linux/io.h> | 35 | #include <linux/io.h> |
36 | 36 | ||
37 | #include <pcmcia/cs_types.h> | ||
38 | #include <pcmcia/cs.h> | 37 | #include <pcmcia/cs.h> |
39 | #include <pcmcia/cistpl.h> | 38 | #include <pcmcia/cistpl.h> |
40 | #include <pcmcia/cisreg.h> | 39 | #include <pcmcia/cisreg.h> |
@@ -422,7 +421,7 @@ static struct card_fixup card_fixups[] = { | |||
422 | static void set_cardparameter(struct cm4000_dev *dev) | 421 | static void set_cardparameter(struct cm4000_dev *dev) |
423 | { | 422 | { |
424 | int i; | 423 | int i; |
425 | unsigned int iobase = dev->p_dev->io.BasePort1; | 424 | unsigned int iobase = dev->p_dev->resource[0]->start; |
426 | u_int8_t stopbits = 0x02; /* ISO default */ | 425 | u_int8_t stopbits = 0x02; /* ISO default */ |
427 | 426 | ||
428 | DEBUGP(3, dev, "-> set_cardparameter\n"); | 427 | DEBUGP(3, dev, "-> set_cardparameter\n"); |
@@ -455,7 +454,7 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq) | |||
455 | unsigned short num_bytes_read; | 454 | unsigned short num_bytes_read; |
456 | unsigned char pts_reply[4]; | 455 | unsigned char pts_reply[4]; |
457 | ssize_t rc; | 456 | ssize_t rc; |
458 | unsigned int iobase = dev->p_dev->io.BasePort1; | 457 | unsigned int iobase = dev->p_dev->resource[0]->start; |
459 | 458 | ||
460 | rc = 0; | 459 | rc = 0; |
461 | 460 | ||
@@ -664,7 +663,7 @@ static void terminate_monitor(struct cm4000_dev *dev) | |||
664 | static void monitor_card(unsigned long p) | 663 | static void monitor_card(unsigned long p) |
665 | { | 664 | { |
666 | struct cm4000_dev *dev = (struct cm4000_dev *) p; | 665 | struct cm4000_dev *dev = (struct cm4000_dev *) p; |
667 | unsigned int iobase = dev->p_dev->io.BasePort1; | 666 | unsigned int iobase = dev->p_dev->resource[0]->start; |
668 | unsigned short s; | 667 | unsigned short s; |
669 | struct ptsreq ptsreq; | 668 | struct ptsreq ptsreq; |
670 | int i, atrc; | 669 | int i, atrc; |
@@ -925,7 +924,7 @@ static ssize_t cmm_read(struct file *filp, __user char *buf, size_t count, | |||
925 | loff_t *ppos) | 924 | loff_t *ppos) |
926 | { | 925 | { |
927 | struct cm4000_dev *dev = filp->private_data; | 926 | struct cm4000_dev *dev = filp->private_data; |
928 | unsigned int iobase = dev->p_dev->io.BasePort1; | 927 | unsigned int iobase = dev->p_dev->resource[0]->start; |
929 | ssize_t rc; | 928 | ssize_t rc; |
930 | int i, j, k; | 929 | int i, j, k; |
931 | 930 | ||
@@ -1048,7 +1047,7 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf, | |||
1048 | size_t count, loff_t *ppos) | 1047 | size_t count, loff_t *ppos) |
1049 | { | 1048 | { |
1050 | struct cm4000_dev *dev = filp->private_data; | 1049 | struct cm4000_dev *dev = filp->private_data; |
1051 | unsigned int iobase = dev->p_dev->io.BasePort1; | 1050 | unsigned int iobase = dev->p_dev->resource[0]->start; |
1052 | unsigned short s; | 1051 | unsigned short s; |
1053 | unsigned char tmp; | 1052 | unsigned char tmp; |
1054 | unsigned char infolen; | 1053 | unsigned char infolen; |
@@ -1401,7 +1400,7 @@ static void stop_monitor(struct cm4000_dev *dev) | |||
1401 | static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 1400 | static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
1402 | { | 1401 | { |
1403 | struct cm4000_dev *dev = filp->private_data; | 1402 | struct cm4000_dev *dev = filp->private_data; |
1404 | unsigned int iobase = dev->p_dev->io.BasePort1; | 1403 | unsigned int iobase = dev->p_dev->resource[0]->start; |
1405 | struct inode *inode = filp->f_path.dentry->d_inode; | 1404 | struct inode *inode = filp->f_path.dentry->d_inode; |
1406 | struct pcmcia_device *link; | 1405 | struct pcmcia_device *link; |
1407 | int size; | 1406 | int size; |
@@ -1752,17 +1751,12 @@ static int cm4000_config_check(struct pcmcia_device *p_dev, | |||
1752 | if (!cfg->io.nwin) | 1751 | if (!cfg->io.nwin) |
1753 | return -ENODEV; | 1752 | return -ENODEV; |
1754 | 1753 | ||
1755 | /* Get the IOaddr */ | 1754 | p_dev->resource[0]->start = cfg->io.win[0].base; |
1756 | p_dev->io.BasePort1 = cfg->io.win[0].base; | 1755 | p_dev->resource[0]->end = cfg->io.win[0].len; |
1757 | p_dev->io.NumPorts1 = cfg->io.win[0].len; | 1756 | p_dev->resource[0]->flags |= pcmcia_io_cfg_data_width(cfg->io.flags); |
1758 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 1757 | p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK; |
1759 | if (!(cfg->io.flags & CISTPL_IO_8BIT)) | 1758 | |
1760 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 1759 | return pcmcia_request_io(p_dev); |
1761 | if (!(cfg->io.flags & CISTPL_IO_16BIT)) | ||
1762 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
1763 | p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK; | ||
1764 | |||
1765 | return pcmcia_request_io(p_dev, &p_dev->io); | ||
1766 | } | 1760 | } |
1767 | 1761 | ||
1768 | static int cm4000_config(struct pcmcia_device * link, int devno) | 1762 | static int cm4000_config(struct pcmcia_device * link, int devno) |
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; |
diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index 63c32e3f23ba..67bdb05798b1 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c | |||
@@ -84,23 +84,22 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, | |||
84 | { | 84 | { |
85 | struct ipw_dev *ipw = priv_data; | 85 | struct ipw_dev *ipw = priv_data; |
86 | struct resource *io_resource; | 86 | struct resource *io_resource; |
87 | memreq_t memreq_attr_memory; | ||
88 | memreq_t memreq_common_memory; | ||
89 | int ret; | 87 | int ret; |
90 | 88 | ||
91 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 89 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
92 | p_dev->io.BasePort1 = cfg->io.win[0].base; | 90 | p_dev->resource[0]->start = cfg->io.win[0].base; |
93 | p_dev->io.NumPorts1 = cfg->io.win[0].len; | 91 | p_dev->resource[0]->end = cfg->io.win[0].len; |
94 | p_dev->io.IOAddrLines = 16; | ||
95 | 92 | ||
96 | /* 0x40 causes it to generate level mode interrupts. */ | 93 | /* 0x40 causes it to generate level mode interrupts. */ |
97 | /* 0x04 enables IREQ pin. */ | 94 | /* 0x04 enables IREQ pin. */ |
98 | p_dev->conf.ConfigIndex = cfg->index | 0x44; | 95 | p_dev->conf.ConfigIndex = cfg->index | 0x44; |
99 | ret = pcmcia_request_io(p_dev, &p_dev->io); | 96 | p_dev->io_lines = 16; |
97 | ret = pcmcia_request_io(p_dev); | ||
100 | if (ret) | 98 | if (ret) |
101 | return ret; | 99 | return ret; |
102 | 100 | ||
103 | io_resource = request_region(p_dev->io.BasePort1, p_dev->io.NumPorts1, | 101 | io_resource = request_region(p_dev->resource[0]->start, |
102 | resource_size(p_dev->resource[0]), | ||
104 | IPWIRELESS_PCCARD_NAME); | 103 | IPWIRELESS_PCCARD_NAME); |
105 | 104 | ||
106 | if (cfg->mem.nwin == 0) | 105 | if (cfg->mem.nwin == 0) |
@@ -120,11 +119,8 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, | |||
120 | if (ret != 0) | 119 | if (ret != 0) |
121 | goto exit1; | 120 | goto exit1; |
122 | 121 | ||
123 | memreq_common_memory.CardOffset = cfg->mem.win[0].card_addr; | ||
124 | memreq_common_memory.Page = 0; | ||
125 | |||
126 | ret = pcmcia_map_mem_page(p_dev, ipw->handle_common_memory, | 122 | ret = pcmcia_map_mem_page(p_dev, ipw->handle_common_memory, |
127 | &memreq_common_memory); | 123 | cfg->mem.win[0].card_addr); |
128 | 124 | ||
129 | if (ret != 0) | 125 | if (ret != 0) |
130 | goto exit2; | 126 | goto exit2; |
@@ -149,12 +145,7 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, | |||
149 | if (ret != 0) | 145 | if (ret != 0) |
150 | goto exit2; | 146 | goto exit2; |
151 | 147 | ||
152 | memreq_attr_memory.CardOffset = 0; | 148 | ret = pcmcia_map_mem_page(p_dev, ipw->handle_attr_memory, 0); |
153 | memreq_attr_memory.Page = 0; | ||
154 | |||
155 | ret = pcmcia_map_mem_page(p_dev, ipw->handle_attr_memory, | ||
156 | &memreq_attr_memory); | ||
157 | |||
158 | if (ret != 0) | 149 | if (ret != 0) |
159 | goto exit3; | 150 | goto exit3; |
160 | 151 | ||
@@ -166,15 +157,12 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, | |||
166 | return 0; | 157 | return 0; |
167 | 158 | ||
168 | exit3: | 159 | exit3: |
169 | pcmcia_release_window(p_dev, ipw->handle_attr_memory); | ||
170 | exit2: | 160 | exit2: |
171 | if (ipw->common_memory) { | 161 | if (ipw->common_memory) { |
172 | release_mem_region(ipw->request_common_memory.Base, | 162 | release_mem_region(ipw->request_common_memory.Base, |
173 | ipw->request_common_memory.Size); | 163 | ipw->request_common_memory.Size); |
174 | iounmap(ipw->common_memory); | 164 | iounmap(ipw->common_memory); |
175 | pcmcia_release_window(p_dev, ipw->handle_common_memory); | 165 | } |
176 | } else | ||
177 | pcmcia_release_window(p_dev, ipw->handle_common_memory); | ||
178 | exit1: | 166 | exit1: |
179 | release_resource(io_resource); | 167 | release_resource(io_resource); |
180 | pcmcia_disable_device(p_dev); | 168 | pcmcia_disable_device(p_dev); |
@@ -197,7 +185,7 @@ static int config_ipwireless(struct ipw_dev *ipw) | |||
197 | 185 | ||
198 | INIT_WORK(&ipw->work_reboot, signalled_reboot_work); | 186 | INIT_WORK(&ipw->work_reboot, signalled_reboot_work); |
199 | 187 | ||
200 | ipwireless_init_hardware_v1(ipw->hardware, link->io.BasePort1, | 188 | ipwireless_init_hardware_v1(ipw->hardware, link->resource[0]->start, |
201 | ipw->attr_memory, ipw->common_memory, | 189 | ipw->attr_memory, ipw->common_memory, |
202 | ipw->is_v2_card, signalled_reboot_callback, | 190 | ipw->is_v2_card, signalled_reboot_callback, |
203 | ipw); | 191 | ipw); |
@@ -209,10 +197,7 @@ static int config_ipwireless(struct ipw_dev *ipw) | |||
209 | printk(KERN_INFO IPWIRELESS_PCCARD_NAME ": Card type %s\n", | 197 | printk(KERN_INFO IPWIRELESS_PCCARD_NAME ": Card type %s\n", |
210 | ipw->is_v2_card ? "V2/V3" : "V1"); | 198 | ipw->is_v2_card ? "V2/V3" : "V1"); |
211 | printk(KERN_INFO IPWIRELESS_PCCARD_NAME | 199 | printk(KERN_INFO IPWIRELESS_PCCARD_NAME |
212 | ": I/O ports 0x%04x-0x%04x, irq %d\n", | 200 | ": I/O ports %pR, irq %d\n", link->resource[0], |
213 | (unsigned int) link->io.BasePort1, | ||
214 | (unsigned int) (link->io.BasePort1 + | ||
215 | link->io.NumPorts1 - 1), | ||
216 | (unsigned int) link->irq); | 201 | (unsigned int) link->irq); |
217 | if (ipw->attr_memory && ipw->common_memory) | 202 | if (ipw->attr_memory && ipw->common_memory) |
218 | printk(KERN_INFO IPWIRELESS_PCCARD_NAME | 203 | printk(KERN_INFO IPWIRELESS_PCCARD_NAME |
@@ -250,13 +235,12 @@ exit: | |||
250 | release_mem_region(ipw->request_attr_memory.Base, | 235 | release_mem_region(ipw->request_attr_memory.Base, |
251 | ipw->request_attr_memory.Size); | 236 | ipw->request_attr_memory.Size); |
252 | iounmap(ipw->attr_memory); | 237 | iounmap(ipw->attr_memory); |
253 | pcmcia_release_window(link, ipw->handle_attr_memory); | 238 | |
254 | } | 239 | } |
255 | if (ipw->common_memory) { | 240 | if (ipw->common_memory) { |
256 | release_mem_region(ipw->request_common_memory.Base, | 241 | release_mem_region(ipw->request_common_memory.Base, |
257 | ipw->request_common_memory.Size); | 242 | ipw->request_common_memory.Size); |
258 | iounmap(ipw->common_memory); | 243 | iounmap(ipw->common_memory); |
259 | pcmcia_release_window(link, ipw->handle_common_memory); | ||
260 | } | 244 | } |
261 | pcmcia_disable_device(link); | 245 | pcmcia_disable_device(link); |
262 | return -1; | 246 | return -1; |
@@ -274,11 +258,6 @@ static void release_ipwireless(struct ipw_dev *ipw) | |||
274 | ipw->request_attr_memory.Size); | 258 | ipw->request_attr_memory.Size); |
275 | iounmap(ipw->attr_memory); | 259 | iounmap(ipw->attr_memory); |
276 | } | 260 | } |
277 | if (ipw->common_memory) | ||
278 | pcmcia_release_window(ipw->link, ipw->handle_common_memory); | ||
279 | if (ipw->attr_memory) | ||
280 | pcmcia_release_window(ipw->link, ipw->handle_attr_memory); | ||
281 | |||
282 | pcmcia_disable_device(ipw->link); | 261 | pcmcia_disable_device(ipw->link); |
283 | } | 262 | } |
284 | 263 | ||
diff --git a/drivers/char/pcmcia/ipwireless/main.h b/drivers/char/pcmcia/ipwireless/main.h index 96d0ef31b172..c207be87b597 100644 --- a/drivers/char/pcmcia/ipwireless/main.h +++ b/drivers/char/pcmcia/ipwireless/main.h | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/sched.h> | 21 | #include <linux/sched.h> |
22 | #include <linux/types.h> | 22 | #include <linux/types.h> |
23 | 23 | ||
24 | #include <pcmcia/cs_types.h> | ||
25 | #include <pcmcia/cs.h> | 24 | #include <pcmcia/cs.h> |
26 | #include <pcmcia/cistpl.h> | 25 | #include <pcmcia/cistpl.h> |
27 | #include <pcmcia/ds.h> | 26 | #include <pcmcia/ds.h> |
diff --git a/drivers/char/pcmcia/ipwireless/tty.h b/drivers/char/pcmcia/ipwireless/tty.h index 4da6c201f727..3e163d4cab15 100644 --- a/drivers/char/pcmcia/ipwireless/tty.h +++ b/drivers/char/pcmcia/ipwireless/tty.h | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | 23 | ||
24 | #include <pcmcia/cs_types.h> | ||
25 | #include <pcmcia/cs.h> | 24 | #include <pcmcia/cs.h> |
26 | #include <pcmcia/cistpl.h> | 25 | #include <pcmcia/cistpl.h> |
27 | #include <pcmcia/ds.h> | 26 | #include <pcmcia/ds.h> |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 308903ec8bf8..9ecd6bef5d3b 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -70,7 +70,6 @@ | |||
70 | #include <linux/workqueue.h> | 70 | #include <linux/workqueue.h> |
71 | #include <linux/hdlc.h> | 71 | #include <linux/hdlc.h> |
72 | 72 | ||
73 | #include <pcmcia/cs_types.h> | ||
74 | #include <pcmcia/cs.h> | 73 | #include <pcmcia/cs.h> |
75 | #include <pcmcia/cistpl.h> | 74 | #include <pcmcia/cistpl.h> |
76 | #include <pcmcia/cisreg.h> | 75 | #include <pcmcia/cisreg.h> |
@@ -572,18 +571,15 @@ static int mgslpc_ioprobe(struct pcmcia_device *p_dev, | |||
572 | unsigned int vcc, | 571 | unsigned int vcc, |
573 | void *priv_data) | 572 | void *priv_data) |
574 | { | 573 | { |
575 | if (cfg->io.nwin > 0) { | 574 | if (!cfg->io.nwin) |
576 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 575 | return -ENODEV; |
577 | if (!(cfg->io.flags & CISTPL_IO_8BIT)) | 576 | |
578 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 577 | p_dev->resource[0]->start = cfg->io.win[0].base; |
579 | if (!(cfg->io.flags & CISTPL_IO_16BIT)) | 578 | p_dev->resource[0]->end = cfg->io.win[0].len; |
580 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 579 | p_dev->resource[0]->flags |= pcmcia_io_cfg_data_width(cfg->io.flags); |
581 | p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK; | 580 | p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK; |
582 | p_dev->io.BasePort1 = cfg->io.win[0].base; | 581 | |
583 | p_dev->io.NumPorts1 = cfg->io.win[0].len; | 582 | return pcmcia_request_io(p_dev); |
584 | return pcmcia_request_io(p_dev, &p_dev->io); | ||
585 | } | ||
586 | return -ENODEV; | ||
587 | } | 583 | } |
588 | 584 | ||
589 | static int mgslpc_config(struct pcmcia_device *link) | 585 | static int mgslpc_config(struct pcmcia_device *link) |
@@ -610,16 +606,15 @@ static int mgslpc_config(struct pcmcia_device *link) | |||
610 | if (ret) | 606 | if (ret) |
611 | goto failed; | 607 | goto failed; |
612 | 608 | ||
613 | info->io_base = link->io.BasePort1; | 609 | info->io_base = link->resource[0]->start; |
614 | info->irq_level = link->irq; | 610 | info->irq_level = link->irq; |
615 | 611 | ||
616 | dev_info(&link->dev, "index 0x%02x:", | 612 | dev_info(&link->dev, "index 0x%02x:", |
617 | link->conf.ConfigIndex); | 613 | link->conf.ConfigIndex); |
618 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 614 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
619 | printk(", irq %d", link->irq); | 615 | printk(", irq %d", link->irq); |
620 | if (link->io.NumPorts1) | 616 | if (link->resource[0]) |
621 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 617 | printk(", io %pR", link->resource[0]); |
622 | link->io.BasePort1+link->io.NumPorts1-1); | ||
623 | printk("\n"); | 618 | printk("\n"); |
624 | return 0; | 619 | return 0; |
625 | 620 | ||
diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index 0b7815d2581c..2a4cb9c18f01 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <asm/io.h> | 43 | #include <asm/io.h> |
44 | #include <asm/system.h> | 44 | #include <asm/system.h> |
45 | 45 | ||
46 | #include <pcmcia/cs_types.h> | ||
47 | #include <pcmcia/cs.h> | 46 | #include <pcmcia/cs.h> |
48 | #include <pcmcia/cistpl.h> | 47 | #include <pcmcia/cistpl.h> |
49 | #include <pcmcia/ds.h> | 48 | #include <pcmcia/ds.h> |
@@ -98,9 +97,8 @@ static int ide_probe(struct pcmcia_device *link) | |||
98 | info->p_dev = link; | 97 | info->p_dev = link; |
99 | link->priv = info; | 98 | link->priv = info; |
100 | 99 | ||
101 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 100 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
102 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 101 | link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; |
103 | link->io.IOAddrLines = 3; | ||
104 | link->conf.Attributes = CONF_ENABLE_IRQ; | 102 | link->conf.Attributes = CONF_ENABLE_IRQ; |
105 | link->conf.IntType = INT_MEMORY_AND_IO; | 103 | link->conf.IntType = INT_MEMORY_AND_IO; |
106 | 104 | ||
@@ -229,24 +227,27 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, | |||
229 | 227 | ||
230 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 228 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
231 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 229 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
230 | pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; | ||
231 | |||
232 | pdev->conf.ConfigIndex = cfg->index; | 232 | pdev->conf.ConfigIndex = cfg->index; |
233 | pdev->io.BasePort1 = io->win[0].base; | 233 | pdev->resource[0]->start = io->win[0].base; |
234 | pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | 234 | if (!(io->flags & CISTPL_IO_16BIT)) { |
235 | if (!(io->flags & CISTPL_IO_16BIT)) | 235 | pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
236 | pdev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 236 | pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
237 | } | ||
237 | if (io->nwin == 2) { | 238 | if (io->nwin == 2) { |
238 | pdev->io.NumPorts1 = 8; | 239 | pdev->resource[0]->end = 8; |
239 | pdev->io.BasePort2 = io->win[1].base; | 240 | pdev->resource[1]->start = io->win[1].base; |
240 | pdev->io.NumPorts2 = (stk->is_kme) ? 2 : 1; | 241 | pdev->resource[1]->end = (stk->is_kme) ? 2 : 1; |
241 | if (pcmcia_request_io(pdev, &pdev->io) != 0) | 242 | if (pcmcia_request_io(pdev) != 0) |
242 | return -ENODEV; | 243 | return -ENODEV; |
243 | stk->ctl_base = pdev->io.BasePort2; | 244 | stk->ctl_base = pdev->resource[1]->start; |
244 | } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { | 245 | } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { |
245 | pdev->io.NumPorts1 = io->win[0].len; | 246 | pdev->resource[0]->end = io->win[0].len; |
246 | pdev->io.NumPorts2 = 0; | 247 | pdev->resource[1]->end = 0; |
247 | if (pcmcia_request_io(pdev, &pdev->io) != 0) | 248 | if (pcmcia_request_io(pdev) != 0) |
248 | return -ENODEV; | 249 | return -ENODEV; |
249 | stk->ctl_base = pdev->io.BasePort1 + 0x0e; | 250 | stk->ctl_base = pdev->resource[0]->start + 0x0e; |
250 | } else | 251 | } else |
251 | return -ENODEV; | 252 | return -ENODEV; |
252 | /* If we've got this far, we're done */ | 253 | /* If we've got this far, we're done */ |
@@ -280,7 +281,7 @@ static int ide_config(struct pcmcia_device *link) | |||
280 | if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) | 281 | if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) |
281 | goto failed; /* No suitable config found */ | 282 | goto failed; /* No suitable config found */ |
282 | } | 283 | } |
283 | io_base = link->io.BasePort1; | 284 | io_base = link->resource[0]->start; |
284 | ctl_base = stk->ctl_base; | 285 | ctl_base = stk->ctl_base; |
285 | 286 | ||
286 | if (!link->irq) | 287 | if (!link->irq) |
@@ -297,7 +298,7 @@ static int ide_config(struct pcmcia_device *link) | |||
297 | outb(0x81, ctl_base+1); | 298 | outb(0x81, ctl_base+1); |
298 | 299 | ||
299 | host = idecs_register(io_base, ctl_base, link->irq, link); | 300 | host = idecs_register(io_base, ctl_base, link->irq, link); |
300 | if (host == NULL && link->io.NumPorts1 == 0x20) { | 301 | if (host == NULL && resource_size(link->resource[0]) == 0x20) { |
301 | outb(0x02, ctl_base + 0x10); | 302 | outb(0x02, ctl_base + 0x10); |
302 | host = idecs_register(io_base + 0x10, ctl_base + 0x10, | 303 | host = idecs_register(io_base + 0x10, ctl_base + 0x10, |
303 | link->irq, link); | 304 | link->irq, link); |
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index f410d0eb2fef..09b1795516f4 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <asm/io.h> | 20 | #include <asm/io.h> |
21 | #include <asm/system.h> | 21 | #include <asm/system.h> |
22 | 22 | ||
23 | #include <pcmcia/cs_types.h> | ||
24 | #include <pcmcia/cs.h> | 23 | #include <pcmcia/cs.h> |
25 | #include <pcmcia/cistpl.h> | 24 | #include <pcmcia/cistpl.h> |
26 | #include <pcmcia/ciscode.h> | 25 | #include <pcmcia/ciscode.h> |
@@ -76,9 +75,8 @@ static int avmcs_probe(struct pcmcia_device *p_dev) | |||
76 | { | 75 | { |
77 | 76 | ||
78 | /* The io structure describes IO port mapping */ | 77 | /* The io structure describes IO port mapping */ |
79 | p_dev->io.NumPorts1 = 16; | 78 | p_dev->resource[0]->end = 16; |
80 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 79 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
81 | p_dev->io.NumPorts2 = 0; | ||
82 | 80 | ||
83 | /* General socket configuration */ | 81 | /* General socket configuration */ |
84 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; | 82 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
@@ -120,13 +118,9 @@ static int avmcs_configcheck(struct pcmcia_device *p_dev, | |||
120 | if (cf->io.nwin <= 0) | 118 | if (cf->io.nwin <= 0) |
121 | return -ENODEV; | 119 | return -ENODEV; |
122 | 120 | ||
123 | p_dev->io.BasePort1 = cf->io.win[0].base; | 121 | p_dev->resource[0]->start = cf->io.win[0].base; |
124 | p_dev->io.NumPorts1 = cf->io.win[0].len; | 122 | p_dev->resource[0]->end = cf->io.win[0].len; |
125 | p_dev->io.NumPorts2 = 0; | 123 | return pcmcia_request_io(p_dev); |
126 | printk(KERN_INFO "avm_cs: testing i/o %#x-%#x\n", | ||
127 | p_dev->io.BasePort1, | ||
128 | p_dev->io.BasePort1+p_dev->io.NumPorts1-1); | ||
129 | return pcmcia_request_io(p_dev, &p_dev->io); | ||
130 | } | 124 | } |
131 | 125 | ||
132 | static int avmcs_config(struct pcmcia_device *link) | 126 | static int avmcs_config(struct pcmcia_device *link) |
@@ -192,9 +186,10 @@ static int avmcs_config(struct pcmcia_device *link) | |||
192 | default: | 186 | default: |
193 | case AVM_CARDTYPE_B1: addcard = b1pcmcia_addcard_b1; break; | 187 | case AVM_CARDTYPE_B1: addcard = b1pcmcia_addcard_b1; break; |
194 | } | 188 | } |
195 | if ((i = (*addcard)(link->io.BasePort1, link->irq)) < 0) { | 189 | if ((i = (*addcard)(link->resource[0]->start, link->irq)) < 0) { |
196 | dev_err(&link->dev, "avm_cs: failed to add AVM-Controller at i/o %#x, irq %d\n", | 190 | dev_err(&link->dev, |
197 | link->io.BasePort1, link->irq); | 191 | "avm_cs: failed to add AVM-Controller at i/o %#x, irq %d\n", |
192 | (unsigned int) link->resource[0]->start, link->irq); | ||
198 | avmcs_release(link); | 193 | avmcs_release(link); |
199 | return -ENODEV; | 194 | return -ENODEV; |
200 | } | 195 | } |
@@ -212,7 +207,7 @@ static int avmcs_config(struct pcmcia_device *link) | |||
212 | 207 | ||
213 | static void avmcs_release(struct pcmcia_device *link) | 208 | static void avmcs_release(struct pcmcia_device *link) |
214 | { | 209 | { |
215 | b1pcmcia_delcard(link->io.BasePort1, link->irq); | 210 | b1pcmcia_delcard(link->resource[0]->start, link->irq); |
216 | pcmcia_disable_device(link); | 211 | pcmcia_disable_device(link); |
217 | } /* avmcs_release */ | 212 | } /* avmcs_release */ |
218 | 213 | ||
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index a80a7617f16f..94263c22b874 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <asm/io.h> | 20 | #include <asm/io.h> |
21 | #include <asm/system.h> | 21 | #include <asm/system.h> |
22 | 22 | ||
23 | #include <pcmcia/cs_types.h> | ||
24 | #include <pcmcia/cs.h> | 23 | #include <pcmcia/cs.h> |
25 | #include <pcmcia/cistpl.h> | 24 | #include <pcmcia/cistpl.h> |
26 | #include <pcmcia/ds.h> | 25 | #include <pcmcia/ds.h> |
@@ -79,11 +78,10 @@ static int __devinit avma1cs_probe(struct pcmcia_device *p_dev) | |||
79 | dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); | 78 | dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); |
80 | 79 | ||
81 | /* The io structure describes IO port mapping */ | 80 | /* The io structure describes IO port mapping */ |
82 | p_dev->io.NumPorts1 = 16; | 81 | p_dev->resource[0]->end = 16; |
83 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 82 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
84 | p_dev->io.NumPorts2 = 16; | 83 | p_dev->resource[1]->end = 16; |
85 | p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_16; | 84 | p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_16; |
86 | p_dev->io.IOAddrLines = 5; | ||
87 | 85 | ||
88 | /* General socket configuration */ | 86 | /* General socket configuration */ |
89 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; | 87 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
@@ -127,13 +125,10 @@ static int avma1cs_configcheck(struct pcmcia_device *p_dev, | |||
127 | if (cf->io.nwin <= 0) | 125 | if (cf->io.nwin <= 0) |
128 | return -ENODEV; | 126 | return -ENODEV; |
129 | 127 | ||
130 | p_dev->io.BasePort1 = cf->io.win[0].base; | 128 | p_dev->resource[0]->start = cf->io.win[0].base; |
131 | p_dev->io.NumPorts1 = cf->io.win[0].len; | 129 | p_dev->resource[0]->end = cf->io.win[0].len; |
132 | p_dev->io.NumPorts2 = 0; | 130 | p_dev->io_lines = 5; |
133 | printk(KERN_INFO "avma1_cs: testing i/o %#x-%#x\n", | 131 | return pcmcia_request_io(p_dev); |
134 | p_dev->io.BasePort1, | ||
135 | p_dev->io.BasePort1+p_dev->io.NumPorts1-1); | ||
136 | return pcmcia_request_io(p_dev, &p_dev->io); | ||
137 | } | 132 | } |
138 | 133 | ||
139 | 134 | ||
@@ -181,16 +176,18 @@ static int __devinit avma1cs_config(struct pcmcia_device *link) | |||
181 | } | 176 | } |
182 | 177 | ||
183 | printk(KERN_NOTICE "avma1_cs: checking at i/o %#x, irq %d\n", | 178 | printk(KERN_NOTICE "avma1_cs: checking at i/o %#x, irq %d\n", |
184 | link->io.BasePort1, link->irq); | 179 | (unsigned int) link->resource[0]->start, link->irq); |
185 | 180 | ||
186 | icard.para[0] = link->irq; | 181 | icard.para[0] = link->irq; |
187 | icard.para[1] = link->io.BasePort1; | 182 | icard.para[1] = link->resource[0]->start; |
188 | icard.protocol = isdnprot; | 183 | icard.protocol = isdnprot; |
189 | icard.typ = ISDN_CTYPE_A1_PCMCIA; | 184 | icard.typ = ISDN_CTYPE_A1_PCMCIA; |
190 | 185 | ||
191 | i = hisax_init_pcmcia(link, &busy, &icard); | 186 | i = hisax_init_pcmcia(link, &busy, &icard); |
192 | if (i < 0) { | 187 | if (i < 0) { |
193 | printk(KERN_ERR "avma1_cs: failed to initialize AVM A1 PCMCIA %d at i/o %#x\n", i, link->io.BasePort1); | 188 | printk(KERN_ERR "avma1_cs: failed to initialize AVM A1 " |
189 | "PCMCIA %d at i/o %#x\n", i, | ||
190 | (unsigned int) link->resource[0]->start); | ||
194 | avma1cs_release(link); | 191 | avma1cs_release(link); |
195 | return -ENODEV; | 192 | return -ENODEV; |
196 | } | 193 | } |
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index 218927e3a4ea..b3c08aaf41c4 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <asm/io.h> | 46 | #include <asm/io.h> |
47 | #include <asm/system.h> | 47 | #include <asm/system.h> |
48 | 48 | ||
49 | #include <pcmcia/cs_types.h> | ||
50 | #include <pcmcia/cs.h> | 49 | #include <pcmcia/cs.h> |
51 | #include <pcmcia/cistpl.h> | 50 | #include <pcmcia/cistpl.h> |
52 | #include <pcmcia/cisreg.h> | 51 | #include <pcmcia/cisreg.h> |
@@ -127,9 +126,8 @@ static int __devinit elsa_cs_probe(struct pcmcia_device *link) | |||
127 | and attributes of IO windows) are fixed by the nature of the | 126 | and attributes of IO windows) are fixed by the nature of the |
128 | device, and can be hard-wired here. | 127 | device, and can be hard-wired here. |
129 | */ | 128 | */ |
130 | link->io.NumPorts1 = 8; | 129 | link->resource[0]->end = 8; |
131 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 130 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
132 | link->io.IOAddrLines = 3; | ||
133 | 131 | ||
134 | link->conf.Attributes = CONF_ENABLE_IRQ; | 132 | link->conf.Attributes = CONF_ENABLE_IRQ; |
135 | link->conf.IntType = INT_MEMORY_AND_IO; | 133 | link->conf.IntType = INT_MEMORY_AND_IO; |
@@ -174,16 +172,18 @@ static int elsa_cs_configcheck(struct pcmcia_device *p_dev, | |||
174 | { | 172 | { |
175 | int j; | 173 | int j; |
176 | 174 | ||
175 | p_dev->io_lines = 3; | ||
176 | |||
177 | if ((cf->io.nwin > 0) && cf->io.win[0].base) { | 177 | if ((cf->io.nwin > 0) && cf->io.win[0].base) { |
178 | printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n"); | 178 | printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n"); |
179 | p_dev->io.BasePort1 = cf->io.win[0].base; | 179 | p_dev->resource[0]->start = cf->io.win[0].base; |
180 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | 180 | if (!pcmcia_request_io(p_dev)) |
181 | return 0; | 181 | return 0; |
182 | } else { | 182 | } else { |
183 | printk(KERN_INFO "(elsa_cs: looks like the 97 model)\n"); | 183 | printk(KERN_INFO "(elsa_cs: looks like the 97 model)\n"); |
184 | for (j = 0x2f0; j > 0x100; j -= 0x10) { | 184 | for (j = 0x2f0; j > 0x100; j -= 0x10) { |
185 | p_dev->io.BasePort1 = j; | 185 | p_dev->resource[0]->start = j; |
186 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | 186 | if (!pcmcia_request_io(p_dev)) |
187 | return 0; | 187 | return 0; |
188 | } | 188 | } |
189 | } | 189 | } |
@@ -215,23 +215,21 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link) | |||
215 | link->conf.ConfigIndex); | 215 | link->conf.ConfigIndex); |
216 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 216 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
217 | printk(", irq %d", link->irq); | 217 | printk(", irq %d", link->irq); |
218 | if (link->io.NumPorts1) | 218 | if (link->resource[0]) |
219 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 219 | printk(" & %pR", link->resource[0]); |
220 | link->io.BasePort1+link->io.NumPorts1-1); | 220 | if (link->resource[1]) |
221 | if (link->io.NumPorts2) | 221 | printk(" & %pR", link->resource[1]); |
222 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
223 | link->io.BasePort2+link->io.NumPorts2-1); | ||
224 | printk("\n"); | 222 | printk("\n"); |
225 | 223 | ||
226 | icard.para[0] = link->irq; | 224 | icard.para[0] = link->irq; |
227 | icard.para[1] = link->io.BasePort1; | 225 | icard.para[1] = link->resource[0]->start; |
228 | icard.protocol = protocol; | 226 | icard.protocol = protocol; |
229 | icard.typ = ISDN_CTYPE_ELSA_PCMCIA; | 227 | icard.typ = ISDN_CTYPE_ELSA_PCMCIA; |
230 | 228 | ||
231 | i = hisax_init_pcmcia(link, &(((local_info_t*)link->priv)->busy), &icard); | 229 | i = hisax_init_pcmcia(link, &(((local_info_t*)link->priv)->busy), &icard); |
232 | if (i < 0) { | 230 | if (i < 0) { |
233 | printk(KERN_ERR "elsa_cs: failed to initialize Elsa PCMCIA %d at i/o %#x\n", | 231 | printk(KERN_ERR "elsa_cs: failed to initialize Elsa " |
234 | i, link->io.BasePort1); | 232 | "PCMCIA %d with %pR\n", i, link->resource[0]); |
235 | elsa_cs_release(link); | 233 | elsa_cs_release(link); |
236 | } else | 234 | } else |
237 | ((local_info_t*)link->priv)->cardnr = i; | 235 | ((local_info_t*)link->priv)->cardnr = i; |
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 1f4feaab21af..a024192b672a 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <asm/io.h> | 46 | #include <asm/io.h> |
47 | #include <asm/system.h> | 47 | #include <asm/system.h> |
48 | 48 | ||
49 | #include <pcmcia/cs_types.h> | ||
50 | #include <pcmcia/cs.h> | 49 | #include <pcmcia/cs.h> |
51 | #include <pcmcia/cistpl.h> | 50 | #include <pcmcia/cistpl.h> |
52 | #include <pcmcia/cisreg.h> | 51 | #include <pcmcia/cisreg.h> |
@@ -130,9 +129,8 @@ static int __devinit sedlbauer_probe(struct pcmcia_device *link) | |||
130 | /* from old sedl_cs | 129 | /* from old sedl_cs |
131 | */ | 130 | */ |
132 | /* The io structure describes IO port mapping */ | 131 | /* The io structure describes IO port mapping */ |
133 | link->io.NumPorts1 = 8; | 132 | link->resource[0]->end = 8; |
134 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 133 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
135 | link->io.IOAddrLines = 3; | ||
136 | 134 | ||
137 | link->conf.Attributes = 0; | 135 | link->conf.Attributes = 0; |
138 | link->conf.IntType = INT_MEMORY_AND_IO; | 136 | link->conf.IntType = INT_MEMORY_AND_IO; |
@@ -173,8 +171,6 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, | |||
173 | unsigned int vcc, | 171 | unsigned int vcc, |
174 | void *priv_data) | 172 | void *priv_data) |
175 | { | 173 | { |
176 | win_req_t *req = priv_data; | ||
177 | |||
178 | if (cfg->index == 0) | 174 | if (cfg->index == 0) |
179 | return -ENODEV; | 175 | return -ENODEV; |
180 | 176 | ||
@@ -202,52 +198,25 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, | |||
202 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 198 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
203 | 199 | ||
204 | /* IO window settings */ | 200 | /* IO window settings */ |
205 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 201 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
206 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 202 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
207 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 203 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
208 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 204 | p_dev->resource[0]->start = io->win[0].base; |
209 | if (!(io->flags & CISTPL_IO_8BIT)) | 205 | p_dev->resource[0]->end = io->win[0].len; |
210 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 206 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
211 | if (!(io->flags & CISTPL_IO_16BIT)) | 207 | p_dev->resource[0]->flags |= |
212 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 208 | pcmcia_io_cfg_data_width(io->flags); |
213 | p_dev->io.BasePort1 = io->win[0].base; | ||
214 | p_dev->io.NumPorts1 = io->win[0].len; | ||
215 | if (io->nwin > 1) { | 209 | if (io->nwin > 1) { |
216 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 210 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
217 | p_dev->io.BasePort2 = io->win[1].base; | 211 | p_dev->resource[1]->start = io->win[1].base; |
218 | p_dev->io.NumPorts2 = io->win[1].len; | 212 | p_dev->resource[1]->end = io->win[1].len; |
219 | } | 213 | } |
220 | /* This reserves IO space but doesn't actually enable it */ | 214 | /* This reserves IO space but doesn't actually enable it */ |
221 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | 215 | p_dev->io_lines = 3; |
216 | if (pcmcia_request_io(p_dev) != 0) | ||
222 | return -ENODEV; | 217 | return -ENODEV; |
223 | } | 218 | } |
224 | 219 | ||
225 | /* | ||
226 | Now set up a common memory window, if needed. There is room | ||
227 | in the struct pcmcia_device structure for one memory window handle, | ||
228 | but if the base addresses need to be saved, or if multiple | ||
229 | windows are needed, the info should go in the private data | ||
230 | structure for this device. | ||
231 | |||
232 | Note that the memory window base is a physical address, and | ||
233 | needs to be mapped to virtual space with ioremap() before it | ||
234 | is used. | ||
235 | */ | ||
236 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { | ||
237 | cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; | ||
238 | memreq_t map; | ||
239 | req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; | ||
240 | req->Attributes |= WIN_ENABLE; | ||
241 | req->Base = mem->win[0].host_addr; | ||
242 | req->Size = mem->win[0].len; | ||
243 | req->AccessSpeed = 0; | ||
244 | if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0) | ||
245 | return -ENODEV; | ||
246 | map.Page = 0; | ||
247 | map.CardOffset = mem->win[0].card_addr; | ||
248 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0) | ||
249 | return -ENODEV; | ||
250 | } | ||
251 | return 0; | 220 | return 0; |
252 | } | 221 | } |
253 | 222 | ||
@@ -255,16 +224,11 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, | |||
255 | 224 | ||
256 | static int __devinit sedlbauer_config(struct pcmcia_device *link) | 225 | static int __devinit sedlbauer_config(struct pcmcia_device *link) |
257 | { | 226 | { |
258 | win_req_t *req; | ||
259 | int ret; | 227 | int ret; |
260 | IsdnCard_t icard; | 228 | IsdnCard_t icard; |
261 | 229 | ||
262 | dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); | 230 | dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); |
263 | 231 | ||
264 | req = kzalloc(sizeof(win_req_t), GFP_KERNEL); | ||
265 | if (!req) | ||
266 | return -ENOMEM; | ||
267 | |||
268 | /* | 232 | /* |
269 | In this loop, we scan the CIS for configuration table entries, | 233 | In this loop, we scan the CIS for configuration table entries, |
270 | each of which describes a valid card configuration, including | 234 | each of which describes a valid card configuration, including |
@@ -277,7 +241,7 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) | |||
277 | these things without consulting the CIS, and most client drivers | 241 | these things without consulting the CIS, and most client drivers |
278 | will only use the CIS to fill in implementation-defined details. | 242 | will only use the CIS to fill in implementation-defined details. |
279 | */ | 243 | */ |
280 | ret = pcmcia_loop_config(link, sedlbauer_config_check, req); | 244 | ret = pcmcia_loop_config(link, sedlbauer_config_check, NULL); |
281 | if (ret) | 245 | if (ret) |
282 | goto failed; | 246 | goto failed; |
283 | 247 | ||
@@ -297,27 +261,22 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) | |||
297 | printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); | 261 | printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); |
298 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 262 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
299 | printk(", irq %d", link->irq); | 263 | printk(", irq %d", link->irq); |
300 | if (link->io.NumPorts1) | 264 | if (link->resource[0]) |
301 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 265 | printk(" & %pR", link->resource[0]); |
302 | link->io.BasePort1+link->io.NumPorts1-1); | 266 | if (link->resource[1]) |
303 | if (link->io.NumPorts2) | 267 | printk(" & %pR", link->resource[1]); |
304 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
305 | link->io.BasePort2+link->io.NumPorts2-1); | ||
306 | if (link->win) | ||
307 | printk(", mem 0x%06lx-0x%06lx", req->Base, | ||
308 | req->Base+req->Size-1); | ||
309 | printk("\n"); | 268 | printk("\n"); |
310 | 269 | ||
311 | icard.para[0] = link->irq; | 270 | icard.para[0] = link->irq; |
312 | icard.para[1] = link->io.BasePort1; | 271 | icard.para[1] = link->resource[0]->start; |
313 | icard.protocol = protocol; | 272 | icard.protocol = protocol; |
314 | icard.typ = ISDN_CTYPE_SEDLBAUER_PCMCIA; | 273 | icard.typ = ISDN_CTYPE_SEDLBAUER_PCMCIA; |
315 | 274 | ||
316 | ret = hisax_init_pcmcia(link, | 275 | ret = hisax_init_pcmcia(link, |
317 | &(((local_info_t *)link->priv)->stop), &icard); | 276 | &(((local_info_t *)link->priv)->stop), &icard); |
318 | if (ret < 0) { | 277 | if (ret < 0) { |
319 | printk(KERN_ERR "sedlbauer_cs: failed to initialize SEDLBAUER PCMCIA %d at i/o %#x\n", | 278 | printk(KERN_ERR "sedlbauer_cs: failed to initialize SEDLBAUER PCMCIA %d with %pR\n", |
320 | ret, link->io.BasePort1); | 279 | ret, link->resource[0]); |
321 | sedlbauer_release(link); | 280 | sedlbauer_release(link); |
322 | return -ENODEV; | 281 | return -ENODEV; |
323 | } else | 282 | } else |
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 5771955cc532..7296102ca255 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <asm/io.h> | 27 | #include <asm/io.h> |
28 | #include <asm/system.h> | 28 | #include <asm/system.h> |
29 | 29 | ||
30 | #include <pcmcia/cs_types.h> | ||
31 | #include <pcmcia/cs.h> | 30 | #include <pcmcia/cs.h> |
32 | #include <pcmcia/cistpl.h> | 31 | #include <pcmcia/cistpl.h> |
33 | #include <pcmcia/cisreg.h> | 32 | #include <pcmcia/cisreg.h> |
@@ -107,9 +106,8 @@ static int __devinit teles_probe(struct pcmcia_device *link) | |||
107 | and attributes of IO windows) are fixed by the nature of the | 106 | and attributes of IO windows) are fixed by the nature of the |
108 | device, and can be hard-wired here. | 107 | device, and can be hard-wired here. |
109 | */ | 108 | */ |
110 | link->io.NumPorts1 = 96; | 109 | link->resource[0]->end = 96; |
111 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 110 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
112 | link->io.IOAddrLines = 5; | ||
113 | 111 | ||
114 | link->conf.Attributes = CONF_ENABLE_IRQ; | 112 | link->conf.Attributes = CONF_ENABLE_IRQ; |
115 | link->conf.IntType = INT_MEMORY_AND_IO; | 113 | link->conf.IntType = INT_MEMORY_AND_IO; |
@@ -154,16 +152,18 @@ static int teles_cs_configcheck(struct pcmcia_device *p_dev, | |||
154 | { | 152 | { |
155 | int j; | 153 | int j; |
156 | 154 | ||
155 | p_dev->io_lines = 5; | ||
156 | |||
157 | if ((cf->io.nwin > 0) && cf->io.win[0].base) { | 157 | if ((cf->io.nwin > 0) && cf->io.win[0].base) { |
158 | printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); | 158 | printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); |
159 | p_dev->io.BasePort1 = cf->io.win[0].base; | 159 | p_dev->resource[0]->start = cf->io.win[0].base; |
160 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | 160 | if (!pcmcia_request_io(p_dev)) |
161 | return 0; | 161 | return 0; |
162 | } else { | 162 | } else { |
163 | printk(KERN_INFO "(teles_cs: looks like the 97 model)\n"); | 163 | printk(KERN_INFO "(teles_cs: looks like the 97 model)\n"); |
164 | for (j = 0x2f0; j > 0x100; j -= 0x10) { | 164 | for (j = 0x2f0; j > 0x100; j -= 0x10) { |
165 | p_dev->io.BasePort1 = j; | 165 | p_dev->resource[0]->start = j; |
166 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | 166 | if (!pcmcia_request_io(p_dev)) |
167 | return 0; | 167 | return 0; |
168 | } | 168 | } |
169 | } | 169 | } |
@@ -195,23 +195,21 @@ static int __devinit teles_cs_config(struct pcmcia_device *link) | |||
195 | link->conf.ConfigIndex); | 195 | link->conf.ConfigIndex); |
196 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 196 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
197 | printk(", irq %d", link->irq); | 197 | printk(", irq %d", link->irq); |
198 | if (link->io.NumPorts1) | 198 | if (link->resource[0]) |
199 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 199 | printk(" & %pR", link->resource[0]); |
200 | link->io.BasePort1+link->io.NumPorts1-1); | 200 | if (link->resource[1]) |
201 | if (link->io.NumPorts2) | 201 | printk(" & %pR", link->resource[1]); |
202 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
203 | link->io.BasePort2+link->io.NumPorts2-1); | ||
204 | printk("\n"); | 202 | printk("\n"); |
205 | 203 | ||
206 | icard.para[0] = link->irq; | 204 | icard.para[0] = link->irq; |
207 | icard.para[1] = link->io.BasePort1; | 205 | icard.para[1] = link->resource[0]->start; |
208 | icard.protocol = protocol; | 206 | icard.protocol = protocol; |
209 | icard.typ = ISDN_CTYPE_TELESPCMCIA; | 207 | icard.typ = ISDN_CTYPE_TELESPCMCIA; |
210 | 208 | ||
211 | i = hisax_init_pcmcia(link, &(((local_info_t*)link->priv)->busy), &icard); | 209 | i = hisax_init_pcmcia(link, &(((local_info_t*)link->priv)->busy), &icard); |
212 | if (i < 0) { | 210 | if (i < 0) { |
213 | printk(KERN_ERR "teles_cs: failed to initialize Teles PCMCIA %d at i/o %#x\n", | 211 | printk(KERN_ERR "teles_cs: failed to initialize Teles PCMCIA %d at i/o %#x\n", |
214 | i, link->io.BasePort1); | 212 | i, (unsigned int) link->resource[0]->start); |
215 | teles_cs_release(link); | 213 | teles_cs_release(link); |
216 | return -ENODEV; | 214 | return -ENODEV; |
217 | } | 215 | } |
diff --git a/drivers/mmc/host/sdricoh_cs.c b/drivers/mmc/host/sdricoh_cs.c index e7507af3856e..7aa65bb2af4a 100644 --- a/drivers/mmc/host/sdricoh_cs.c +++ b/drivers/mmc/host/sdricoh_cs.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/ioport.h> | 30 | #include <linux/ioport.h> |
31 | #include <linux/scatterlist.h> | 31 | #include <linux/scatterlist.h> |
32 | 32 | ||
33 | #include <pcmcia/cs_types.h> | ||
34 | #include <pcmcia/cs.h> | 33 | #include <pcmcia/cs.h> |
35 | #include <pcmcia/cistpl.h> | 34 | #include <pcmcia/cistpl.h> |
36 | #include <pcmcia/ds.h> | 35 | #include <pcmcia/ds.h> |
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index e699e6ac23df..e9ca5ba7d9d2 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <asm/io.h> | 16 | #include <asm/io.h> |
17 | #include <asm/system.h> | 17 | #include <asm/system.h> |
18 | 18 | ||
19 | #include <pcmcia/cs_types.h> | ||
20 | #include <pcmcia/cs.h> | 19 | #include <pcmcia/cs.h> |
21 | #include <pcmcia/cistpl.h> | 20 | #include <pcmcia/cistpl.h> |
22 | #include <pcmcia/ds.h> | 21 | #include <pcmcia/ds.h> |
@@ -103,7 +102,7 @@ static caddr_t remap_window(struct map_info *map, unsigned long to) | |||
103 | { | 102 | { |
104 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; | 103 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; |
105 | window_handle_t win = (window_handle_t)map->map_priv_2; | 104 | window_handle_t win = (window_handle_t)map->map_priv_2; |
106 | memreq_t mrq; | 105 | unsigned int offset; |
107 | int ret; | 106 | int ret; |
108 | 107 | ||
109 | if (!pcmcia_dev_present(dev->p_dev)) { | 108 | if (!pcmcia_dev_present(dev->p_dev)) { |
@@ -111,15 +110,14 @@ static caddr_t remap_window(struct map_info *map, unsigned long to) | |||
111 | return 0; | 110 | return 0; |
112 | } | 111 | } |
113 | 112 | ||
114 | mrq.CardOffset = to & ~(dev->win_size-1); | 113 | offset = to & ~(dev->win_size-1); |
115 | if(mrq.CardOffset != dev->offset) { | 114 | if (offset != dev->offset) { |
116 | DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x", | 115 | DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x", |
117 | dev->offset, mrq.CardOffset); | 116 | dev->offset, offset); |
118 | mrq.Page = 0; | 117 | ret = pcmcia_map_mem_page(dev->p_dev, win, offset); |
119 | ret = pcmcia_map_mem_page(dev->p_dev, win, &mrq); | ||
120 | if (ret != 0) | 118 | if (ret != 0) |
121 | return NULL; | 119 | return NULL; |
122 | dev->offset = mrq.CardOffset; | 120 | dev->offset = offset; |
123 | } | 121 | } |
124 | return dev->win_base + (to & (dev->win_size-1)); | 122 | return dev->win_base + (to & (dev->win_size-1)); |
125 | } | 123 | } |
@@ -346,7 +344,6 @@ static void pcmciamtd_release(struct pcmcia_device *link) | |||
346 | iounmap(dev->win_base); | 344 | iounmap(dev->win_base); |
347 | dev->win_base = NULL; | 345 | dev->win_base = NULL; |
348 | } | 346 | } |
349 | pcmcia_release_window(link, link->win); | ||
350 | } | 347 | } |
351 | pcmcia_disable_device(link); | 348 | pcmcia_disable_device(link); |
352 | } | 349 | } |
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index 10ee106a1617..c683f77c6f42 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c | |||
@@ -87,7 +87,6 @@ earlier 3Com products. | |||
87 | #include <linux/bitops.h> | 87 | #include <linux/bitops.h> |
88 | #include <linux/mii.h> | 88 | #include <linux/mii.h> |
89 | 89 | ||
90 | #include <pcmcia/cs_types.h> | ||
91 | #include <pcmcia/cs.h> | 90 | #include <pcmcia/cs.h> |
92 | #include <pcmcia/cistpl.h> | 91 | #include <pcmcia/cistpl.h> |
93 | #include <pcmcia/cisreg.h> | 92 | #include <pcmcia/cisreg.h> |
@@ -279,8 +278,8 @@ static int tc574_probe(struct pcmcia_device *link) | |||
279 | lp->p_dev = link; | 278 | lp->p_dev = link; |
280 | 279 | ||
281 | spin_lock_init(&lp->window_lock); | 280 | spin_lock_init(&lp->window_lock); |
282 | link->io.NumPorts1 = 32; | 281 | link->resource[0]->end = 32; |
283 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 282 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; |
284 | link->conf.Attributes = CONF_ENABLE_IRQ; | 283 | link->conf.Attributes = CONF_ENABLE_IRQ; |
285 | link->conf.IntType = INT_MEMORY_AND_IO; | 284 | link->conf.IntType = INT_MEMORY_AND_IO; |
286 | link->conf.ConfigIndex = 1; | 285 | link->conf.ConfigIndex = 1; |
@@ -338,10 +337,11 @@ static int tc574_config(struct pcmcia_device *link) | |||
338 | 337 | ||
339 | dev_dbg(&link->dev, "3c574_config()\n"); | 338 | dev_dbg(&link->dev, "3c574_config()\n"); |
340 | 339 | ||
341 | link->io.IOAddrLines = 16; | 340 | link->io_lines = 16; |
341 | |||
342 | for (i = j = 0; j < 0x400; j += 0x20) { | 342 | for (i = j = 0; j < 0x400; j += 0x20) { |
343 | link->io.BasePort1 = j ^ 0x300; | 343 | link->resource[0]->start = j ^ 0x300; |
344 | i = pcmcia_request_io(link, &link->io); | 344 | i = pcmcia_request_io(link); |
345 | if (i == 0) | 345 | if (i == 0) |
346 | break; | 346 | break; |
347 | } | 347 | } |
@@ -357,7 +357,7 @@ static int tc574_config(struct pcmcia_device *link) | |||
357 | goto failed; | 357 | goto failed; |
358 | 358 | ||
359 | dev->irq = link->irq; | 359 | dev->irq = link->irq; |
360 | dev->base_addr = link->io.BasePort1; | 360 | dev->base_addr = link->resource[0]->start; |
361 | 361 | ||
362 | ioaddr = dev->base_addr; | 362 | ioaddr = dev->base_addr; |
363 | 363 | ||
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index ce63c3773b4c..61f9cf2100ff 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <linux/bitops.h> | 41 | #include <linux/bitops.h> |
42 | #include <linux/jiffies.h> | 42 | #include <linux/jiffies.h> |
43 | 43 | ||
44 | #include <pcmcia/cs_types.h> | ||
45 | #include <pcmcia/cs.h> | 44 | #include <pcmcia/cs.h> |
46 | #include <pcmcia/cistpl.h> | 45 | #include <pcmcia/cistpl.h> |
47 | #include <pcmcia/cisreg.h> | 46 | #include <pcmcia/cisreg.h> |
@@ -214,8 +213,8 @@ static int tc589_probe(struct pcmcia_device *link) | |||
214 | lp->p_dev = link; | 213 | lp->p_dev = link; |
215 | 214 | ||
216 | spin_lock_init(&lp->lock); | 215 | spin_lock_init(&lp->lock); |
217 | link->io.NumPorts1 = 16; | 216 | link->resource[0]->end = 16; |
218 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 217 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; |
219 | 218 | ||
220 | link->conf.Attributes = CONF_ENABLE_IRQ; | 219 | link->conf.Attributes = CONF_ENABLE_IRQ; |
221 | link->conf.IntType = INT_MEMORY_AND_IO; | 220 | link->conf.IntType = INT_MEMORY_AND_IO; |
@@ -278,12 +277,13 @@ static int tc589_config(struct pcmcia_device *link) | |||
278 | "3Com card??\n"); | 277 | "3Com card??\n"); |
279 | multi = (link->card_id == PRODID_3COM_3C562); | 278 | multi = (link->card_id == PRODID_3COM_3C562); |
280 | 279 | ||
280 | link->io_lines = 16; | ||
281 | |||
281 | /* For the 3c562, the base address must be xx00-xx7f */ | 282 | /* For the 3c562, the base address must be xx00-xx7f */ |
282 | link->io.IOAddrLines = 16; | ||
283 | for (i = j = 0; j < 0x400; j += 0x10) { | 283 | for (i = j = 0; j < 0x400; j += 0x10) { |
284 | if (multi && (j & 0x80)) continue; | 284 | if (multi && (j & 0x80)) continue; |
285 | link->io.BasePort1 = j ^ 0x300; | 285 | link->resource[0]->start = j ^ 0x300; |
286 | i = pcmcia_request_io(link, &link->io); | 286 | i = pcmcia_request_io(link); |
287 | if (i == 0) | 287 | if (i == 0) |
288 | break; | 288 | break; |
289 | } | 289 | } |
@@ -299,7 +299,7 @@ static int tc589_config(struct pcmcia_device *link) | |||
299 | goto failed; | 299 | goto failed; |
300 | 300 | ||
301 | dev->irq = link->irq; | 301 | dev->irq = link->irq; |
302 | dev->base_addr = link->io.BasePort1; | 302 | dev->base_addr = link->resource[0]->start; |
303 | ioaddr = dev->base_addr; | 303 | ioaddr = dev->base_addr; |
304 | EL3WINDOW(0); | 304 | EL3WINDOW(0); |
305 | 305 | ||
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 33525bf2a3d3..5f05ffb240cc 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <linux/mii.h> | 39 | #include <linux/mii.h> |
40 | #include "../8390.h" | 40 | #include "../8390.h" |
41 | 41 | ||
42 | #include <pcmcia/cs_types.h> | ||
43 | #include <pcmcia/cs.h> | 42 | #include <pcmcia/cs.h> |
44 | #include <pcmcia/cistpl.h> | 43 | #include <pcmcia/cistpl.h> |
45 | #include <pcmcia/ciscode.h> | 44 | #include <pcmcia/ciscode.h> |
@@ -260,28 +259,30 @@ static int get_prom(struct pcmcia_device *link) | |||
260 | static int try_io_port(struct pcmcia_device *link) | 259 | static int try_io_port(struct pcmcia_device *link) |
261 | { | 260 | { |
262 | int j, ret; | 261 | int j, ret; |
263 | if (link->io.NumPorts1 == 32) { | 262 | link->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
264 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 263 | link->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; |
264 | if (link->resource[0]->end == 32) { | ||
265 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; | ||
265 | /* for master/slave multifunction cards */ | 266 | /* for master/slave multifunction cards */ |
266 | if (link->io.NumPorts2 > 0) | 267 | if (link->resource[1]->end > 0) |
267 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 268 | link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; |
268 | } else { | 269 | } else { |
269 | /* This should be two 16-port windows */ | 270 | /* This should be two 16-port windows */ |
270 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 271 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
271 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; | 272 | link->resource[1]->flags |= IO_DATA_PATH_WIDTH_16; |
272 | } | 273 | } |
273 | if (link->io.BasePort1 == 0) { | 274 | if (link->resource[0]->start == 0) { |
274 | link->io.IOAddrLines = 16; | ||
275 | for (j = 0; j < 0x400; j += 0x20) { | 275 | for (j = 0; j < 0x400; j += 0x20) { |
276 | link->io.BasePort1 = j ^ 0x300; | 276 | link->resource[0]->start = j ^ 0x300; |
277 | link->io.BasePort2 = (j ^ 0x300) + 0x10; | 277 | link->resource[1]->start = (j ^ 0x300) + 0x10; |
278 | ret = pcmcia_request_io(link, &link->io); | 278 | link->io_lines = 16; |
279 | ret = pcmcia_request_io(link); | ||
279 | if (ret == 0) | 280 | if (ret == 0) |
280 | return ret; | 281 | return ret; |
281 | } | 282 | } |
282 | return ret; | 283 | return ret; |
283 | } else { | 284 | } else { |
284 | return pcmcia_request_io(link, &link->io); | 285 | return pcmcia_request_io(link); |
285 | } | 286 | } |
286 | } | 287 | } |
287 | 288 | ||
@@ -302,15 +303,15 @@ static int axnet_configcheck(struct pcmcia_device *p_dev, | |||
302 | network function with window 0, and serial with window 1 */ | 303 | network function with window 0, and serial with window 1 */ |
303 | if (io->nwin > 1) { | 304 | if (io->nwin > 1) { |
304 | i = (io->win[1].len > io->win[0].len); | 305 | i = (io->win[1].len > io->win[0].len); |
305 | p_dev->io.BasePort2 = io->win[1-i].base; | 306 | p_dev->resource[1]->start = io->win[1-i].base; |
306 | p_dev->io.NumPorts2 = io->win[1-i].len; | 307 | p_dev->resource[1]->end = io->win[1-i].len; |
307 | } else { | 308 | } else { |
308 | i = p_dev->io.NumPorts2 = 0; | 309 | i = p_dev->resource[1]->end = 0; |
309 | } | 310 | } |
310 | p_dev->io.BasePort1 = io->win[i].base; | 311 | p_dev->resource[0]->start = io->win[i].base; |
311 | p_dev->io.NumPorts1 = io->win[i].len; | 312 | p_dev->resource[0]->end = io->win[i].len; |
312 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | 313 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; |
313 | if (p_dev->io.NumPorts1 + p_dev->io.NumPorts2 >= 32) | 314 | if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) |
314 | return try_io_port(p_dev); | 315 | return try_io_port(p_dev); |
315 | 316 | ||
316 | return -ENODEV; | 317 | return -ENODEV; |
@@ -333,7 +334,7 @@ static int axnet_config(struct pcmcia_device *link) | |||
333 | if (!link->irq) | 334 | if (!link->irq) |
334 | goto failed; | 335 | goto failed; |
335 | 336 | ||
336 | if (link->io.NumPorts2 == 8) { | 337 | if (resource_size(link->resource[1]) == 8) { |
337 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 338 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
338 | link->conf.Status = CCSR_AUDIO_ENA; | 339 | link->conf.Status = CCSR_AUDIO_ENA; |
339 | } | 340 | } |
@@ -343,7 +344,7 @@ static int axnet_config(struct pcmcia_device *link) | |||
343 | goto failed; | 344 | goto failed; |
344 | 345 | ||
345 | dev->irq = link->irq; | 346 | dev->irq = link->irq; |
346 | dev->base_addr = link->io.BasePort1; | 347 | dev->base_addr = link->resource[0]->start; |
347 | 348 | ||
348 | if (!get_prom(link)) { | 349 | if (!get_prom(link)) { |
349 | printk(KERN_NOTICE "axnet_cs: this is not an AX88190 card!\n"); | 350 | printk(KERN_NOTICE "axnet_cs: this is not an AX88190 card!\n"); |
@@ -379,8 +380,7 @@ static int axnet_config(struct pcmcia_device *link) | |||
379 | /* Maybe PHY is in power down mode. (PPD_SET = 1) | 380 | /* Maybe PHY is in power down mode. (PPD_SET = 1) |
380 | Bit 2 of CCSR is active low. */ | 381 | Bit 2 of CCSR is active low. */ |
381 | if (i == 32) { | 382 | if (i == 32) { |
382 | conf_reg_t reg = { 0, CS_WRITE, CISREG_CCSR, 0x04 }; | 383 | pcmcia_write_config_byte(link, CISREG_CCSR, 0x04); |
383 | pcmcia_access_configuration_register(link, ®); | ||
384 | for (i = 0; i < 32; i++) { | 384 | for (i = 0; i < 32; i++) { |
385 | j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1); | 385 | j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1); |
386 | j2 = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 2); | 386 | j2 = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 2); |
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index 5643f94541bc..3c400cfa82ae 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <linux/arcdevice.h> | 43 | #include <linux/arcdevice.h> |
44 | #include <linux/com20020.h> | 44 | #include <linux/com20020.h> |
45 | 45 | ||
46 | #include <pcmcia/cs_types.h> | ||
47 | #include <pcmcia/cs.h> | 46 | #include <pcmcia/cs.h> |
48 | #include <pcmcia/cistpl.h> | 47 | #include <pcmcia/cistpl.h> |
49 | #include <pcmcia/ds.h> | 48 | #include <pcmcia/ds.h> |
@@ -159,9 +158,8 @@ static int com20020_probe(struct pcmcia_device *p_dev) | |||
159 | /* fill in our module parameters as defaults */ | 158 | /* fill in our module parameters as defaults */ |
160 | dev->dev_addr[0] = node; | 159 | dev->dev_addr[0] = node; |
161 | 160 | ||
162 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 161 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
163 | p_dev->io.NumPorts1 = 16; | 162 | p_dev->resource[0]->end = 16; |
164 | p_dev->io.IOAddrLines = 16; | ||
165 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; | 163 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
166 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | 164 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
167 | 165 | ||
@@ -246,20 +244,24 @@ static int com20020_config(struct pcmcia_device *link) | |||
246 | 244 | ||
247 | dev_dbg(&link->dev, "com20020_config\n"); | 245 | dev_dbg(&link->dev, "com20020_config\n"); |
248 | 246 | ||
249 | dev_dbg(&link->dev, "baseport1 is %Xh\n", link->io.BasePort1); | 247 | dev_dbg(&link->dev, "baseport1 is %Xh\n", |
248 | (unsigned int) link->resource[0]->start); | ||
249 | |||
250 | i = -ENODEV; | 250 | i = -ENODEV; |
251 | if (!link->io.BasePort1) | 251 | link->io_lines = 16; |
252 | |||
253 | if (!link->resource[0]->start) | ||
252 | { | 254 | { |
253 | for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10) | 255 | for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10) |
254 | { | 256 | { |
255 | link->io.BasePort1 = ioaddr; | 257 | link->resource[0]->start = ioaddr; |
256 | i = pcmcia_request_io(link, &link->io); | 258 | i = pcmcia_request_io(link); |
257 | if (i == 0) | 259 | if (i == 0) |
258 | break; | 260 | break; |
259 | } | 261 | } |
260 | } | 262 | } |
261 | else | 263 | else |
262 | i = pcmcia_request_io(link, &link->io); | 264 | i = pcmcia_request_io(link); |
263 | 265 | ||
264 | if (i != 0) | 266 | if (i != 0) |
265 | { | 267 | { |
@@ -267,7 +269,7 @@ static int com20020_config(struct pcmcia_device *link) | |||
267 | goto failed; | 269 | goto failed; |
268 | } | 270 | } |
269 | 271 | ||
270 | ioaddr = dev->base_addr = link->io.BasePort1; | 272 | ioaddr = dev->base_addr = link->resource[0]->start; |
271 | dev_dbg(&link->dev, "got ioaddr %Xh\n", ioaddr); | 273 | dev_dbg(&link->dev, "got ioaddr %Xh\n", ioaddr); |
272 | 274 | ||
273 | dev_dbg(&link->dev, "request IRQ %d\n", | 275 | dev_dbg(&link->dev, "request IRQ %d\n", |
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 7c27c50211a5..98fffb03ecd7 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <linux/ioport.h> | 49 | #include <linux/ioport.h> |
50 | #include <linux/crc32.h> | 50 | #include <linux/crc32.h> |
51 | 51 | ||
52 | #include <pcmcia/cs_types.h> | ||
53 | #include <pcmcia/cs.h> | 52 | #include <pcmcia/cs.h> |
54 | #include <pcmcia/cistpl.h> | 53 | #include <pcmcia/cistpl.h> |
55 | #include <pcmcia/ciscode.h> | 54 | #include <pcmcia/ciscode.h> |
@@ -249,9 +248,8 @@ static int fmvj18x_probe(struct pcmcia_device *link) | |||
249 | lp->base = NULL; | 248 | lp->base = NULL; |
250 | 249 | ||
251 | /* The io structure describes IO port mapping */ | 250 | /* The io structure describes IO port mapping */ |
252 | link->io.NumPorts1 = 32; | 251 | link->resource[0]->end = 32; |
253 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 252 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
254 | link->io.IOAddrLines = 5; | ||
255 | 253 | ||
256 | /* General socket configuration */ | 254 | /* General socket configuration */ |
257 | link->conf.Attributes = CONF_ENABLE_IRQ; | 255 | link->conf.Attributes = CONF_ENABLE_IRQ; |
@@ -289,13 +287,13 @@ static int mfc_try_io_port(struct pcmcia_device *link) | |||
289 | { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; | 287 | { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; |
290 | 288 | ||
291 | for (i = 0; i < 5; i++) { | 289 | for (i = 0; i < 5; i++) { |
292 | link->io.BasePort2 = serial_base[i]; | 290 | link->resource[1]->start = serial_base[i]; |
293 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 291 | link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; |
294 | if (link->io.BasePort2 == 0) { | 292 | if (link->resource[1]->start == 0) { |
295 | link->io.NumPorts2 = 0; | 293 | link->resource[1]->end = 0; |
296 | printk(KERN_NOTICE "fmvj18x_cs: out of resource for serial\n"); | 294 | printk(KERN_NOTICE "fmvj18x_cs: out of resource for serial\n"); |
297 | } | 295 | } |
298 | ret = pcmcia_request_io(link, &link->io); | 296 | ret = pcmcia_request_io(link); |
299 | if (ret == 0) | 297 | if (ret == 0) |
300 | return ret; | 298 | return ret; |
301 | } | 299 | } |
@@ -311,12 +309,12 @@ static int ungermann_try_io_port(struct pcmcia_device *link) | |||
311 | 0x380,0x3c0 only for ioport. | 309 | 0x380,0x3c0 only for ioport. |
312 | */ | 310 | */ |
313 | for (ioaddr = 0x300; ioaddr < 0x3e0; ioaddr += 0x20) { | 311 | for (ioaddr = 0x300; ioaddr < 0x3e0; ioaddr += 0x20) { |
314 | link->io.BasePort1 = ioaddr; | 312 | link->resource[0]->start = ioaddr; |
315 | ret = pcmcia_request_io(link, &link->io); | 313 | ret = pcmcia_request_io(link); |
316 | if (ret == 0) { | 314 | if (ret == 0) { |
317 | /* calculate ConfigIndex value */ | 315 | /* calculate ConfigIndex value */ |
318 | link->conf.ConfigIndex = | 316 | link->conf.ConfigIndex = |
319 | ((link->io.BasePort1 & 0x0f0) >> 3) | 0x22; | 317 | ((link->resource[0]->start & 0x0f0) >> 3) | 0x22; |
320 | return ret; | 318 | return ret; |
321 | } | 319 | } |
322 | } | 320 | } |
@@ -346,6 +344,8 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
346 | 344 | ||
347 | dev_dbg(&link->dev, "fmvj18x_config\n"); | 345 | dev_dbg(&link->dev, "fmvj18x_config\n"); |
348 | 346 | ||
347 | link->io_lines = 5; | ||
348 | |||
349 | len = pcmcia_get_tuple(link, CISTPL_FUNCE, &buf); | 349 | len = pcmcia_get_tuple(link, CISTPL_FUNCE, &buf); |
350 | kfree(buf); | 350 | kfree(buf); |
351 | 351 | ||
@@ -364,20 +364,20 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
364 | /* MultiFunction Card */ | 364 | /* MultiFunction Card */ |
365 | link->conf.ConfigBase = 0x800; | 365 | link->conf.ConfigBase = 0x800; |
366 | link->conf.ConfigIndex = 0x47; | 366 | link->conf.ConfigIndex = 0x47; |
367 | link->io.NumPorts2 = 8; | 367 | link->resource[1]->end = 8; |
368 | } | 368 | } |
369 | break; | 369 | break; |
370 | case MANFID_NEC: | 370 | case MANFID_NEC: |
371 | cardtype = NEC; /* MultiFunction Card */ | 371 | cardtype = NEC; /* MultiFunction Card */ |
372 | link->conf.ConfigBase = 0x800; | 372 | link->conf.ConfigBase = 0x800; |
373 | link->conf.ConfigIndex = 0x47; | 373 | link->conf.ConfigIndex = 0x47; |
374 | link->io.NumPorts2 = 8; | 374 | link->resource[1]->end = 8; |
375 | break; | 375 | break; |
376 | case MANFID_KME: | 376 | case MANFID_KME: |
377 | cardtype = KME; /* MultiFunction Card */ | 377 | cardtype = KME; /* MultiFunction Card */ |
378 | link->conf.ConfigBase = 0x800; | 378 | link->conf.ConfigBase = 0x800; |
379 | link->conf.ConfigIndex = 0x47; | 379 | link->conf.ConfigIndex = 0x47; |
380 | link->io.NumPorts2 = 8; | 380 | link->resource[1]->end = 8; |
381 | break; | 381 | break; |
382 | case MANFID_CONTEC: | 382 | case MANFID_CONTEC: |
383 | cardtype = CONTEC; | 383 | cardtype = CONTEC; |
@@ -418,14 +418,14 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
418 | } | 418 | } |
419 | } | 419 | } |
420 | 420 | ||
421 | if (link->io.NumPorts2 != 0) { | 421 | if (link->resource[1]->end != 0) { |
422 | ret = mfc_try_io_port(link); | 422 | ret = mfc_try_io_port(link); |
423 | if (ret != 0) goto failed; | 423 | if (ret != 0) goto failed; |
424 | } else if (cardtype == UNGERMANN) { | 424 | } else if (cardtype == UNGERMANN) { |
425 | ret = ungermann_try_io_port(link); | 425 | ret = ungermann_try_io_port(link); |
426 | if (ret != 0) goto failed; | 426 | if (ret != 0) goto failed; |
427 | } else { | 427 | } else { |
428 | ret = pcmcia_request_io(link, &link->io); | 428 | ret = pcmcia_request_io(link); |
429 | if (ret) | 429 | if (ret) |
430 | goto failed; | 430 | goto failed; |
431 | } | 431 | } |
@@ -437,9 +437,9 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
437 | goto failed; | 437 | goto failed; |
438 | 438 | ||
439 | dev->irq = link->irq; | 439 | dev->irq = link->irq; |
440 | dev->base_addr = link->io.BasePort1; | 440 | dev->base_addr = link->resource[0]->start; |
441 | 441 | ||
442 | if (link->io.BasePort2 != 0) { | 442 | if (resource_size(link->resource[1]) != 0) { |
443 | ret = fmvj18x_setup_mfc(link); | 443 | ret = fmvj18x_setup_mfc(link); |
444 | if (ret != 0) goto failed; | 444 | if (ret != 0) goto failed; |
445 | } | 445 | } |
@@ -545,7 +545,6 @@ failed: | |||
545 | static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) | 545 | static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) |
546 | { | 546 | { |
547 | win_req_t req; | 547 | win_req_t req; |
548 | memreq_t mem; | ||
549 | u_char __iomem *base; | 548 | u_char __iomem *base; |
550 | int i, j; | 549 | int i, j; |
551 | 550 | ||
@@ -558,9 +557,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) | |||
558 | return -1; | 557 | return -1; |
559 | 558 | ||
560 | base = ioremap(req.Base, req.Size); | 559 | base = ioremap(req.Base, req.Size); |
561 | mem.Page = 0; | 560 | pcmcia_map_mem_page(link, link->win, 0); |
562 | mem.CardOffset = 0; | ||
563 | pcmcia_map_mem_page(link, link->win, &mem); | ||
564 | 561 | ||
565 | /* | 562 | /* |
566 | * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format | 563 | * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format |
@@ -594,7 +591,6 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) | |||
594 | static int fmvj18x_setup_mfc(struct pcmcia_device *link) | 591 | static int fmvj18x_setup_mfc(struct pcmcia_device *link) |
595 | { | 592 | { |
596 | win_req_t req; | 593 | win_req_t req; |
597 | memreq_t mem; | ||
598 | int i; | 594 | int i; |
599 | struct net_device *dev = link->priv; | 595 | struct net_device *dev = link->priv; |
600 | unsigned int ioaddr; | 596 | unsigned int ioaddr; |
@@ -614,9 +610,7 @@ static int fmvj18x_setup_mfc(struct pcmcia_device *link) | |||
614 | return -1; | 610 | return -1; |
615 | } | 611 | } |
616 | 612 | ||
617 | mem.Page = 0; | 613 | i = pcmcia_map_mem_page(link, link->win, 0); |
618 | mem.CardOffset = 0; | ||
619 | i = pcmcia_map_mem_page(link, link->win, &mem); | ||
620 | if (i != 0) { | 614 | if (i != 0) { |
621 | iounmap(lp->base); | 615 | iounmap(lp->base); |
622 | lp->base = NULL; | 616 | lp->base = NULL; |
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index 67ee9851a8ed..b0d06a3d962f 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c | |||
@@ -57,7 +57,6 @@ | |||
57 | #include <linux/trdevice.h> | 57 | #include <linux/trdevice.h> |
58 | #include <linux/ibmtr.h> | 58 | #include <linux/ibmtr.h> |
59 | 59 | ||
60 | #include <pcmcia/cs_types.h> | ||
61 | #include <pcmcia/cs.h> | 60 | #include <pcmcia/cs.h> |
62 | #include <pcmcia/cistpl.h> | 61 | #include <pcmcia/cistpl.h> |
63 | #include <pcmcia/ds.h> | 62 | #include <pcmcia/ds.h> |
@@ -152,9 +151,8 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) | |||
152 | link->priv = info; | 151 | link->priv = info; |
153 | info->ti = netdev_priv(dev); | 152 | info->ti = netdev_priv(dev); |
154 | 153 | ||
155 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 154 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
156 | link->io.NumPorts1 = 4; | 155 | link->resource[0]->end = 4; |
157 | link->io.IOAddrLines = 16; | ||
158 | link->conf.Attributes = CONF_ENABLE_IRQ; | 156 | link->conf.Attributes = CONF_ENABLE_IRQ; |
159 | link->conf.IntType = INT_MEMORY_AND_IO; | 157 | link->conf.IntType = INT_MEMORY_AND_IO; |
160 | link->conf.Present = PRESENT_OPTION; | 158 | link->conf.Present = PRESENT_OPTION; |
@@ -213,26 +211,26 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
213 | struct net_device *dev = info->dev; | 211 | struct net_device *dev = info->dev; |
214 | struct tok_info *ti = netdev_priv(dev); | 212 | struct tok_info *ti = netdev_priv(dev); |
215 | win_req_t req; | 213 | win_req_t req; |
216 | memreq_t mem; | ||
217 | int i, ret; | 214 | int i, ret; |
218 | 215 | ||
219 | dev_dbg(&link->dev, "ibmtr_config\n"); | 216 | dev_dbg(&link->dev, "ibmtr_config\n"); |
220 | 217 | ||
221 | link->conf.ConfigIndex = 0x61; | 218 | link->conf.ConfigIndex = 0x61; |
219 | link->io_lines = 16; | ||
222 | 220 | ||
223 | /* Determine if this is PRIMARY or ALTERNATE. */ | 221 | /* Determine if this is PRIMARY or ALTERNATE. */ |
224 | 222 | ||
225 | /* Try PRIMARY card at 0xA20-0xA23 */ | 223 | /* Try PRIMARY card at 0xA20-0xA23 */ |
226 | link->io.BasePort1 = 0xA20; | 224 | link->resource[0]->start = 0xA20; |
227 | i = pcmcia_request_io(link, &link->io); | 225 | i = pcmcia_request_io(link); |
228 | if (i != 0) { | 226 | if (i != 0) { |
229 | /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ | 227 | /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ |
230 | link->io.BasePort1 = 0xA24; | 228 | link->resource[0]->start = 0xA24; |
231 | ret = pcmcia_request_io(link, &link->io); | 229 | ret = pcmcia_request_io(link); |
232 | if (ret) | 230 | if (ret) |
233 | goto failed; | 231 | goto failed; |
234 | } | 232 | } |
235 | dev->base_addr = link->io.BasePort1; | 233 | dev->base_addr = link->resource[0]->start; |
236 | 234 | ||
237 | ret = pcmcia_request_exclusive_irq(link, ibmtr_interrupt); | 235 | ret = pcmcia_request_exclusive_irq(link, ibmtr_interrupt); |
238 | if (ret) | 236 | if (ret) |
@@ -251,9 +249,7 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
251 | if (ret) | 249 | if (ret) |
252 | goto failed; | 250 | goto failed; |
253 | 251 | ||
254 | mem.CardOffset = mmiobase; | 252 | ret = pcmcia_map_mem_page(link, link->win, mmiobase); |
255 | mem.Page = 0; | ||
256 | ret = pcmcia_map_mem_page(link, link->win, &mem); | ||
257 | if (ret) | 253 | if (ret) |
258 | goto failed; | 254 | goto failed; |
259 | ti->mmio = ioremap(req.Base, req.Size); | 255 | ti->mmio = ioremap(req.Base, req.Size); |
@@ -268,13 +264,11 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
268 | if (ret) | 264 | if (ret) |
269 | goto failed; | 265 | goto failed; |
270 | 266 | ||
271 | mem.CardOffset = srambase; | 267 | ret = pcmcia_map_mem_page(link, info->sram_win_handle, srambase); |
272 | mem.Page = 0; | ||
273 | ret = pcmcia_map_mem_page(link, info->sram_win_handle, &mem); | ||
274 | if (ret) | 268 | if (ret) |
275 | goto failed; | 269 | goto failed; |
276 | 270 | ||
277 | ti->sram_base = mem.CardOffset >> 12; | 271 | ti->sram_base = srambase >> 12; |
278 | ti->sram_virt = ioremap(req.Base, req.Size); | 272 | ti->sram_virt = ioremap(req.Base, req.Size); |
279 | ti->sram_phys = req.Base; | 273 | ti->sram_phys = req.Base; |
280 | 274 | ||
@@ -325,7 +319,6 @@ static void ibmtr_release(struct pcmcia_device *link) | |||
325 | if (link->win) { | 319 | if (link->win) { |
326 | struct tok_info *ti = netdev_priv(dev); | 320 | struct tok_info *ti = netdev_priv(dev); |
327 | iounmap(ti->mmio); | 321 | iounmap(ti->mmio); |
328 | pcmcia_release_window(link, info->sram_win_handle); | ||
329 | } | 322 | } |
330 | pcmcia_disable_device(link); | 323 | pcmcia_disable_device(link); |
331 | } | 324 | } |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 9b63dec549cb..68f2deeb3ade 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -146,7 +146,6 @@ Include Files | |||
146 | #include <linux/ioport.h> | 146 | #include <linux/ioport.h> |
147 | #include <linux/bitops.h> | 147 | #include <linux/bitops.h> |
148 | 148 | ||
149 | #include <pcmcia/cs_types.h> | ||
150 | #include <pcmcia/cs.h> | 149 | #include <pcmcia/cs.h> |
151 | #include <pcmcia/cisreg.h> | 150 | #include <pcmcia/cisreg.h> |
152 | #include <pcmcia/cistpl.h> | 151 | #include <pcmcia/cistpl.h> |
@@ -459,9 +458,8 @@ static int nmclan_probe(struct pcmcia_device *link) | |||
459 | link->priv = dev; | 458 | link->priv = dev; |
460 | 459 | ||
461 | spin_lock_init(&lp->bank_lock); | 460 | spin_lock_init(&lp->bank_lock); |
462 | link->io.NumPorts1 = 32; | 461 | link->resource[0]->end = 32; |
463 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 462 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
464 | link->io.IOAddrLines = 5; | ||
465 | link->conf.Attributes = CONF_ENABLE_IRQ; | 463 | link->conf.Attributes = CONF_ENABLE_IRQ; |
466 | link->conf.IntType = INT_MEMORY_AND_IO; | 464 | link->conf.IntType = INT_MEMORY_AND_IO; |
467 | link->conf.ConfigIndex = 1; | 465 | link->conf.ConfigIndex = 1; |
@@ -645,7 +643,8 @@ static int nmclan_config(struct pcmcia_device *link) | |||
645 | 643 | ||
646 | dev_dbg(&link->dev, "nmclan_config\n"); | 644 | dev_dbg(&link->dev, "nmclan_config\n"); |
647 | 645 | ||
648 | ret = pcmcia_request_io(link, &link->io); | 646 | link->io_lines = 5; |
647 | ret = pcmcia_request_io(link); | ||
649 | if (ret) | 648 | if (ret) |
650 | goto failed; | 649 | goto failed; |
651 | ret = pcmcia_request_exclusive_irq(link, mace_interrupt); | 650 | ret = pcmcia_request_exclusive_irq(link, mace_interrupt); |
@@ -656,7 +655,7 @@ static int nmclan_config(struct pcmcia_device *link) | |||
656 | goto failed; | 655 | goto failed; |
657 | 656 | ||
658 | dev->irq = link->irq; | 657 | dev->irq = link->irq; |
659 | dev->base_addr = link->io.BasePort1; | 658 | dev->base_addr = link->resource[0]->start; |
660 | 659 | ||
661 | ioaddr = dev->base_addr; | 660 | ioaddr = dev->base_addr; |
662 | 661 | ||
@@ -758,29 +757,20 @@ static void nmclan_reset(struct net_device *dev) | |||
758 | 757 | ||
759 | #if RESET_XILINX | 758 | #if RESET_XILINX |
760 | struct pcmcia_device *link = &lp->link; | 759 | struct pcmcia_device *link = &lp->link; |
761 | conf_reg_t reg; | 760 | u8 OrigCorValue; |
762 | u_long OrigCorValue; | ||
763 | 761 | ||
764 | /* Save original COR value */ | 762 | /* Save original COR value */ |
765 | reg.Function = 0; | 763 | pcmcia_read_config_byte(link, CISREG_COR, &OrigCorValue); |
766 | reg.Action = CS_READ; | ||
767 | reg.Offset = CISREG_COR; | ||
768 | reg.Value = 0; | ||
769 | pcmcia_access_configuration_register(link, ®); | ||
770 | OrigCorValue = reg.Value; | ||
771 | 764 | ||
772 | /* Reset Xilinx */ | 765 | /* Reset Xilinx */ |
773 | reg.Action = CS_WRITE; | 766 | dev_dbg(&link->dev, "nmclan_reset: OrigCorValue=0x%x, resetting...\n", |
774 | reg.Offset = CISREG_COR; | ||
775 | dev_dbg(&link->dev, "nmclan_reset: OrigCorValue=0x%lX, resetting...\n", | ||
776 | OrigCorValue); | 767 | OrigCorValue); |
777 | reg.Value = COR_SOFT_RESET; | 768 | pcmcia_write_config_byte(link, CISREG_COR, COR_SOFT_RESET); |
778 | pcmcia_access_configuration_register(link, ®); | ||
779 | /* Need to wait for 20 ms for PCMCIA to finish reset. */ | 769 | /* Need to wait for 20 ms for PCMCIA to finish reset. */ |
780 | 770 | ||
781 | /* Restore original COR configuration index */ | 771 | /* Restore original COR configuration index */ |
782 | reg.Value = COR_LEVEL_REQ | (OrigCorValue & COR_CONFIG_MASK); | 772 | pcmcia_write_config_byte(link, CISREG_COR, |
783 | pcmcia_access_configuration_register(link, ®); | 773 | (COR_LEVEL_REQ | (OrigCorValue & COR_CONFIG_MASK))); |
784 | /* Xilinx is now completely reset along with the MACE chip. */ | 774 | /* Xilinx is now completely reset along with the MACE chip. */ |
785 | lp->tx_free_frames=AM2150_MAX_TX_FRAMES; | 775 | lp->tx_free_frames=AM2150_MAX_TX_FRAMES; |
786 | 776 | ||
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 | ||
114 | static void pcnet_detach(struct pcmcia_device *p_dev); | 113 | static void pcnet_detach(struct pcmcia_device *p_dev); |
115 | 114 | ||
116 | static dev_info_t dev_info = "pcnet_cs"; | ||
117 | |||
118 | /*====================================================================*/ | 115 | /*====================================================================*/ |
119 | 116 | ||
120 | typedef struct hw_info_t { | 117 | typedef 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) | |||
480 | static int try_io_port(struct pcmcia_device *link) | 474 | static 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 | ||
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 307cd1721e91..377367d03b41 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #include <linux/jiffies.h> | 44 | #include <linux/jiffies.h> |
45 | #include <linux/firmware.h> | 45 | #include <linux/firmware.h> |
46 | 46 | ||
47 | #include <pcmcia/cs_types.h> | ||
48 | #include <pcmcia/cs.h> | 47 | #include <pcmcia/cs.h> |
49 | #include <pcmcia/cistpl.h> | 48 | #include <pcmcia/cistpl.h> |
50 | #include <pcmcia/cisreg.h> | 49 | #include <pcmcia/cisreg.h> |
@@ -325,9 +324,8 @@ static int smc91c92_probe(struct pcmcia_device *link) | |||
325 | link->priv = dev; | 324 | link->priv = dev; |
326 | 325 | ||
327 | spin_lock_init(&smc->lock); | 326 | spin_lock_init(&smc->lock); |
328 | link->io.NumPorts1 = 16; | 327 | link->resource[0]->end = 16; |
329 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 328 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
330 | link->io.IOAddrLines = 4; | ||
331 | link->conf.Attributes = CONF_ENABLE_IRQ; | 329 | link->conf.Attributes = CONF_ENABLE_IRQ; |
332 | link->conf.IntType = INT_MEMORY_AND_IO; | 330 | link->conf.IntType = INT_MEMORY_AND_IO; |
333 | 331 | ||
@@ -428,12 +426,13 @@ static int mhz_mfc_config_check(struct pcmcia_device *p_dev, | |||
428 | void *priv_data) | 426 | void *priv_data) |
429 | { | 427 | { |
430 | int k; | 428 | int k; |
431 | p_dev->io.BasePort2 = cf->io.win[0].base; | 429 | p_dev->resource[1]->start = cf->io.win[0].base; |
432 | for (k = 0; k < 0x400; k += 0x10) { | 430 | for (k = 0; k < 0x400; k += 0x10) { |
433 | if (k & 0x80) | 431 | if (k & 0x80) |
434 | continue; | 432 | continue; |
435 | p_dev->io.BasePort1 = k ^ 0x300; | 433 | p_dev->resource[0]->start = k ^ 0x300; |
436 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | 434 | p_dev->io_lines = 16; |
435 | if (!pcmcia_request_io(p_dev)) | ||
437 | return 0; | 436 | return 0; |
438 | } | 437 | } |
439 | return -ENODEV; | 438 | return -ENODEV; |
@@ -444,21 +443,20 @@ static int mhz_mfc_config(struct pcmcia_device *link) | |||
444 | struct net_device *dev = link->priv; | 443 | struct net_device *dev = link->priv; |
445 | struct smc_private *smc = netdev_priv(dev); | 444 | struct smc_private *smc = netdev_priv(dev); |
446 | win_req_t req; | 445 | win_req_t req; |
447 | memreq_t mem; | 446 | unsigned int offset; |
448 | int i; | 447 | int i; |
449 | 448 | ||
450 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 449 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
451 | link->conf.Status = CCSR_AUDIO_ENA; | 450 | link->conf.Status = CCSR_AUDIO_ENA; |
452 | link->io.IOAddrLines = 16; | 451 | link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; |
453 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 452 | link->resource[1]->end = 8; |
454 | link->io.NumPorts2 = 8; | ||
455 | 453 | ||
456 | /* The Megahertz combo cards have modem-like CIS entries, so | 454 | /* The Megahertz combo cards have modem-like CIS entries, so |
457 | we have to explicitly try a bunch of port combinations. */ | 455 | we have to explicitly try a bunch of port combinations. */ |
458 | if (pcmcia_loop_config(link, mhz_mfc_config_check, NULL)) | 456 | if (pcmcia_loop_config(link, mhz_mfc_config_check, NULL)) |
459 | return -ENODEV; | 457 | return -ENODEV; |
460 | 458 | ||
461 | dev->base_addr = link->io.BasePort1; | 459 | dev->base_addr = link->resource[0]->start; |
462 | 460 | ||
463 | /* Allocate a memory window, for accessing the ISR */ | 461 | /* Allocate a memory window, for accessing the ISR */ |
464 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 462 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
@@ -469,11 +467,8 @@ static int mhz_mfc_config(struct pcmcia_device *link) | |||
469 | return -ENODEV; | 467 | return -ENODEV; |
470 | 468 | ||
471 | smc->base = ioremap(req.Base, req.Size); | 469 | smc->base = ioremap(req.Base, req.Size); |
472 | mem.CardOffset = mem.Page = 0; | 470 | offset = (smc->manfid == MANFID_MOTOROLA) ? link->conf.ConfigBase : 0; |
473 | if (smc->manfid == MANFID_MOTOROLA) | 471 | i = pcmcia_map_mem_page(link, link->win, offset); |
474 | mem.CardOffset = link->conf.ConfigBase; | ||
475 | i = pcmcia_map_mem_page(link, link->win, &mem); | ||
476 | |||
477 | if ((i == 0) && | 472 | if ((i == 0) && |
478 | (smc->manfid == MANFID_MEGAHERTZ) && | 473 | (smc->manfid == MANFID_MEGAHERTZ) && |
479 | (smc->cardid == PRODID_MEGAHERTZ_EM3288)) | 474 | (smc->cardid == PRODID_MEGAHERTZ_EM3288)) |
@@ -546,7 +541,7 @@ static void mot_config(struct pcmcia_device *link) | |||
546 | struct net_device *dev = link->priv; | 541 | struct net_device *dev = link->priv; |
547 | struct smc_private *smc = netdev_priv(dev); | 542 | struct smc_private *smc = netdev_priv(dev); |
548 | unsigned int ioaddr = dev->base_addr; | 543 | unsigned int ioaddr = dev->base_addr; |
549 | unsigned int iouart = link->io.BasePort2; | 544 | unsigned int iouart = link->resource[1]->start; |
550 | 545 | ||
551 | /* Set UART base address and force map with COR bit 1 */ | 546 | /* Set UART base address and force map with COR bit 1 */ |
552 | writeb(iouart & 0xff, smc->base + MOT_UART + CISREG_IOBASE_0); | 547 | writeb(iouart & 0xff, smc->base + MOT_UART + CISREG_IOBASE_0); |
@@ -602,9 +597,9 @@ static int smc_configcheck(struct pcmcia_device *p_dev, | |||
602 | unsigned int vcc, | 597 | unsigned int vcc, |
603 | void *priv_data) | 598 | void *priv_data) |
604 | { | 599 | { |
605 | p_dev->io.BasePort1 = cf->io.win[0].base; | 600 | p_dev->resource[0]->start = cf->io.win[0].base; |
606 | p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; | 601 | p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; |
607 | return pcmcia_request_io(p_dev, &p_dev->io); | 602 | return pcmcia_request_io(p_dev); |
608 | } | 603 | } |
609 | 604 | ||
610 | static int smc_config(struct pcmcia_device *link) | 605 | static int smc_config(struct pcmcia_device *link) |
@@ -612,10 +607,10 @@ static int smc_config(struct pcmcia_device *link) | |||
612 | struct net_device *dev = link->priv; | 607 | struct net_device *dev = link->priv; |
613 | int i; | 608 | int i; |
614 | 609 | ||
615 | link->io.NumPorts1 = 16; | 610 | link->resource[0]->end = 16; |
616 | i = pcmcia_loop_config(link, smc_configcheck, NULL); | 611 | i = pcmcia_loop_config(link, smc_configcheck, NULL); |
617 | if (!i) | 612 | if (!i) |
618 | dev->base_addr = link->io.BasePort1; | 613 | dev->base_addr = link->resource[0]->start; |
619 | 614 | ||
620 | return i; | 615 | return i; |
621 | } | 616 | } |
@@ -647,27 +642,27 @@ static int osi_config(struct pcmcia_device *link) | |||
647 | 642 | ||
648 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 643 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
649 | link->conf.Status = CCSR_AUDIO_ENA; | 644 | link->conf.Status = CCSR_AUDIO_ENA; |
650 | link->io.NumPorts1 = 64; | 645 | link->resource[0]->end = 64; |
651 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 646 | link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; |
652 | link->io.NumPorts2 = 8; | 647 | link->resource[1]->end = 8; |
653 | link->io.IOAddrLines = 16; | ||
654 | 648 | ||
655 | /* Enable Hard Decode, LAN, Modem */ | 649 | /* Enable Hard Decode, LAN, Modem */ |
656 | link->conf.ConfigIndex = 0x23; | 650 | link->conf.ConfigIndex = 0x23; |
651 | link->io_lines = 16; | ||
657 | 652 | ||
658 | for (i = j = 0; j < 4; j++) { | 653 | for (i = j = 0; j < 4; j++) { |
659 | link->io.BasePort2 = com[j]; | 654 | link->resource[1]->start = com[j]; |
660 | i = pcmcia_request_io(link, &link->io); | 655 | i = pcmcia_request_io(link); |
661 | if (i == 0) | 656 | if (i == 0) |
662 | break; | 657 | break; |
663 | } | 658 | } |
664 | if (i != 0) { | 659 | if (i != 0) { |
665 | /* Fallback: turn off hard decode */ | 660 | /* Fallback: turn off hard decode */ |
666 | link->conf.ConfigIndex = 0x03; | 661 | link->conf.ConfigIndex = 0x03; |
667 | link->io.NumPorts2 = 0; | 662 | link->resource[1]->end = 0; |
668 | i = pcmcia_request_io(link, &link->io); | 663 | i = pcmcia_request_io(link); |
669 | } | 664 | } |
670 | dev->base_addr = link->io.BasePort1 + 0x10; | 665 | dev->base_addr = link->resource[0]->start + 0x10; |
671 | return i; | 666 | return i; |
672 | } | 667 | } |
673 | 668 | ||
@@ -684,7 +679,7 @@ static int osi_load_firmware(struct pcmcia_device *link) | |||
684 | 679 | ||
685 | /* Download the Seven of Diamonds firmware */ | 680 | /* Download the Seven of Diamonds firmware */ |
686 | for (i = 0; i < fw->size; i++) { | 681 | for (i = 0; i < fw->size; i++) { |
687 | outb(fw->data[i], link->io.BasePort1 + 2); | 682 | outb(fw->data[i], link->resource[0]->start + 2); |
688 | udelay(50); | 683 | udelay(50); |
689 | } | 684 | } |
690 | release_firmware(fw); | 685 | release_firmware(fw); |
@@ -726,12 +721,12 @@ static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid) | |||
726 | return rc; | 721 | return rc; |
727 | } else if (manfid == MANFID_OSITECH) { | 722 | } else if (manfid == MANFID_OSITECH) { |
728 | /* Make sure both functions are powered up */ | 723 | /* Make sure both functions are powered up */ |
729 | set_bits(0x300, link->io.BasePort1 + OSITECH_AUI_PWR); | 724 | set_bits(0x300, link->resource[0]->start + OSITECH_AUI_PWR); |
730 | /* Now, turn on the interrupt for both card functions */ | 725 | /* Now, turn on the interrupt for both card functions */ |
731 | set_bits(0x300, link->io.BasePort1 + OSITECH_RESET_ISR); | 726 | set_bits(0x300, link->resource[0]->start + OSITECH_RESET_ISR); |
732 | dev_dbg(&link->dev, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n", | 727 | dev_dbg(&link->dev, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n", |
733 | inw(link->io.BasePort1 + OSITECH_AUI_PWR), | 728 | inw(link->resource[0]->start + OSITECH_AUI_PWR), |
734 | inw(link->io.BasePort1 + OSITECH_RESET_ISR)); | 729 | inw(link->resource[0]->start + OSITECH_RESET_ISR)); |
735 | } | 730 | } |
736 | return 0; | 731 | return 0; |
737 | } | 732 | } |
@@ -804,7 +799,7 @@ static int check_sig(struct pcmcia_device *link) | |||
804 | } | 799 | } |
805 | 800 | ||
806 | /* Try setting bus width */ | 801 | /* Try setting bus width */ |
807 | width = (link->io.Attributes1 == IO_DATA_PATH_WIDTH_AUTO); | 802 | width = (link->resource[0]->flags == IO_DATA_PATH_WIDTH_AUTO); |
808 | s = inb(ioaddr + CONFIG); | 803 | s = inb(ioaddr + CONFIG); |
809 | if (width) | 804 | if (width) |
810 | s |= CFG_16BIT; | 805 | s |= CFG_16BIT; |
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index b6c3644888cd..4eb6f986703b 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -82,7 +82,6 @@ | |||
82 | #include <linux/bitops.h> | 82 | #include <linux/bitops.h> |
83 | #include <linux/mii.h> | 83 | #include <linux/mii.h> |
84 | 84 | ||
85 | #include <pcmcia/cs_types.h> | ||
86 | #include <pcmcia/cs.h> | 85 | #include <pcmcia/cs.h> |
87 | #include <pcmcia/cistpl.h> | 86 | #include <pcmcia/cistpl.h> |
88 | #include <pcmcia/cisreg.h> | 87 | #include <pcmcia/cisreg.h> |
@@ -678,9 +677,9 @@ xirc2ps_config_modem(struct pcmcia_device *p_dev, | |||
678 | 677 | ||
679 | if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { | 678 | if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { |
680 | for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { | 679 | for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { |
681 | p_dev->io.BasePort2 = cf->io.win[0].base; | 680 | p_dev->resource[1]->start = cf->io.win[0].base; |
682 | p_dev->io.BasePort1 = ioaddr; | 681 | p_dev->resource[0]->start = ioaddr; |
683 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | 682 | if (!pcmcia_request_io(p_dev)) |
684 | return 0; | 683 | return 0; |
685 | } | 684 | } |
686 | } | 685 | } |
@@ -697,11 +696,11 @@ xirc2ps_config_check(struct pcmcia_device *p_dev, | |||
697 | int *pass = priv_data; | 696 | int *pass = priv_data; |
698 | 697 | ||
699 | if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { | 698 | if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { |
700 | p_dev->io.BasePort2 = cf->io.win[0].base; | 699 | p_dev->resource[1]->start = cf->io.win[0].base; |
701 | p_dev->io.BasePort1 = p_dev->io.BasePort2 | 700 | p_dev->resource[0]->start = p_dev->resource[1]->start |
702 | + (*pass ? (cf->index & 0x20 ? -24:8) | 701 | + (*pass ? (cf->index & 0x20 ? -24:8) |
703 | : (cf->index & 0x20 ? 8:-24)); | 702 | : (cf->index & 0x20 ? 8:-24)); |
704 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | 703 | if (!pcmcia_request_io(p_dev)) |
705 | return 0; | 704 | return 0; |
706 | } | 705 | } |
707 | return -ENODEV; | 706 | return -ENODEV; |
@@ -808,8 +807,7 @@ xirc2ps_config(struct pcmcia_device * link) | |||
808 | goto failure; | 807 | goto failure; |
809 | } | 808 | } |
810 | 809 | ||
811 | link->io.IOAddrLines =10; | 810 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; |
812 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
813 | if (local->modem) { | 811 | if (local->modem) { |
814 | int pass; | 812 | int pass; |
815 | 813 | ||
@@ -817,16 +815,16 @@ xirc2ps_config(struct pcmcia_device * link) | |||
817 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 815 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
818 | link->conf.Status |= CCSR_AUDIO_ENA; | 816 | link->conf.Status |= CCSR_AUDIO_ENA; |
819 | } | 817 | } |
820 | link->io.NumPorts2 = 8; | 818 | link->resource[1]->end = 8; |
821 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 819 | link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; |
822 | if (local->dingo) { | 820 | if (local->dingo) { |
823 | /* Take the Modem IO port from the CIS and scan for a free | 821 | /* Take the Modem IO port from the CIS and scan for a free |
824 | * Ethernet port */ | 822 | * Ethernet port */ |
825 | link->io.NumPorts1 = 16; /* no Mako stuff anymore */ | 823 | link->resource[0]->end = 16; /* no Mako stuff anymore */ |
826 | if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) | 824 | if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) |
827 | goto port_found; | 825 | goto port_found; |
828 | } else { | 826 | } else { |
829 | link->io.NumPorts1 = 18; | 827 | link->resource[0]->end = 18; |
830 | /* We do 2 passes here: The first one uses the regular mapping and | 828 | /* We do 2 passes here: The first one uses the regular mapping and |
831 | * the second tries again, thereby considering that the 32 ports are | 829 | * the second tries again, thereby considering that the 32 ports are |
832 | * mirrored every 32 bytes. Actually we use a mirrored port for | 830 | * mirrored every 32 bytes. Actually we use a mirrored port for |
@@ -841,14 +839,15 @@ xirc2ps_config(struct pcmcia_device * link) | |||
841 | } | 839 | } |
842 | printk(KNOT_XIRC "no ports available\n"); | 840 | printk(KNOT_XIRC "no ports available\n"); |
843 | } else { | 841 | } else { |
844 | link->io.NumPorts1 = 16; | 842 | link->io_lines = 10; |
843 | link->resource[0]->end = 16; | ||
845 | for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { | 844 | for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { |
846 | link->io.BasePort1 = ioaddr; | 845 | link->resource[0]->start = ioaddr; |
847 | if (!(err=pcmcia_request_io(link, &link->io))) | 846 | if (!(err = pcmcia_request_io(link))) |
848 | goto port_found; | 847 | goto port_found; |
849 | } | 848 | } |
850 | link->io.BasePort1 = 0; /* let CS decide */ | 849 | link->resource[0]->start = 0; /* let CS decide */ |
851 | if ((err=pcmcia_request_io(link, &link->io))) | 850 | if ((err = pcmcia_request_io(link))) |
852 | goto config_error; | 851 | goto config_error; |
853 | } | 852 | } |
854 | port_found: | 853 | port_found: |
@@ -870,24 +869,21 @@ xirc2ps_config(struct pcmcia_device * link) | |||
870 | goto config_error; | 869 | goto config_error; |
871 | 870 | ||
872 | if (local->dingo) { | 871 | if (local->dingo) { |
873 | conf_reg_t reg; | ||
874 | win_req_t req; | 872 | win_req_t req; |
875 | memreq_t mem; | ||
876 | 873 | ||
877 | /* Reset the modem's BAR to the correct value | 874 | /* Reset the modem's BAR to the correct value |
878 | * This is necessary because in the RequestConfiguration call, | 875 | * This is necessary because in the RequestConfiguration call, |
879 | * the base address of the ethernet port (BasePort1) is written | 876 | * the base address of the ethernet port (BasePort1) is written |
880 | * to the BAR registers of the modem. | 877 | * to the BAR registers of the modem. |
881 | */ | 878 | */ |
882 | reg.Action = CS_WRITE; | 879 | err = pcmcia_write_config_byte(link, CISREG_IOBASE_0, (u8) |
883 | reg.Offset = CISREG_IOBASE_0; | 880 | link->resource[1]->start & 0xff); |
884 | reg.Value = link->io.BasePort2 & 0xff; | 881 | if (err) |
885 | if ((err = pcmcia_access_configuration_register(link, ®))) | ||
886 | goto config_error; | 882 | goto config_error; |
887 | reg.Action = CS_WRITE; | 883 | |
888 | reg.Offset = CISREG_IOBASE_1; | 884 | err = pcmcia_write_config_byte(link, CISREG_IOBASE_1, |
889 | reg.Value = (link->io.BasePort2 >> 8) & 0xff; | 885 | (link->resource[1]->start >> 8) & 0xff); |
890 | if ((err = pcmcia_access_configuration_register(link, ®))) | 886 | if (err) |
891 | goto config_error; | 887 | goto config_error; |
892 | 888 | ||
893 | /* There is no config entry for the Ethernet part which | 889 | /* There is no config entry for the Ethernet part which |
@@ -901,16 +897,14 @@ xirc2ps_config(struct pcmcia_device * link) | |||
901 | goto config_error; | 897 | goto config_error; |
902 | 898 | ||
903 | local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; | 899 | local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; |
904 | mem.CardOffset = 0x0; | 900 | if ((err = pcmcia_map_mem_page(link, link->win, 0))) |
905 | mem.Page = 0; | ||
906 | if ((err = pcmcia_map_mem_page(link, link->win, &mem))) | ||
907 | goto config_error; | 901 | goto config_error; |
908 | 902 | ||
909 | /* Setup the CCRs; there are no infos in the CIS about the Ethernet | 903 | /* Setup the CCRs; there are no infos in the CIS about the Ethernet |
910 | * part. | 904 | * part. |
911 | */ | 905 | */ |
912 | writeb(0x47, local->dingo_ccr + CISREG_COR); | 906 | writeb(0x47, local->dingo_ccr + CISREG_COR); |
913 | ioaddr = link->io.BasePort1; | 907 | ioaddr = link->resource[0]->start; |
914 | writeb(ioaddr & 0xff , local->dingo_ccr + CISREG_IOBASE_0); | 908 | writeb(ioaddr & 0xff , local->dingo_ccr + CISREG_IOBASE_0); |
915 | writeb((ioaddr >> 8)&0xff , local->dingo_ccr + CISREG_IOBASE_1); | 909 | writeb((ioaddr >> 8)&0xff , local->dingo_ccr + CISREG_IOBASE_1); |
916 | 910 | ||
@@ -957,7 +951,7 @@ xirc2ps_config(struct pcmcia_device * link) | |||
957 | 951 | ||
958 | /* we can now register the device with the net subsystem */ | 952 | /* we can now register the device with the net subsystem */ |
959 | dev->irq = link->irq; | 953 | dev->irq = link->irq; |
960 | dev->base_addr = link->io.BasePort1; | 954 | dev->base_addr = link->resource[0]->start; |
961 | 955 | ||
962 | if (local->dingo) | 956 | if (local->dingo) |
963 | do_reset(dev, 1); /* a kludge to make the cem56 work */ | 957 | do_reset(dev, 1); /* a kludge to make the cem56 work */ |
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 33bdc6a84e81..9a121a5b787c 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/timer.h> | 32 | #include <linux/timer.h> |
33 | #include <linux/netdevice.h> | 33 | #include <linux/netdevice.h> |
34 | 34 | ||
35 | #include <pcmcia/cs_types.h> | ||
36 | #include <pcmcia/cs.h> | 35 | #include <pcmcia/cs.h> |
37 | #include <pcmcia/cistpl.h> | 36 | #include <pcmcia/cistpl.h> |
38 | #include <pcmcia/cisreg.h> | 37 | #include <pcmcia/cisreg.h> |
@@ -155,8 +154,6 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, | |||
155 | unsigned int vcc, | 154 | unsigned int vcc, |
156 | void *priv_data) | 155 | void *priv_data) |
157 | { | 156 | { |
158 | win_req_t *req = priv_data; | ||
159 | |||
160 | if (cfg->index == 0) | 157 | if (cfg->index == 0) |
161 | return -ENODEV; | 158 | return -ENODEV; |
162 | 159 | ||
@@ -176,52 +173,25 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, | |||
176 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 173 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
177 | 174 | ||
178 | /* IO window settings */ | 175 | /* IO window settings */ |
179 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 176 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
180 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 177 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
181 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 178 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
182 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 179 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
183 | if (!(io->flags & CISTPL_IO_8BIT)) | 180 | p_dev->resource[0]->flags |= |
184 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 181 | pcmcia_io_cfg_data_width(io->flags); |
185 | if (!(io->flags & CISTPL_IO_16BIT)) | 182 | p_dev->resource[0]->start = io->win[0].base; |
186 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 183 | p_dev->resource[0]->end = io->win[0].len; |
187 | p_dev->io.BasePort1 = io->win[0].base; | ||
188 | p_dev->io.NumPorts1 = io->win[0].len; | ||
189 | if (io->nwin > 1) { | 184 | if (io->nwin > 1) { |
190 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 185 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
191 | p_dev->io.BasePort2 = io->win[1].base; | 186 | p_dev->resource[1]->start = io->win[1].base; |
192 | p_dev->io.NumPorts2 = io->win[1].len; | 187 | p_dev->resource[1]->end = io->win[1].len; |
193 | } | 188 | } |
194 | } | 189 | } |
195 | 190 | ||
196 | /* This reserves IO space but doesn't actually enable it */ | 191 | /* This reserves IO space but doesn't actually enable it */ |
197 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | 192 | if (pcmcia_request_io(p_dev) != 0) |
198 | return -ENODEV; | 193 | return -ENODEV; |
199 | 194 | ||
200 | /* | ||
201 | Now set up a common memory window, if needed. There is room | ||
202 | in the struct pcmcia_device structure for one memory window handle, | ||
203 | but if the base addresses need to be saved, or if multiple | ||
204 | windows are needed, the info should go in the private data | ||
205 | structure for this device. | ||
206 | |||
207 | Note that the memory window base is a physical address, and | ||
208 | needs to be mapped to virtual space with ioremap() before it | ||
209 | is used. | ||
210 | */ | ||
211 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { | ||
212 | cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; | ||
213 | memreq_t map; | ||
214 | req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; | ||
215 | req->Base = mem->win[0].host_addr; | ||
216 | req->Size = mem->win[0].len; | ||
217 | req->AccessSpeed = 0; | ||
218 | if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0) | ||
219 | return -ENODEV; | ||
220 | map.Page = 0; | ||
221 | map.CardOffset = mem->win[0].card_addr; | ||
222 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0) | ||
223 | return -ENODEV; | ||
224 | } | ||
225 | /* If we got this far, we're cool! */ | 195 | /* If we got this far, we're cool! */ |
226 | return 0; | 196 | return 0; |
227 | } | 197 | } |
@@ -230,17 +200,12 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, | |||
230 | static int airo_config(struct pcmcia_device *link) | 200 | static int airo_config(struct pcmcia_device *link) |
231 | { | 201 | { |
232 | local_info_t *dev; | 202 | local_info_t *dev; |
233 | win_req_t *req; | ||
234 | int ret; | 203 | int ret; |
235 | 204 | ||
236 | dev = link->priv; | 205 | dev = link->priv; |
237 | 206 | ||
238 | dev_dbg(&link->dev, "airo_config\n"); | 207 | dev_dbg(&link->dev, "airo_config\n"); |
239 | 208 | ||
240 | req = kzalloc(sizeof(win_req_t), GFP_KERNEL); | ||
241 | if (!req) | ||
242 | return -ENOMEM; | ||
243 | |||
244 | /* | 209 | /* |
245 | * In this loop, we scan the CIS for configuration table | 210 | * In this loop, we scan the CIS for configuration table |
246 | * entries, each of which describes a valid card | 211 | * entries, each of which describes a valid card |
@@ -255,7 +220,7 @@ static int airo_config(struct pcmcia_device *link) | |||
255 | * and most client drivers will only use the CIS to fill in | 220 | * and most client drivers will only use the CIS to fill in |
256 | * implementation-defined details. | 221 | * implementation-defined details. |
257 | */ | 222 | */ |
258 | ret = pcmcia_loop_config(link, airo_cs_config_check, req); | 223 | ret = pcmcia_loop_config(link, airo_cs_config_check, NULL); |
259 | if (ret) | 224 | if (ret) |
260 | goto failed; | 225 | goto failed; |
261 | 226 | ||
@@ -272,7 +237,7 @@ static int airo_config(struct pcmcia_device *link) | |||
272 | goto failed; | 237 | goto failed; |
273 | ((local_info_t *)link->priv)->eth_dev = | 238 | ((local_info_t *)link->priv)->eth_dev = |
274 | init_airo_card(link->irq, | 239 | init_airo_card(link->irq, |
275 | link->io.BasePort1, 1, &link->dev); | 240 | link->resource[0]->start, 1, &link->dev); |
276 | if (!((local_info_t *)link->priv)->eth_dev) | 241 | if (!((local_info_t *)link->priv)->eth_dev) |
277 | goto failed; | 242 | goto failed; |
278 | 243 | ||
@@ -282,22 +247,15 @@ static int airo_config(struct pcmcia_device *link) | |||
282 | if (link->conf.Vpp) | 247 | if (link->conf.Vpp) |
283 | printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); | 248 | printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); |
284 | printk(", irq %d", link->irq); | 249 | printk(", irq %d", link->irq); |
285 | if (link->io.NumPorts1) | 250 | if (link->resource[0]) |
286 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 251 | printk(" & %pR", link->resource[0]); |
287 | link->io.BasePort1+link->io.NumPorts1-1); | 252 | if (link->resource[1]) |
288 | if (link->io.NumPorts2) | 253 | printk(" & %pR", link->resource[1]); |
289 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
290 | link->io.BasePort2+link->io.NumPorts2-1); | ||
291 | if (link->win) | ||
292 | printk(", mem 0x%06lx-0x%06lx", req->Base, | ||
293 | req->Base+req->Size-1); | ||
294 | printk("\n"); | 254 | printk("\n"); |
295 | kfree(req); | ||
296 | return 0; | 255 | return 0; |
297 | 256 | ||
298 | failed: | 257 | failed: |
299 | airo_release(link); | 258 | airo_release(link); |
300 | kfree(req); | ||
301 | return -ENODEV; | 259 | return -ENODEV; |
302 | } /* airo_config */ | 260 | } /* airo_config */ |
303 | 261 | ||
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index c2746fc7f2be..3b632161c106 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <linux/moduleparam.h> | 42 | #include <linux/moduleparam.h> |
43 | #include <linux/device.h> | 43 | #include <linux/device.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/cisreg.h> | 47 | #include <pcmcia/cisreg.h> |
@@ -191,25 +190,23 @@ static int atmel_config_check(struct pcmcia_device *p_dev, | |||
191 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 190 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
192 | 191 | ||
193 | /* IO window settings */ | 192 | /* IO window settings */ |
194 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 193 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
195 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 194 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
196 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 195 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
197 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 196 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
198 | if (!(io->flags & CISTPL_IO_8BIT)) | 197 | p_dev->resource[0]->flags |= |
199 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 198 | pcmcia_io_cfg_data_width(io->flags); |
200 | if (!(io->flags & CISTPL_IO_16BIT)) | 199 | p_dev->resource[0]->start = io->win[0].base; |
201 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 200 | p_dev->resource[0]->end = io->win[0].len; |
202 | p_dev->io.BasePort1 = io->win[0].base; | ||
203 | p_dev->io.NumPorts1 = io->win[0].len; | ||
204 | if (io->nwin > 1) { | 201 | if (io->nwin > 1) { |
205 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 202 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
206 | p_dev->io.BasePort2 = io->win[1].base; | 203 | p_dev->resource[1]->start = io->win[1].base; |
207 | p_dev->io.NumPorts2 = io->win[1].len; | 204 | p_dev->resource[1]->end = io->win[1].len; |
208 | } | 205 | } |
209 | } | 206 | } |
210 | 207 | ||
211 | /* This reserves IO space but doesn't actually enable it */ | 208 | /* This reserves IO space but doesn't actually enable it */ |
212 | return pcmcia_request_io(p_dev, &p_dev->io); | 209 | return pcmcia_request_io(p_dev); |
213 | } | 210 | } |
214 | 211 | ||
215 | static int atmel_config(struct pcmcia_device *link) | 212 | static int atmel_config(struct pcmcia_device *link) |
@@ -254,7 +251,7 @@ static int atmel_config(struct pcmcia_device *link) | |||
254 | 251 | ||
255 | ((local_info_t*)link->priv)->eth_dev = | 252 | ((local_info_t*)link->priv)->eth_dev = |
256 | init_atmel_card(link->irq, | 253 | init_atmel_card(link->irq, |
257 | link->io.BasePort1, | 254 | link->resource[0]->start, |
258 | did ? did->driver_info : ATMEL_FW_TYPE_NONE, | 255 | did ? did->driver_info : ATMEL_FW_TYPE_NONE, |
259 | &link->dev, | 256 | &link->dev, |
260 | card_present, | 257 | card_present, |
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index 0e99b634267c..dfbc41d431ff 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/ssb/ssb.h> | 26 | #include <linux/ssb/ssb.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | 28 | ||
29 | #include <pcmcia/cs_types.h> | ||
30 | #include <pcmcia/cs.h> | 29 | #include <pcmcia/cs.h> |
31 | #include <pcmcia/cistpl.h> | 30 | #include <pcmcia/cistpl.h> |
32 | #include <pcmcia/ciscode.h> | 31 | #include <pcmcia/ciscode.h> |
@@ -65,7 +64,6 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
65 | { | 64 | { |
66 | struct ssb_bus *ssb; | 65 | struct ssb_bus *ssb; |
67 | win_req_t win; | 66 | win_req_t win; |
68 | memreq_t mem; | ||
69 | int err = -ENOMEM; | 67 | int err = -ENOMEM; |
70 | int res = 0; | 68 | int res = 0; |
71 | 69 | ||
@@ -78,12 +76,7 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
78 | dev->conf.Attributes = CONF_ENABLE_IRQ; | 76 | dev->conf.Attributes = CONF_ENABLE_IRQ; |
79 | dev->conf.IntType = INT_MEMORY_AND_IO; | 77 | dev->conf.IntType = INT_MEMORY_AND_IO; |
80 | 78 | ||
81 | dev->io.BasePort2 = 0; | 79 | win.Attributes = WIN_ENABLE | WIN_DATA_WIDTH_16 | |
82 | dev->io.NumPorts2 = 0; | ||
83 | dev->io.Attributes2 = 0; | ||
84 | |||
85 | win.Attributes = WIN_ADDR_SPACE_MEM | WIN_MEMORY_TYPE_CM | | ||
86 | WIN_ENABLE | WIN_DATA_WIDTH_16 | | ||
87 | WIN_USE_WAIT; | 80 | WIN_USE_WAIT; |
88 | win.Base = 0; | 81 | win.Base = 0; |
89 | win.Size = SSB_CORE_SIZE; | 82 | win.Size = SSB_CORE_SIZE; |
@@ -92,9 +85,7 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
92 | if (res != 0) | 85 | if (res != 0) |
93 | goto err_kfree_ssb; | 86 | goto err_kfree_ssb; |
94 | 87 | ||
95 | mem.CardOffset = 0; | 88 | res = pcmcia_map_mem_page(dev, dev->win, 0); |
96 | mem.Page = 0; | ||
97 | res = pcmcia_map_mem_page(dev, dev->win, &mem); | ||
98 | if (res != 0) | 89 | if (res != 0) |
99 | goto err_disable; | 90 | goto err_disable; |
100 | 91 | ||
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 29b31a694b59..ba54d1b04d22 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/wireless.h> | 12 | #include <linux/wireless.h> |
13 | #include <net/iw_handler.h> | 13 | #include <net/iw_handler.h> |
14 | 14 | ||
15 | #include <pcmcia/cs_types.h> | ||
16 | #include <pcmcia/cs.h> | 15 | #include <pcmcia/cs.h> |
17 | #include <pcmcia/cistpl.h> | 16 | #include <pcmcia/cistpl.h> |
18 | #include <pcmcia/cisreg.h> | 17 | #include <pcmcia/cisreg.h> |
@@ -23,7 +22,7 @@ | |||
23 | #include "hostap_wlan.h" | 22 | #include "hostap_wlan.h" |
24 | 23 | ||
25 | 24 | ||
26 | static dev_info_t dev_info = "hostap_cs"; | 25 | static char *dev_info = "hostap_cs"; |
27 | 26 | ||
28 | MODULE_AUTHOR("Jouni Malinen"); | 27 | MODULE_AUTHOR("Jouni Malinen"); |
29 | MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " | 28 | MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " |
@@ -225,27 +224,18 @@ static int prism2_pccard_card_present(local_info_t *local) | |||
225 | static void sandisk_set_iobase(local_info_t *local) | 224 | static void sandisk_set_iobase(local_info_t *local) |
226 | { | 225 | { |
227 | int res; | 226 | int res; |
228 | conf_reg_t reg; | ||
229 | struct hostap_cs_priv *hw_priv = local->hw_priv; | 227 | struct hostap_cs_priv *hw_priv = local->hw_priv; |
230 | 228 | ||
231 | reg.Function = 0; | 229 | res = pcmcia_write_config_byte(hw_priv->link, 0x10, |
232 | reg.Action = CS_WRITE; | 230 | hw_priv->link->resource[0]->start & 0x00ff); |
233 | reg.Offset = 0x10; /* 0x3f0 IO base 1 */ | ||
234 | reg.Value = hw_priv->link->io.BasePort1 & 0x00ff; | ||
235 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
236 | ®); | ||
237 | if (res != 0) { | 231 | if (res != 0) { |
238 | printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -" | 232 | printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -" |
239 | " res=%d\n", res); | 233 | " res=%d\n", res); |
240 | } | 234 | } |
241 | udelay(10); | 235 | udelay(10); |
242 | 236 | ||
243 | reg.Function = 0; | 237 | res = pcmcia_write_config_byte(hw_priv->link, 0x12, |
244 | reg.Action = CS_WRITE; | 238 | (hw_priv->link->resource[0]->start >> 8) & 0x00ff); |
245 | reg.Offset = 0x12; /* 0x3f2 IO base 2 */ | ||
246 | reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8; | ||
247 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
248 | ®); | ||
249 | if (res != 0) { | 239 | if (res != 0) { |
250 | printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -" | 240 | printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -" |
251 | " res=%d\n", res); | 241 | " res=%d\n", res); |
@@ -271,12 +261,11 @@ static void sandisk_write_hcr(local_info_t *local, int hcr) | |||
271 | static int sandisk_enable_wireless(struct net_device *dev) | 261 | static int sandisk_enable_wireless(struct net_device *dev) |
272 | { | 262 | { |
273 | int res, ret = 0; | 263 | int res, ret = 0; |
274 | conf_reg_t reg; | ||
275 | struct hostap_interface *iface = netdev_priv(dev); | 264 | struct hostap_interface *iface = netdev_priv(dev); |
276 | local_info_t *local = iface->local; | 265 | local_info_t *local = iface->local; |
277 | struct hostap_cs_priv *hw_priv = local->hw_priv; | 266 | struct hostap_cs_priv *hw_priv = local->hw_priv; |
278 | 267 | ||
279 | if (hw_priv->link->io.NumPorts1 < 0x42) { | 268 | if (resource_size(hw_priv->link->resource[0]) < 0x42) { |
280 | /* Not enough ports to be SanDisk multi-function card */ | 269 | /* Not enough ports to be SanDisk multi-function card */ |
281 | ret = -ENODEV; | 270 | ret = -ENODEV; |
282 | goto done; | 271 | goto done; |
@@ -298,12 +287,8 @@ static int sandisk_enable_wireless(struct net_device *dev) | |||
298 | " - using vendor-specific initialization\n", dev->name); | 287 | " - using vendor-specific initialization\n", dev->name); |
299 | hw_priv->sandisk_connectplus = 1; | 288 | hw_priv->sandisk_connectplus = 1; |
300 | 289 | ||
301 | reg.Function = 0; | 290 | res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, |
302 | reg.Action = CS_WRITE; | 291 | COR_SOFT_RESET); |
303 | reg.Offset = CISREG_COR; | ||
304 | reg.Value = COR_SOFT_RESET; | ||
305 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
306 | ®); | ||
307 | if (res != 0) { | 292 | if (res != 0) { |
308 | printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", | 293 | printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", |
309 | dev->name, res); | 294 | dev->name, res); |
@@ -311,16 +296,13 @@ static int sandisk_enable_wireless(struct net_device *dev) | |||
311 | } | 296 | } |
312 | mdelay(5); | 297 | mdelay(5); |
313 | 298 | ||
314 | reg.Function = 0; | ||
315 | reg.Action = CS_WRITE; | ||
316 | reg.Offset = CISREG_COR; | ||
317 | /* | 299 | /* |
318 | * Do not enable interrupts here to avoid some bogus events. Interrupts | 300 | * Do not enable interrupts here to avoid some bogus events. Interrupts |
319 | * will be enabled during the first cor_sreset call. | 301 | * will be enabled during the first cor_sreset call. |
320 | */ | 302 | */ |
321 | reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA; | 303 | res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, |
322 | res = pcmcia_access_configuration_register(hw_priv->link, | 304 | (COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | |
323 | ®); | 305 | COR_FUNC_ENA)); |
324 | if (res != 0) { | 306 | if (res != 0) { |
325 | printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", | 307 | printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", |
326 | dev->name, res); | 308 | dev->name, res); |
@@ -343,30 +325,23 @@ done: | |||
343 | static void prism2_pccard_cor_sreset(local_info_t *local) | 325 | static void prism2_pccard_cor_sreset(local_info_t *local) |
344 | { | 326 | { |
345 | int res; | 327 | int res; |
346 | conf_reg_t reg; | 328 | u8 val; |
347 | struct hostap_cs_priv *hw_priv = local->hw_priv; | 329 | struct hostap_cs_priv *hw_priv = local->hw_priv; |
348 | 330 | ||
349 | if (!prism2_pccard_card_present(local)) | 331 | if (!prism2_pccard_card_present(local)) |
350 | return; | 332 | return; |
351 | 333 | ||
352 | reg.Function = 0; | 334 | res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &val); |
353 | reg.Action = CS_READ; | ||
354 | reg.Offset = CISREG_COR; | ||
355 | reg.Value = 0; | ||
356 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
357 | ®); | ||
358 | if (res != 0) { | 335 | if (res != 0) { |
359 | printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n", | 336 | printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n", |
360 | res); | 337 | res); |
361 | return; | 338 | return; |
362 | } | 339 | } |
363 | printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n", | 340 | printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n", |
364 | reg.Value); | 341 | val); |
365 | 342 | ||
366 | reg.Action = CS_WRITE; | 343 | val |= COR_SOFT_RESET; |
367 | reg.Value |= COR_SOFT_RESET; | 344 | res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val); |
368 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
369 | ®); | ||
370 | if (res != 0) { | 345 | if (res != 0) { |
371 | printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n", | 346 | printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n", |
372 | res); | 347 | res); |
@@ -375,11 +350,10 @@ static void prism2_pccard_cor_sreset(local_info_t *local) | |||
375 | 350 | ||
376 | mdelay(hw_priv->sandisk_connectplus ? 5 : 2); | 351 | mdelay(hw_priv->sandisk_connectplus ? 5 : 2); |
377 | 352 | ||
378 | reg.Value &= ~COR_SOFT_RESET; | 353 | val &= ~COR_SOFT_RESET; |
379 | if (hw_priv->sandisk_connectplus) | 354 | if (hw_priv->sandisk_connectplus) |
380 | reg.Value |= COR_IREQ_ENA; | 355 | val |= COR_IREQ_ENA; |
381 | res = pcmcia_access_configuration_register(hw_priv->link, | 356 | res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val); |
382 | ®); | ||
383 | if (res != 0) { | 357 | if (res != 0) { |
384 | printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n", | 358 | printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n", |
385 | res); | 359 | res); |
@@ -396,8 +370,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local) | |||
396 | static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) | 370 | static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) |
397 | { | 371 | { |
398 | int res; | 372 | int res; |
399 | conf_reg_t reg; | 373 | u8 old_cor; |
400 | int old_cor; | ||
401 | struct hostap_cs_priv *hw_priv = local->hw_priv; | 374 | struct hostap_cs_priv *hw_priv = local->hw_priv; |
402 | 375 | ||
403 | if (!prism2_pccard_card_present(local)) | 376 | if (!prism2_pccard_card_present(local)) |
@@ -408,25 +381,17 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) | |||
408 | return; | 381 | return; |
409 | } | 382 | } |
410 | 383 | ||
411 | reg.Function = 0; | 384 | res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &old_cor); |
412 | reg.Action = CS_READ; | ||
413 | reg.Offset = CISREG_COR; | ||
414 | reg.Value = 0; | ||
415 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
416 | ®); | ||
417 | if (res != 0) { | 385 | if (res != 0) { |
418 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 " | 386 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 " |
419 | "(%d)\n", res); | 387 | "(%d)\n", res); |
420 | return; | 388 | return; |
421 | } | 389 | } |
422 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n", | 390 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n", |
423 | reg.Value); | 391 | old_cor); |
424 | old_cor = reg.Value; | ||
425 | 392 | ||
426 | reg.Action = CS_WRITE; | 393 | res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, |
427 | reg.Value |= COR_SOFT_RESET; | 394 | old_cor | COR_SOFT_RESET); |
428 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
429 | ®); | ||
430 | if (res != 0) { | 395 | if (res != 0) { |
431 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 " | 396 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 " |
432 | "(%d)\n", res); | 397 | "(%d)\n", res); |
@@ -436,11 +401,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) | |||
436 | mdelay(10); | 401 | mdelay(10); |
437 | 402 | ||
438 | /* Setup Genesis mode */ | 403 | /* Setup Genesis mode */ |
439 | reg.Action = CS_WRITE; | 404 | res = pcmcia_write_config_byte(hw_priv->link, CISREG_CCSR, hcr); |
440 | reg.Value = hcr; | ||
441 | reg.Offset = CISREG_CCSR; | ||
442 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
443 | ®); | ||
444 | if (res != 0) { | 405 | if (res != 0) { |
445 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 " | 406 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 " |
446 | "(%d)\n", res); | 407 | "(%d)\n", res); |
@@ -448,11 +409,8 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) | |||
448 | } | 409 | } |
449 | mdelay(10); | 410 | mdelay(10); |
450 | 411 | ||
451 | reg.Action = CS_WRITE; | 412 | res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, |
452 | reg.Offset = CISREG_COR; | 413 | old_cor & ~COR_SOFT_RESET); |
453 | reg.Value = old_cor & ~COR_SOFT_RESET; | ||
454 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
455 | ®); | ||
456 | if (res != 0) { | 414 | if (res != 0) { |
457 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 " | 415 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 " |
458 | "(%d)\n", res); | 416 | "(%d)\n", res); |
@@ -561,30 +519,24 @@ static int prism2_config_check(struct pcmcia_device *p_dev, | |||
561 | PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " | 519 | PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " |
562 | "dflt->io.nwin=%d\n", | 520 | "dflt->io.nwin=%d\n", |
563 | cfg->io.nwin, dflt->io.nwin); | 521 | cfg->io.nwin, dflt->io.nwin); |
564 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 522 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
565 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 523 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
566 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 524 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
567 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 525 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
568 | PDEBUG(DEBUG_EXTRA, "io->flags = 0x%04X, " | 526 | p_dev->resource[0]->flags |= |
569 | "io.base=0x%04x, len=%d\n", io->flags, | 527 | pcmcia_io_cfg_data_width(io->flags); |
570 | io->win[0].base, io->win[0].len); | 528 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; |
571 | if (!(io->flags & CISTPL_IO_8BIT)) | 529 | p_dev->resource[0]->start = io->win[0].base; |
572 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 530 | p_dev->resource[0]->end = io->win[0].len; |
573 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
574 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
575 | p_dev->io.IOAddrLines = io->flags & | ||
576 | CISTPL_IO_LINES_MASK; | ||
577 | p_dev->io.BasePort1 = io->win[0].base; | ||
578 | p_dev->io.NumPorts1 = io->win[0].len; | ||
579 | if (io->nwin > 1) { | 531 | if (io->nwin > 1) { |
580 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 532 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
581 | p_dev->io.BasePort2 = io->win[1].base; | 533 | p_dev->resource[1]->start = io->win[1].base; |
582 | p_dev->io.NumPorts2 = io->win[1].len; | 534 | p_dev->resource[1]->end = io->win[1].len; |
583 | } | 535 | } |
584 | } | 536 | } |
585 | 537 | ||
586 | /* This reserves IO space but doesn't actually enable it */ | 538 | /* This reserves IO space but doesn't actually enable it */ |
587 | return pcmcia_request_io(p_dev, &p_dev->io); | 539 | return pcmcia_request_io(p_dev); |
588 | } | 540 | } |
589 | 541 | ||
590 | static int prism2_config(struct pcmcia_device *link) | 542 | static int prism2_config(struct pcmcia_device *link) |
@@ -646,7 +598,7 @@ static int prism2_config(struct pcmcia_device *link) | |||
646 | goto failed_unlock; | 598 | goto failed_unlock; |
647 | 599 | ||
648 | dev->irq = link->irq; | 600 | dev->irq = link->irq; |
649 | dev->base_addr = link->io.BasePort1; | 601 | dev->base_addr = link->resource[0]->start; |
650 | 602 | ||
651 | spin_unlock_irqrestore(&local->irq_init_lock, flags); | 603 | spin_unlock_irqrestore(&local->irq_init_lock, flags); |
652 | 604 | ||
@@ -658,12 +610,10 @@ static int prism2_config(struct pcmcia_device *link) | |||
658 | link->conf.Vpp % 10); | 610 | link->conf.Vpp % 10); |
659 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 611 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
660 | printk(", irq %d", link->irq); | 612 | printk(", irq %d", link->irq); |
661 | if (link->io.NumPorts1) | 613 | if (link->resource[0]) |
662 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 614 | printk(" & %pR", link->resource[0]); |
663 | link->io.BasePort1+link->io.NumPorts1-1); | 615 | if (link->resource[1]) |
664 | if (link->io.NumPorts2) | 616 | printk(" & %pR", link->resource[1]); |
665 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
666 | link->io.BasePort2+link->io.NumPorts2-1); | ||
667 | printk("\n"); | 617 | printk("\n"); |
668 | 618 | ||
669 | local->shutdown = 0; | 619 | local->shutdown = 0; |
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 08e4e3908003..9c298396be50 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/firmware.h> | 28 | #include <linux/firmware.h> |
29 | #include <linux/netdevice.h> | 29 | #include <linux/netdevice.h> |
30 | 30 | ||
31 | #include <pcmcia/cs_types.h> | ||
32 | #include <pcmcia/cs.h> | 31 | #include <pcmcia/cs.h> |
33 | #include <pcmcia/cistpl.h> | 32 | #include <pcmcia/cistpl.h> |
34 | #include <pcmcia/ds.h> | 33 | #include <pcmcia/ds.h> |
@@ -802,9 +801,9 @@ static int if_cs_ioprobe(struct pcmcia_device *p_dev, | |||
802 | unsigned int vcc, | 801 | unsigned int vcc, |
803 | void *priv_data) | 802 | void *priv_data) |
804 | { | 803 | { |
805 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 804 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
806 | p_dev->io.BasePort1 = cfg->io.win[0].base; | 805 | p_dev->resource[0]->start = cfg->io.win[0].base; |
807 | p_dev->io.NumPorts1 = cfg->io.win[0].len; | 806 | p_dev->resource[0]->end = cfg->io.win[0].len; |
808 | 807 | ||
809 | /* Do we need to allocate an interrupt? */ | 808 | /* Do we need to allocate an interrupt? */ |
810 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 809 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
@@ -816,7 +815,7 @@ static int if_cs_ioprobe(struct pcmcia_device *p_dev, | |||
816 | } | 815 | } |
817 | 816 | ||
818 | /* This reserves IO space but doesn't actually enable it */ | 817 | /* This reserves IO space but doesn't actually enable it */ |
819 | return pcmcia_request_io(p_dev, &p_dev->io); | 818 | return pcmcia_request_io(p_dev); |
820 | } | 819 | } |
821 | 820 | ||
822 | static int if_cs_probe(struct pcmcia_device *p_dev) | 821 | static int if_cs_probe(struct pcmcia_device *p_dev) |
@@ -854,7 +853,8 @@ static int if_cs_probe(struct pcmcia_device *p_dev) | |||
854 | goto out1; | 853 | goto out1; |
855 | 854 | ||
856 | /* Initialize io access */ | 855 | /* Initialize io access */ |
857 | card->iobase = ioport_map(p_dev->io.BasePort1, p_dev->io.NumPorts1); | 856 | card->iobase = ioport_map(p_dev->resource[0]->start, |
857 | resource_size(p_dev->resource[0])); | ||
858 | if (!card->iobase) { | 858 | if (!card->iobase) { |
859 | lbs_pr_err("error in ioport_map\n"); | 859 | lbs_pr_err("error in ioport_map\n"); |
860 | ret = -EIO; | 860 | ret = -EIO; |
@@ -873,9 +873,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev) | |||
873 | } | 873 | } |
874 | 874 | ||
875 | /* Finally, report what we've done */ | 875 | /* Finally, report what we've done */ |
876 | lbs_deb_cs("irq %d, io 0x%04x-0x%04x\n", | 876 | lbs_deb_cs("irq %d, io %pR", p_dev->irq, p_dev->resource[0]); |
877 | p_dev->irq, p_dev->io.BasePort1, | ||
878 | p_dev->io.BasePort1 + p_dev->io.NumPorts1 - 1); | ||
879 | 877 | ||
880 | /* | 878 | /* |
881 | * Most of the libertas cards can do unaligned register access, but some | 879 | * Most of the libertas cards can do unaligned register access, but some |
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index b16d5db52a4d..ef46a2d88539 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <pcmcia/cs_types.h> | ||
21 | #include <pcmcia/cs.h> | 20 | #include <pcmcia/cs.h> |
22 | #include <pcmcia/cistpl.h> | 21 | #include <pcmcia/cistpl.h> |
23 | #include <pcmcia/cisreg.h> | 22 | #include <pcmcia/cisreg.h> |
@@ -192,25 +191,23 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev, | |||
192 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 191 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
193 | 192 | ||
194 | /* IO window settings */ | 193 | /* IO window settings */ |
195 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 194 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
196 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 195 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
197 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 196 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
198 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 197 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; |
199 | if (!(io->flags & CISTPL_IO_8BIT)) | 198 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
200 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 199 | p_dev->resource[0]->flags |= |
201 | if (!(io->flags & CISTPL_IO_16BIT)) | 200 | pcmcia_io_cfg_data_width(io->flags); |
202 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 201 | p_dev->resource[0]->start = io->win[0].base; |
203 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | 202 | p_dev->resource[0]->end = io->win[0].len; |
204 | p_dev->io.BasePort1 = io->win[0].base; | ||
205 | p_dev->io.NumPorts1 = io->win[0].len; | ||
206 | if (io->nwin > 1) { | 203 | if (io->nwin > 1) { |
207 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 204 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
208 | p_dev->io.BasePort2 = io->win[1].base; | 205 | p_dev->resource[1]->start = io->win[1].base; |
209 | p_dev->io.NumPorts2 = io->win[1].len; | 206 | p_dev->resource[1]->end = io->win[1].len; |
210 | } | 207 | } |
211 | 208 | ||
212 | /* This reserves IO space but doesn't actually enable it */ | 209 | /* This reserves IO space but doesn't actually enable it */ |
213 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | 210 | if (pcmcia_request_io(p_dev) != 0) |
214 | goto next_entry; | 211 | goto next_entry; |
215 | } | 212 | } |
216 | return 0; | 213 | return 0; |
@@ -258,7 +255,8 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
258 | /* We initialize the hermes structure before completing PCMCIA | 255 | /* We initialize the hermes structure before completing PCMCIA |
259 | * configuration just in case the interrupt handler gets | 256 | * configuration just in case the interrupt handler gets |
260 | * called. */ | 257 | * called. */ |
261 | mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); | 258 | mem = ioport_map(link->resource[0]->start, |
259 | resource_size(link->resource[0])); | ||
262 | if (!mem) | 260 | if (!mem) |
263 | goto failed; | 261 | goto failed; |
264 | 262 | ||
@@ -280,7 +278,7 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
280 | } | 278 | } |
281 | 279 | ||
282 | /* Register an interface with the stack */ | 280 | /* Register an interface with the stack */ |
283 | if (orinoco_if_add(priv, link->io.BasePort1, | 281 | if (orinoco_if_add(priv, link->resource[0]->start, |
284 | link->irq, NULL) != 0) { | 282 | link->irq, NULL) != 0) { |
285 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); | 283 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); |
286 | goto failed; | 284 | goto failed; |
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index b51a9adc80f6..873877e17e1b 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <pcmcia/cs_types.h> | ||
29 | #include <pcmcia/cs.h> | 28 | #include <pcmcia/cs.h> |
30 | #include <pcmcia/cistpl.h> | 29 | #include <pcmcia/cistpl.h> |
31 | #include <pcmcia/cisreg.h> | 30 | #include <pcmcia/cisreg.h> |
@@ -80,35 +79,27 @@ static int | |||
80 | spectrum_reset(struct pcmcia_device *link, int idle) | 79 | spectrum_reset(struct pcmcia_device *link, int idle) |
81 | { | 80 | { |
82 | int ret; | 81 | int ret; |
83 | conf_reg_t reg; | 82 | u8 save_cor; |
84 | u_int save_cor; | 83 | u8 ccsr; |
85 | 84 | ||
86 | /* Doing it if hardware is gone is guaranteed crash */ | 85 | /* Doing it if hardware is gone is guaranteed crash */ |
87 | if (!pcmcia_dev_present(link)) | 86 | if (!pcmcia_dev_present(link)) |
88 | return -ENODEV; | 87 | return -ENODEV; |
89 | 88 | ||
90 | /* Save original COR value */ | 89 | /* Save original COR value */ |
91 | reg.Function = 0; | 90 | ret = pcmcia_read_config_byte(link, CISREG_COR, &save_cor); |
92 | reg.Action = CS_READ; | ||
93 | reg.Offset = CISREG_COR; | ||
94 | ret = pcmcia_access_configuration_register(link, ®); | ||
95 | if (ret) | 91 | if (ret) |
96 | goto failed; | 92 | goto failed; |
97 | save_cor = reg.Value; | ||
98 | 93 | ||
99 | /* Soft-Reset card */ | 94 | /* Soft-Reset card */ |
100 | reg.Action = CS_WRITE; | 95 | ret = pcmcia_write_config_byte(link, CISREG_COR, |
101 | reg.Offset = CISREG_COR; | 96 | (save_cor | COR_SOFT_RESET)); |
102 | reg.Value = (save_cor | COR_SOFT_RESET); | ||
103 | ret = pcmcia_access_configuration_register(link, ®); | ||
104 | if (ret) | 97 | if (ret) |
105 | goto failed; | 98 | goto failed; |
106 | udelay(1000); | 99 | udelay(1000); |
107 | 100 | ||
108 | /* Read CCSR */ | 101 | /* Read CCSR */ |
109 | reg.Action = CS_READ; | 102 | ret = pcmcia_read_config_byte(link, CISREG_CCSR, &ccsr); |
110 | reg.Offset = CISREG_CCSR; | ||
111 | ret = pcmcia_access_configuration_register(link, ®); | ||
112 | if (ret) | 103 | if (ret) |
113 | goto failed; | 104 | goto failed; |
114 | 105 | ||
@@ -116,19 +107,15 @@ spectrum_reset(struct pcmcia_device *link, int idle) | |||
116 | * Start or stop the firmware. Memory width bit should be | 107 | * Start or stop the firmware. Memory width bit should be |
117 | * preserved from the value we've just read. | 108 | * preserved from the value we've just read. |
118 | */ | 109 | */ |
119 | reg.Action = CS_WRITE; | 110 | ccsr = (idle ? HCR_IDLE : HCR_RUN) | (ccsr & HCR_MEM16); |
120 | reg.Offset = CISREG_CCSR; | 111 | ret = pcmcia_write_config_byte(link, CISREG_CCSR, ccsr); |
121 | reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16); | ||
122 | ret = pcmcia_access_configuration_register(link, ®); | ||
123 | if (ret) | 112 | if (ret) |
124 | goto failed; | 113 | goto failed; |
125 | udelay(1000); | 114 | udelay(1000); |
126 | 115 | ||
127 | /* Restore original COR configuration index */ | 116 | /* Restore original COR configuration index */ |
128 | reg.Action = CS_WRITE; | 117 | ret = pcmcia_write_config_byte(link, CISREG_COR, |
129 | reg.Offset = CISREG_COR; | 118 | (save_cor & ~COR_SOFT_RESET)); |
130 | reg.Value = (save_cor & ~COR_SOFT_RESET); | ||
131 | ret = pcmcia_access_configuration_register(link, ®); | ||
132 | if (ret) | 119 | if (ret) |
133 | goto failed; | 120 | goto failed; |
134 | udelay(1000); | 121 | udelay(1000); |
@@ -266,25 +253,23 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev, | |||
266 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 253 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
267 | 254 | ||
268 | /* IO window settings */ | 255 | /* IO window settings */ |
269 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 256 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
270 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 257 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
271 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 258 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
272 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 259 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; |
273 | if (!(io->flags & CISTPL_IO_8BIT)) | 260 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
274 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 261 | p_dev->resource[0]->flags |= |
275 | if (!(io->flags & CISTPL_IO_16BIT)) | 262 | pcmcia_io_cfg_data_width(io->flags); |
276 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 263 | p_dev->resource[0]->start = io->win[0].base; |
277 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | 264 | p_dev->resource[0]->end = io->win[0].len; |
278 | p_dev->io.BasePort1 = io->win[0].base; | ||
279 | p_dev->io.NumPorts1 = io->win[0].len; | ||
280 | if (io->nwin > 1) { | 265 | if (io->nwin > 1) { |
281 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 266 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
282 | p_dev->io.BasePort2 = io->win[1].base; | 267 | p_dev->resource[1]->start = io->win[1].base; |
283 | p_dev->io.NumPorts2 = io->win[1].len; | 268 | p_dev->resource[1]->end = io->win[1].len; |
284 | } | 269 | } |
285 | 270 | ||
286 | /* This reserves IO space but doesn't actually enable it */ | 271 | /* This reserves IO space but doesn't actually enable it */ |
287 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | 272 | if (pcmcia_request_io(p_dev) != 0) |
288 | goto next_entry; | 273 | goto next_entry; |
289 | } | 274 | } |
290 | return 0; | 275 | return 0; |
@@ -332,7 +317,8 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
332 | /* We initialize the hermes structure before completing PCMCIA | 317 | /* We initialize the hermes structure before completing PCMCIA |
333 | * configuration just in case the interrupt handler gets | 318 | * configuration just in case the interrupt handler gets |
334 | * called. */ | 319 | * called. */ |
335 | mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); | 320 | mem = ioport_map(link->resource[0]->start, |
321 | resource_size(link->resource[0])); | ||
336 | if (!mem) | 322 | if (!mem) |
337 | goto failed; | 323 | goto failed; |
338 | 324 | ||
@@ -359,7 +345,7 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
359 | } | 345 | } |
360 | 346 | ||
361 | /* Register an interface with the stack */ | 347 | /* Register an interface with the stack */ |
362 | if (orinoco_if_add(priv, link->io.BasePort1, | 348 | if (orinoco_if_add(priv, link->resource[0]->start, |
363 | link->irq, NULL) != 0) { | 349 | link->irq, NULL) != 0) { |
364 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); | 350 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); |
365 | goto failed; | 351 | goto failed; |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 9c38fc331dca..88560d0ae50a 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/ethtool.h> | 46 | #include <linux/ethtool.h> |
47 | #include <linux/ieee80211.h> | 47 | #include <linux/ieee80211.h> |
48 | 48 | ||
49 | #include <pcmcia/cs_types.h> | ||
50 | #include <pcmcia/cs.h> | 49 | #include <pcmcia/cs.h> |
51 | #include <pcmcia/cistpl.h> | 50 | #include <pcmcia/cistpl.h> |
52 | #include <pcmcia/cisreg.h> | 51 | #include <pcmcia/cisreg.h> |
@@ -315,9 +314,8 @@ static int ray_probe(struct pcmcia_device *p_dev) | |||
315 | local->finder = p_dev; | 314 | local->finder = p_dev; |
316 | 315 | ||
317 | /* The io structure describes IO port mapping. None used here */ | 316 | /* The io structure describes IO port mapping. None used here */ |
318 | p_dev->io.NumPorts1 = 0; | 317 | p_dev->resource[0]->end = 0; |
319 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 318 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
320 | p_dev->io.IOAddrLines = 5; | ||
321 | 319 | ||
322 | /* General socket configuration */ | 320 | /* General socket configuration */ |
323 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; | 321 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
@@ -394,7 +392,6 @@ static int ray_config(struct pcmcia_device *link) | |||
394 | int ret = 0; | 392 | int ret = 0; |
395 | int i; | 393 | int i; |
396 | win_req_t req; | 394 | win_req_t req; |
397 | memreq_t mem; | ||
398 | struct net_device *dev = (struct net_device *)link->priv; | 395 | struct net_device *dev = (struct net_device *)link->priv; |
399 | ray_dev_t *local = netdev_priv(dev); | 396 | ray_dev_t *local = netdev_priv(dev); |
400 | 397 | ||
@@ -431,9 +428,7 @@ static int ray_config(struct pcmcia_device *link) | |||
431 | ret = pcmcia_request_window(link, &req, &link->win); | 428 | ret = pcmcia_request_window(link, &req, &link->win); |
432 | if (ret) | 429 | if (ret) |
433 | goto failed; | 430 | goto failed; |
434 | mem.CardOffset = 0x0000; | 431 | ret = pcmcia_map_mem_page(link, link->win, 0); |
435 | mem.Page = 0; | ||
436 | ret = pcmcia_map_mem_page(link, link->win, &mem); | ||
437 | if (ret) | 432 | if (ret) |
438 | goto failed; | 433 | goto failed; |
439 | local->sram = ioremap(req.Base, req.Size); | 434 | local->sram = ioremap(req.Base, req.Size); |
@@ -447,9 +442,7 @@ static int ray_config(struct pcmcia_device *link) | |||
447 | ret = pcmcia_request_window(link, &req, &local->rmem_handle); | 442 | ret = pcmcia_request_window(link, &req, &local->rmem_handle); |
448 | if (ret) | 443 | if (ret) |
449 | goto failed; | 444 | goto failed; |
450 | mem.CardOffset = 0x8000; | 445 | ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000); |
451 | mem.Page = 0; | ||
452 | ret = pcmcia_map_mem_page(link, local->rmem_handle, &mem); | ||
453 | if (ret) | 446 | if (ret) |
454 | goto failed; | 447 | goto failed; |
455 | local->rmem = ioremap(req.Base, req.Size); | 448 | local->rmem = ioremap(req.Base, req.Size); |
@@ -463,9 +456,7 @@ static int ray_config(struct pcmcia_device *link) | |||
463 | ret = pcmcia_request_window(link, &req, &local->amem_handle); | 456 | ret = pcmcia_request_window(link, &req, &local->amem_handle); |
464 | if (ret) | 457 | if (ret) |
465 | goto failed; | 458 | goto failed; |
466 | mem.CardOffset = 0x0000; | 459 | ret = pcmcia_map_mem_page(link, local->amem_handle, 0); |
467 | mem.Page = 0; | ||
468 | ret = pcmcia_map_mem_page(link, local->amem_handle, &mem); | ||
469 | if (ret) | 460 | if (ret) |
470 | goto failed; | 461 | goto failed; |
471 | local->amem = ioremap(req.Base, req.Size); | 462 | local->amem = ioremap(req.Base, req.Size); |
@@ -793,7 +784,6 @@ static void ray_release(struct pcmcia_device *link) | |||
793 | { | 784 | { |
794 | struct net_device *dev = link->priv; | 785 | struct net_device *dev = link->priv; |
795 | ray_dev_t *local = netdev_priv(dev); | 786 | ray_dev_t *local = netdev_priv(dev); |
796 | int i; | ||
797 | 787 | ||
798 | dev_dbg(&link->dev, "ray_release\n"); | 788 | dev_dbg(&link->dev, "ray_release\n"); |
799 | 789 | ||
@@ -802,13 +792,6 @@ static void ray_release(struct pcmcia_device *link) | |||
802 | iounmap(local->sram); | 792 | iounmap(local->sram); |
803 | iounmap(local->rmem); | 793 | iounmap(local->rmem); |
804 | iounmap(local->amem); | 794 | iounmap(local->amem); |
805 | /* Do bother checking to see if these succeed or not */ | ||
806 | i = pcmcia_release_window(link, local->amem_handle); | ||
807 | if (i != 0) | ||
808 | dev_dbg(&link->dev, "ReleaseWindow(local->amem) ret = %x\n", i); | ||
809 | i = pcmcia_release_window(link, local->rmem_handle); | ||
810 | if (i != 0) | ||
811 | dev_dbg(&link->dev, "ReleaseWindow(local->rmem) ret = %x\n", i); | ||
812 | pcmcia_disable_device(link); | 795 | pcmcia_disable_device(link); |
813 | 796 | ||
814 | dev_dbg(&link->dev, "ray_release ending\n"); | 797 | dev_dbg(&link->dev, "ray_release ending\n"); |
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 376c6b964a9c..a1cc2d498a1c 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c | |||
@@ -48,7 +48,6 @@ | |||
48 | 48 | ||
49 | #include <net/iw_handler.h> | 49 | #include <net/iw_handler.h> |
50 | 50 | ||
51 | #include <pcmcia/cs_types.h> | ||
52 | #include <pcmcia/cs.h> | 51 | #include <pcmcia/cs.h> |
53 | #include <pcmcia/cistpl.h> | 52 | #include <pcmcia/cistpl.h> |
54 | #include <pcmcia/cisreg.h> | 53 | #include <pcmcia/cisreg.h> |
@@ -89,13 +88,6 @@ | |||
89 | static int wl3501_config(struct pcmcia_device *link); | 88 | static int wl3501_config(struct pcmcia_device *link); |
90 | static void wl3501_release(struct pcmcia_device *link); | 89 | static void wl3501_release(struct pcmcia_device *link); |
91 | 90 | ||
92 | /* | ||
93 | * The dev_info variable is the "key" that is used to match up this | ||
94 | * device driver with appropriate cards, through the card configuration | ||
95 | * database. | ||
96 | */ | ||
97 | static dev_info_t wl3501_dev_info = "wl3501_cs"; | ||
98 | |||
99 | static const struct { | 91 | static const struct { |
100 | int reg_domain; | 92 | int reg_domain; |
101 | int min, max, deflt; | 93 | int min, max, deflt; |
@@ -1421,7 +1413,7 @@ static struct iw_statistics *wl3501_get_wireless_stats(struct net_device *dev) | |||
1421 | 1413 | ||
1422 | static void wl3501_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1414 | static void wl3501_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1423 | { | 1415 | { |
1424 | strlcpy(info->driver, wl3501_dev_info, sizeof(info->driver)); | 1416 | strlcpy(info->driver, "wl3501_cs", sizeof(info->driver)); |
1425 | } | 1417 | } |
1426 | 1418 | ||
1427 | static const struct ethtool_ops ops = { | 1419 | static const struct ethtool_ops ops = { |
@@ -1892,9 +1884,8 @@ static int wl3501_probe(struct pcmcia_device *p_dev) | |||
1892 | struct wl3501_card *this; | 1884 | struct wl3501_card *this; |
1893 | 1885 | ||
1894 | /* The io structure describes IO port mapping */ | 1886 | /* The io structure describes IO port mapping */ |
1895 | p_dev->io.NumPorts1 = 16; | 1887 | p_dev->resource[0]->end = 16; |
1896 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 1888 | p_dev->resource[0]->flags = IO_DATA_PATH_WIDTH_8; |
1897 | p_dev->io.IOAddrLines = 5; | ||
1898 | 1889 | ||
1899 | /* General socket configuration */ | 1890 | /* General socket configuration */ |
1900 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; | 1891 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
@@ -1940,13 +1931,14 @@ static int wl3501_config(struct pcmcia_device *link) | |||
1940 | /* Try allocating IO ports. This tries a few fixed addresses. If you | 1931 | /* Try allocating IO ports. This tries a few fixed addresses. If you |
1941 | * want, you can also read the card's config table to pick addresses -- | 1932 | * want, you can also read the card's config table to pick addresses -- |
1942 | * see the serial driver for an example. */ | 1933 | * see the serial driver for an example. */ |
1934 | link->io_lines = 5; | ||
1943 | 1935 | ||
1944 | for (j = 0x280; j < 0x400; j += 0x20) { | 1936 | for (j = 0x280; j < 0x400; j += 0x20) { |
1945 | /* The '^0x300' is so that we probe 0x300-0x3ff first, then | 1937 | /* The '^0x300' is so that we probe 0x300-0x3ff first, then |
1946 | * 0x200-0x2ff, and so on, because this seems safer */ | 1938 | * 0x200-0x2ff, and so on, because this seems safer */ |
1947 | link->io.BasePort1 = j; | 1939 | link->resource[0]->start = j; |
1948 | link->io.BasePort2 = link->io.BasePort1 + 0x10; | 1940 | link->resource[1]->start = link->resource[0]->start + 0x10; |
1949 | i = pcmcia_request_io(link, &link->io); | 1941 | i = pcmcia_request_io(link); |
1950 | if (i == 0) | 1942 | if (i == 0) |
1951 | break; | 1943 | break; |
1952 | } | 1944 | } |
@@ -1968,7 +1960,7 @@ static int wl3501_config(struct pcmcia_device *link) | |||
1968 | goto failed; | 1960 | goto failed; |
1969 | 1961 | ||
1970 | dev->irq = link->irq; | 1962 | dev->irq = link->irq; |
1971 | dev->base_addr = link->io.BasePort1; | 1963 | dev->base_addr = link->resource[0]->start; |
1972 | SET_NETDEV_DEV(dev, &link->dev); | 1964 | SET_NETDEV_DEV(dev, &link->dev); |
1973 | if (register_netdev(dev)) { | 1965 | if (register_netdev(dev)) { |
1974 | printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); | 1966 | printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); |
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index fd8cfe95f0a3..23e50f4a27c5 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c | |||
@@ -48,7 +48,6 @@ | |||
48 | #include <linux/parport.h> | 48 | #include <linux/parport.h> |
49 | #include <linux/parport_pc.h> | 49 | #include <linux/parport_pc.h> |
50 | 50 | ||
51 | #include <pcmcia/cs_types.h> | ||
52 | #include <pcmcia/cs.h> | 51 | #include <pcmcia/cs.h> |
53 | #include <pcmcia/cistpl.h> | 52 | #include <pcmcia/cistpl.h> |
54 | #include <pcmcia/ds.h> | 53 | #include <pcmcia/ds.h> |
@@ -102,8 +101,8 @@ static int parport_probe(struct pcmcia_device *link) | |||
102 | link->priv = info; | 101 | link->priv = info; |
103 | info->p_dev = link; | 102 | info->p_dev = link; |
104 | 103 | ||
105 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 104 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
106 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 105 | link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; |
107 | link->conf.Attributes = CONF_ENABLE_IRQ; | 106 | link->conf.Attributes = CONF_ENABLE_IRQ; |
108 | link->conf.IntType = INT_MEMORY_AND_IO; | 107 | link->conf.IntType = INT_MEMORY_AND_IO; |
109 | 108 | ||
@@ -144,16 +143,16 @@ static int parport_config_check(struct pcmcia_device *p_dev, | |||
144 | { | 143 | { |
145 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 144 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
146 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 145 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
146 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; | ||
147 | if (epp_mode) | 147 | if (epp_mode) |
148 | p_dev->conf.ConfigIndex |= FORCE_EPP_MODE; | 148 | p_dev->conf.ConfigIndex |= FORCE_EPP_MODE; |
149 | p_dev->io.BasePort1 = io->win[0].base; | 149 | p_dev->resource[0]->start = io->win[0].base; |
150 | p_dev->io.NumPorts1 = io->win[0].len; | 150 | p_dev->resource[0]->end = io->win[0].len; |
151 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
152 | if (io->nwin == 2) { | 151 | if (io->nwin == 2) { |
153 | p_dev->io.BasePort2 = io->win[1].base; | 152 | p_dev->resource[1]->start = io->win[1].base; |
154 | p_dev->io.NumPorts2 = io->win[1].len; | 153 | p_dev->resource[1]->end = io->win[1].len; |
155 | } | 154 | } |
156 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | 155 | if (pcmcia_request_io(p_dev) != 0) |
157 | return -ENODEV; | 156 | return -ENODEV; |
158 | return 0; | 157 | return 0; |
159 | } | 158 | } |
@@ -178,12 +177,14 @@ static int parport_config(struct pcmcia_device *link) | |||
178 | if (ret) | 177 | if (ret) |
179 | goto failed; | 178 | goto failed; |
180 | 179 | ||
181 | p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2, | 180 | p = parport_pc_probe_port(link->resource[0]->start, |
181 | link->resource[1]->start, | ||
182 | link->irq, PARPORT_DMA_NONE, | 182 | link->irq, PARPORT_DMA_NONE, |
183 | &link->dev, IRQF_SHARED); | 183 | &link->dev, IRQF_SHARED); |
184 | if (p == NULL) { | 184 | if (p == NULL) { |
185 | printk(KERN_NOTICE "parport_cs: parport_pc_probe_port() at " | 185 | printk(KERN_NOTICE "parport_cs: parport_pc_probe_port() at " |
186 | "0x%3x, irq %u failed\n", link->io.BasePort1, | 186 | "0x%3x, irq %u failed\n", |
187 | (unsigned int) link->resource[0]->start, | ||
187 | link->irq); | 188 | link->irq); |
188 | goto failed; | 189 | goto failed; |
189 | } | 190 | } |
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index d006e8beab9c..7a2b1604bf1c 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -7,7 +7,6 @@ pcmcia_core-$(CONFIG_CARDBUS) += cardbus.o | |||
7 | obj-$(CONFIG_PCCARD) += pcmcia_core.o | 7 | obj-$(CONFIG_PCCARD) += pcmcia_core.o |
8 | 8 | ||
9 | pcmcia-y += ds.o pcmcia_resource.o cistpl.o pcmcia_cis.o | 9 | pcmcia-y += ds.o pcmcia_resource.o cistpl.o pcmcia_cis.o |
10 | pcmcia-$(CONFIG_PCMCIA_IOCTL) += pcmcia_ioctl.o | ||
11 | obj-$(CONFIG_PCMCIA) += pcmcia.o | 10 | obj-$(CONFIG_PCMCIA) += pcmcia.o |
12 | 11 | ||
13 | pcmcia_rsrc-y += rsrc_mgr.o | 12 | pcmcia_rsrc-y += rsrc_mgr.o |
diff --git a/drivers/pcmcia/au1000_generic.h b/drivers/pcmcia/au1000_generic.h index a324d329dea6..67530cefcf3c 100644 --- a/drivers/pcmcia/au1000_generic.h +++ b/drivers/pcmcia/au1000_generic.h | |||
@@ -23,7 +23,6 @@ | |||
23 | 23 | ||
24 | /* include the world */ | 24 | /* include the world */ |
25 | 25 | ||
26 | #include <pcmcia/cs_types.h> | ||
27 | #include <pcmcia/cs.h> | 26 | #include <pcmcia/cs.h> |
28 | #include <pcmcia/ss.h> | 27 | #include <pcmcia/ss.h> |
29 | #include <pcmcia/cistpl.h> | 28 | #include <pcmcia/cistpl.h> |
diff --git a/drivers/pcmcia/au1000_pb1x00.c b/drivers/pcmcia/au1000_pb1x00.c index 5a979cb8f3e6..807f2d75dad3 100644 --- a/drivers/pcmcia/au1000_pb1x00.c +++ b/drivers/pcmcia/au1000_pb1x00.c | |||
@@ -31,11 +31,9 @@ | |||
31 | #include <linux/proc_fs.h> | 31 | #include <linux/proc_fs.h> |
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
33 | 33 | ||
34 | #include <pcmcia/cs_types.h> | ||
35 | #include <pcmcia/cs.h> | 34 | #include <pcmcia/cs.h> |
36 | #include <pcmcia/ss.h> | 35 | #include <pcmcia/ss.h> |
37 | #include <pcmcia/cistpl.h> | 36 | #include <pcmcia/cistpl.h> |
38 | #include <pcmcia/bus_ops.h> | ||
39 | 37 | ||
40 | #include <asm/io.h> | 38 | #include <asm/io.h> |
41 | #include <asm/irq.h> | 39 | #include <asm/irq.h> |
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 8844bc3e3118..91414a0ddc44 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <asm/byteorder.h> | 27 | #include <asm/byteorder.h> |
28 | #include <asm/unaligned.h> | 28 | #include <asm/unaligned.h> |
29 | 29 | ||
30 | #include <pcmcia/cs_types.h> | ||
31 | #include <pcmcia/ss.h> | 30 | #include <pcmcia/ss.h> |
32 | #include <pcmcia/cs.h> | 31 | #include <pcmcia/cs.h> |
33 | #include <pcmcia/cisreg.h> | 32 | #include <pcmcia/cisreg.h> |
@@ -54,6 +53,9 @@ static const u_int exponent[] = { | |||
54 | /* Upper limit on reasonable # of tuples */ | 53 | /* Upper limit on reasonable # of tuples */ |
55 | #define MAX_TUPLES 200 | 54 | #define MAX_TUPLES 200 |
56 | 55 | ||
56 | /* Bits in IRQInfo1 field */ | ||
57 | #define IRQ_INFO2_VALID 0x10 | ||
58 | |||
57 | /* 16-bit CIS? */ | 59 | /* 16-bit CIS? */ |
58 | static int cis_width; | 60 | static int cis_width; |
59 | module_param(cis_width, int, 0444); | 61 | module_param(cis_width, int, 0444); |
@@ -210,7 +212,7 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, | |||
210 | * Probably only useful for writing one-byte registers. Must be called | 212 | * Probably only useful for writing one-byte registers. Must be called |
211 | * with ops_mutex held. | 213 | * with ops_mutex held. |
212 | */ | 214 | */ |
213 | void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, | 215 | int pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, |
214 | u_int len, void *ptr) | 216 | u_int len, void *ptr) |
215 | { | 217 | { |
216 | void __iomem *sys, *end; | 218 | void __iomem *sys, *end; |
@@ -232,7 +234,7 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, | |||
232 | ((cis_width) ? MAP_16BIT : 0)); | 234 | ((cis_width) ? MAP_16BIT : 0)); |
233 | if (!sys) { | 235 | if (!sys) { |
234 | dev_dbg(&s->dev, "could not map memory\n"); | 236 | dev_dbg(&s->dev, "could not map memory\n"); |
235 | return; /* FIXME: Error */ | 237 | return -EINVAL; |
236 | } | 238 | } |
237 | 239 | ||
238 | writeb(flags, sys+CISREG_ICTRL0); | 240 | writeb(flags, sys+CISREG_ICTRL0); |
@@ -257,7 +259,7 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, | |||
257 | sys = set_cis_map(s, card_offset, flags); | 259 | sys = set_cis_map(s, card_offset, flags); |
258 | if (!sys) { | 260 | if (!sys) { |
259 | dev_dbg(&s->dev, "could not map memory\n"); | 261 | dev_dbg(&s->dev, "could not map memory\n"); |
260 | return; /* FIXME: error */ | 262 | return -EINVAL; |
261 | } | 263 | } |
262 | 264 | ||
263 | end = sys + s->map_size; | 265 | end = sys + s->map_size; |
@@ -271,6 +273,7 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, | |||
271 | addr = 0; | 273 | addr = 0; |
272 | } | 274 | } |
273 | } | 275 | } |
276 | return 0; | ||
274 | } | 277 | } |
275 | 278 | ||
276 | 279 | ||
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 976d80706eae..2ec8ac97445c 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <asm/system.h> | 32 | #include <asm/system.h> |
33 | #include <asm/irq.h> | 33 | #include <asm/irq.h> |
34 | 34 | ||
35 | #include <pcmcia/cs_types.h> | ||
36 | #include <pcmcia/ss.h> | 35 | #include <pcmcia/ss.h> |
37 | #include <pcmcia/cs.h> | 36 | #include <pcmcia/cs.h> |
38 | #include <pcmcia/cistpl.h> | 37 | #include <pcmcia/cistpl.h> |
@@ -252,38 +251,6 @@ struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr) | |||
252 | } | 251 | } |
253 | EXPORT_SYMBOL(pcmcia_get_socket_by_nr); | 252 | EXPORT_SYMBOL(pcmcia_get_socket_by_nr); |
254 | 253 | ||
255 | /* | ||
256 | * The central event handler. Send_event() sends an event to the | ||
257 | * 16-bit subsystem, which then calls the relevant device drivers. | ||
258 | * Parse_events() interprets the event bits from | ||
259 | * a card status change report. Do_shutdown() handles the high | ||
260 | * priority stuff associated with a card removal. | ||
261 | */ | ||
262 | |||
263 | /* NOTE: send_event needs to be called with skt->sem held. */ | ||
264 | |||
265 | static int send_event(struct pcmcia_socket *s, event_t event, int priority) | ||
266 | { | ||
267 | int ret; | ||
268 | |||
269 | if ((s->state & SOCKET_CARDBUS) && (event != CS_EVENT_CARD_REMOVAL)) | ||
270 | return 0; | ||
271 | |||
272 | dev_dbg(&s->dev, "send_event(event %d, pri %d, callback 0x%p)\n", | ||
273 | event, priority, s->callback); | ||
274 | |||
275 | if (!s->callback) | ||
276 | return 0; | ||
277 | if (!try_module_get(s->callback->owner)) | ||
278 | return 0; | ||
279 | |||
280 | ret = s->callback->event(s, event, priority); | ||
281 | |||
282 | module_put(s->callback->owner); | ||
283 | |||
284 | return ret; | ||
285 | } | ||
286 | |||
287 | static int socket_reset(struct pcmcia_socket *skt) | 254 | static int socket_reset(struct pcmcia_socket *skt) |
288 | { | 255 | { |
289 | int status, i; | 256 | int status, i; |
@@ -326,7 +293,8 @@ static void socket_shutdown(struct pcmcia_socket *s) | |||
326 | 293 | ||
327 | dev_dbg(&s->dev, "shutdown\n"); | 294 | dev_dbg(&s->dev, "shutdown\n"); |
328 | 295 | ||
329 | send_event(s, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH); | 296 | if (s->callback) |
297 | s->callback->remove(s); | ||
330 | 298 | ||
331 | mutex_lock(&s->ops_mutex); | 299 | mutex_lock(&s->ops_mutex); |
332 | s->state &= SOCKET_INUSE | SOCKET_PRESENT; | 300 | s->state &= SOCKET_INUSE | SOCKET_PRESENT; |
@@ -477,7 +445,8 @@ static int socket_insert(struct pcmcia_socket *skt) | |||
477 | dev_dbg(&skt->dev, "insert done\n"); | 445 | dev_dbg(&skt->dev, "insert done\n"); |
478 | mutex_unlock(&skt->ops_mutex); | 446 | mutex_unlock(&skt->ops_mutex); |
479 | 447 | ||
480 | send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); | 448 | if (!(skt->state & SOCKET_CARDBUS) && (skt->callback)) |
449 | skt->callback->add(skt); | ||
481 | } else { | 450 | } else { |
482 | mutex_unlock(&skt->ops_mutex); | 451 | mutex_unlock(&skt->ops_mutex); |
483 | socket_shutdown(skt); | 452 | socket_shutdown(skt); |
@@ -494,7 +463,6 @@ static int socket_suspend(struct pcmcia_socket *skt) | |||
494 | mutex_lock(&skt->ops_mutex); | 463 | mutex_lock(&skt->ops_mutex); |
495 | skt->suspended_state = skt->state; | 464 | skt->suspended_state = skt->state; |
496 | 465 | ||
497 | send_event(skt, CS_EVENT_PM_SUSPEND, CS_EVENT_PRI_LOW); | ||
498 | skt->socket = dead_socket; | 466 | skt->socket = dead_socket; |
499 | skt->ops->set_socket(skt, &skt->socket); | 467 | skt->ops->set_socket(skt, &skt->socket); |
500 | if (skt->ops->suspend) | 468 | if (skt->ops->suspend) |
@@ -555,8 +523,8 @@ static int socket_late_resume(struct pcmcia_socket *skt) | |||
555 | return 0; | 523 | return 0; |
556 | } | 524 | } |
557 | #endif | 525 | #endif |
558 | 526 | if (!(skt->state & SOCKET_CARDBUS) && (skt->callback)) | |
559 | send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW); | 527 | skt->callback->early_resume(skt); |
560 | return 0; | 528 | return 0; |
561 | } | 529 | } |
562 | 530 | ||
@@ -654,16 +622,8 @@ static int pccardd(void *__skt) | |||
654 | spin_unlock_irqrestore(&skt->thread_lock, flags); | 622 | spin_unlock_irqrestore(&skt->thread_lock, flags); |
655 | 623 | ||
656 | mutex_lock(&skt->skt_mutex); | 624 | mutex_lock(&skt->skt_mutex); |
657 | if (events) { | 625 | if (events & SS_DETECT) |
658 | if (events & SS_DETECT) | 626 | socket_detect_change(skt); |
659 | socket_detect_change(skt); | ||
660 | if (events & SS_BATDEAD) | ||
661 | send_event(skt, CS_EVENT_BATTERY_DEAD, CS_EVENT_PRI_LOW); | ||
662 | if (events & SS_BATWARN) | ||
663 | send_event(skt, CS_EVENT_BATTERY_LOW, CS_EVENT_PRI_LOW); | ||
664 | if (events & SS_READY) | ||
665 | send_event(skt, CS_EVENT_READY_CHANGE, CS_EVENT_PRI_LOW); | ||
666 | } | ||
667 | 627 | ||
668 | if (sysfs_events) { | 628 | if (sysfs_events) { |
669 | if (sysfs_events & PCMCIA_UEVENT_EJECT) | 629 | if (sysfs_events & PCMCIA_UEVENT_EJECT) |
@@ -783,7 +743,7 @@ int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c) | |||
783 | s->callback = c; | 743 | s->callback = c; |
784 | 744 | ||
785 | if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT) | 745 | if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT) |
786 | send_event(s, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); | 746 | s->callback->add(s); |
787 | } else | 747 | } else |
788 | s->callback = NULL; | 748 | s->callback = NULL; |
789 | err: | 749 | err: |
@@ -823,20 +783,13 @@ int pcmcia_reset_card(struct pcmcia_socket *skt) | |||
823 | break; | 783 | break; |
824 | } | 784 | } |
825 | 785 | ||
826 | ret = send_event(skt, CS_EVENT_RESET_REQUEST, CS_EVENT_PRI_LOW); | 786 | if (skt->callback) |
827 | if (ret == 0) { | 787 | skt->callback->suspend(skt); |
828 | send_event(skt, CS_EVENT_RESET_PHYSICAL, CS_EVENT_PRI_LOW); | 788 | mutex_lock(&skt->ops_mutex); |
829 | if (skt->callback) | 789 | ret = socket_reset(skt); |
830 | skt->callback->suspend(skt); | 790 | mutex_unlock(&skt->ops_mutex); |
831 | mutex_lock(&skt->ops_mutex); | 791 | if ((ret == 0) && (skt->callback)) |
832 | ret = socket_reset(skt); | 792 | skt->callback->resume(skt); |
833 | mutex_unlock(&skt->ops_mutex); | ||
834 | if (ret == 0) { | ||
835 | send_event(skt, CS_EVENT_CARD_RESET, CS_EVENT_PRI_LOW); | ||
836 | if (skt->callback) | ||
837 | skt->callback->resume(skt); | ||
838 | } | ||
839 | } | ||
840 | 793 | ||
841 | ret = 0; | 794 | ret = 0; |
842 | } while (0); | 795 | } while (0); |
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 4126a75445ea..da055dc14d98 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
@@ -10,7 +10,7 @@ | |||
10 | * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. | 10 | * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. |
11 | * | 11 | * |
12 | * (C) 1999 David A. Hinds | 12 | * (C) 1999 David A. Hinds |
13 | * (C) 2003 - 2008 Dominik Brodowski | 13 | * (C) 2003 - 2010 Dominik Brodowski |
14 | * | 14 | * |
15 | * | 15 | * |
16 | * This file contains definitions _only_ needed by the PCMCIA core modules. | 16 | * This file contains definitions _only_ needed by the PCMCIA core modules. |
@@ -26,6 +26,9 @@ | |||
26 | /* Flags in client state */ | 26 | /* Flags in client state */ |
27 | #define CLIENT_WIN_REQ(i) (0x1<<(i)) | 27 | #define CLIENT_WIN_REQ(i) (0x1<<(i)) |
28 | 28 | ||
29 | /* Flag to access all functions */ | ||
30 | #define BIND_FN_ALL 0xff | ||
31 | |||
29 | /* Each card function gets one of these guys */ | 32 | /* Each card function gets one of these guys */ |
30 | typedef struct config_t { | 33 | typedef struct config_t { |
31 | struct kref ref; | 34 | struct kref ref; |
@@ -35,7 +38,10 @@ typedef struct config_t { | |||
35 | unsigned int ConfigBase; | 38 | unsigned int ConfigBase; |
36 | unsigned char Status, Pin, Copy, Option, ExtStatus; | 39 | unsigned char Status, Pin, Copy, Option, ExtStatus; |
37 | unsigned int CardValues; | 40 | unsigned int CardValues; |
38 | io_req_t io; | 41 | |
42 | struct resource io[MAX_IO_WIN]; /* io ports */ | ||
43 | struct resource mem[MAX_WIN]; /* mem areas */ | ||
44 | |||
39 | struct { | 45 | struct { |
40 | u_int Attributes; | 46 | u_int Attributes; |
41 | } irq; | 47 | } irq; |
@@ -56,18 +62,11 @@ struct pccard_resource_ops { | |||
56 | unsigned int attr, | 62 | unsigned int attr, |
57 | unsigned int *base, | 63 | unsigned int *base, |
58 | unsigned int num, | 64 | unsigned int num, |
59 | unsigned int align); | 65 | unsigned int align, |
66 | struct resource **parent); | ||
60 | struct resource* (*find_mem) (unsigned long base, unsigned long num, | 67 | struct resource* (*find_mem) (unsigned long base, unsigned long num, |
61 | unsigned long align, int low, | 68 | unsigned long align, int low, |
62 | struct pcmcia_socket *s); | 69 | struct pcmcia_socket *s); |
63 | int (*add_io) (struct pcmcia_socket *s, | ||
64 | unsigned int action, | ||
65 | unsigned long r_start, | ||
66 | unsigned long r_end); | ||
67 | int (*add_mem) (struct pcmcia_socket *s, | ||
68 | unsigned int action, | ||
69 | unsigned long r_start, | ||
70 | unsigned long r_end); | ||
71 | int (*init) (struct pcmcia_socket *s); | 70 | int (*init) (struct pcmcia_socket *s); |
72 | void (*exit) (struct pcmcia_socket *s); | 71 | void (*exit) (struct pcmcia_socket *s); |
73 | }; | 72 | }; |
@@ -114,11 +113,12 @@ void cb_free(struct pcmcia_socket *s); | |||
114 | 113 | ||
115 | struct pcmcia_callback{ | 114 | struct pcmcia_callback{ |
116 | struct module *owner; | 115 | struct module *owner; |
117 | int (*event) (struct pcmcia_socket *s, | 116 | int (*add) (struct pcmcia_socket *s); |
118 | event_t event, int priority); | 117 | int (*remove) (struct pcmcia_socket *s); |
119 | void (*requery) (struct pcmcia_socket *s); | 118 | void (*requery) (struct pcmcia_socket *s); |
120 | int (*validate) (struct pcmcia_socket *s, unsigned int *i); | 119 | int (*validate) (struct pcmcia_socket *s, unsigned int *i); |
121 | int (*suspend) (struct pcmcia_socket *s); | 120 | int (*suspend) (struct pcmcia_socket *s); |
121 | int (*early_resume) (struct pcmcia_socket *s); | ||
122 | int (*resume) (struct pcmcia_socket *s); | 122 | int (*resume) (struct pcmcia_socket *s); |
123 | }; | 123 | }; |
124 | 124 | ||
@@ -146,6 +146,8 @@ void pcmcia_put_socket(struct pcmcia_socket *skt); | |||
146 | /* ds.c */ | 146 | /* ds.c */ |
147 | extern struct bus_type pcmcia_bus_type; | 147 | extern struct bus_type pcmcia_bus_type; |
148 | 148 | ||
149 | struct pcmcia_device; | ||
150 | |||
149 | /* pcmcia_resource.c */ | 151 | /* pcmcia_resource.c */ |
150 | extern int pcmcia_release_configuration(struct pcmcia_device *p_dev); | 152 | extern int pcmcia_release_configuration(struct pcmcia_device *p_dev); |
151 | extern int pcmcia_validate_mem(struct pcmcia_socket *s); | 153 | extern int pcmcia_validate_mem(struct pcmcia_socket *s); |
@@ -163,8 +165,8 @@ extern struct bin_attribute pccard_cis_attr; | |||
163 | 165 | ||
164 | int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, | 166 | int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, |
165 | u_int addr, u_int len, void *ptr); | 167 | u_int addr, u_int len, void *ptr); |
166 | void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, | 168 | int pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, |
167 | u_int addr, u_int len, void *ptr); | 169 | u_int addr, u_int len, void *ptr); |
168 | void release_cis_mem(struct pcmcia_socket *s); | 170 | void release_cis_mem(struct pcmcia_socket *s); |
169 | void destroy_cis_cache(struct pcmcia_socket *s); | 171 | void destroy_cis_cache(struct pcmcia_socket *s); |
170 | int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, | 172 | int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, |
@@ -188,34 +190,4 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, | |||
188 | 190 | ||
189 | int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); | 191 | int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); |
190 | 192 | ||
191 | |||
192 | #ifdef CONFIG_PCMCIA_IOCTL | ||
193 | /* ds.c */ | ||
194 | extern struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev); | ||
195 | extern void pcmcia_put_dev(struct pcmcia_device *p_dev); | ||
196 | |||
197 | struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, | ||
198 | unsigned int function); | ||
199 | |||
200 | /* pcmcia_ioctl.c */ | ||
201 | extern void __init pcmcia_setup_ioctl(void); | ||
202 | extern void __exit pcmcia_cleanup_ioctl(void); | ||
203 | extern void handle_event(struct pcmcia_socket *s, event_t event); | ||
204 | extern int handle_request(struct pcmcia_socket *s, event_t event); | ||
205 | |||
206 | #else /* CONFIG_PCMCIA_IOCTL */ | ||
207 | |||
208 | static inline void __init pcmcia_setup_ioctl(void) { return; } | ||
209 | static inline void __exit pcmcia_cleanup_ioctl(void) { return; } | ||
210 | static inline void handle_event(struct pcmcia_socket *s, event_t event) | ||
211 | { | ||
212 | return; | ||
213 | } | ||
214 | static inline int handle_request(struct pcmcia_socket *s, event_t event) | ||
215 | { | ||
216 | return 0; | ||
217 | } | ||
218 | |||
219 | #endif /* CONFIG_PCMCIA_IOCTL */ | ||
220 | |||
221 | #endif /* _LINUX_CS_INTERNAL_H */ | 193 | #endif /* _LINUX_CS_INTERNAL_H */ |
diff --git a/drivers/pcmcia/db1xxx_ss.c b/drivers/pcmcia/db1xxx_ss.c index 0f4cc3f00028..27575e6378a1 100644 --- a/drivers/pcmcia/db1xxx_ss.c +++ b/drivers/pcmcia/db1xxx_ss.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
31 | 31 | ||
32 | #include <pcmcia/cs_types.h> | ||
33 | #include <pcmcia/ss.h> | 32 | #include <pcmcia/ss.h> |
34 | 33 | ||
35 | #include <asm/mach-au1x00/au1000.h> | 34 | #include <asm/mach-au1x00/au1000.h> |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index eac961463be2..55570d9e1e4c 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. | 10 | * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. |
11 | * | 11 | * |
12 | * (C) 1999 David A. Hinds | 12 | * (C) 1999 David A. Hinds |
13 | * (C) 2003 - 2006 Dominik Brodowski | 13 | * (C) 2003 - 2010 Dominik Brodowski |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/dma-mapping.h> | 26 | #include <linux/dma-mapping.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | 28 | ||
29 | #include <pcmcia/cs_types.h> | ||
30 | #include <pcmcia/cs.h> | 29 | #include <pcmcia/cs.h> |
31 | #include <pcmcia/cistpl.h> | 30 | #include <pcmcia/cistpl.h> |
32 | #include <pcmcia/ds.h> | 31 | #include <pcmcia/ds.h> |
@@ -213,7 +212,7 @@ EXPORT_SYMBOL(pcmcia_unregister_driver); | |||
213 | 212 | ||
214 | /* pcmcia_device handling */ | 213 | /* pcmcia_device handling */ |
215 | 214 | ||
216 | struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev) | 215 | static struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev) |
217 | { | 216 | { |
218 | struct device *tmp_dev; | 217 | struct device *tmp_dev; |
219 | tmp_dev = get_device(&p_dev->dev); | 218 | tmp_dev = get_device(&p_dev->dev); |
@@ -222,7 +221,7 @@ struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev) | |||
222 | return to_pcmcia_dev(tmp_dev); | 221 | return to_pcmcia_dev(tmp_dev); |
223 | } | 222 | } |
224 | 223 | ||
225 | void pcmcia_put_dev(struct pcmcia_device *p_dev) | 224 | static void pcmcia_put_dev(struct pcmcia_device *p_dev) |
226 | { | 225 | { |
227 | if (p_dev) | 226 | if (p_dev) |
228 | put_device(&p_dev->dev); | 227 | put_device(&p_dev->dev); |
@@ -294,7 +293,7 @@ static int pcmcia_device_probe(struct device *dev) | |||
294 | } | 293 | } |
295 | 294 | ||
296 | mutex_lock(&s->ops_mutex); | 295 | mutex_lock(&s->ops_mutex); |
297 | if ((s->pcmcia_state.has_pfc) && | 296 | if ((s->pcmcia_pfc) && |
298 | (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) | 297 | (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) |
299 | pcmcia_parse_uevents(s, PCMCIA_UEVENT_REQUERY); | 298 | pcmcia_parse_uevents(s, PCMCIA_UEVENT_REQUERY); |
300 | mutex_unlock(&s->ops_mutex); | 299 | mutex_unlock(&s->ops_mutex); |
@@ -359,7 +358,7 @@ static int pcmcia_device_remove(struct device *dev) | |||
359 | * pseudo multi-function card, we need to unbind | 358 | * pseudo multi-function card, we need to unbind |
360 | * all devices | 359 | * all devices |
361 | */ | 360 | */ |
362 | if ((p_dev->socket->pcmcia_state.has_pfc) && | 361 | if ((p_dev->socket->pcmcia_pfc) && |
363 | (p_dev->socket->device_count > 0) && | 362 | (p_dev->socket->device_count > 0) && |
364 | (p_dev->device_no == 0)) | 363 | (p_dev->device_no == 0)) |
365 | pcmcia_card_remove(p_dev->socket, p_dev); | 364 | pcmcia_card_remove(p_dev->socket, p_dev); |
@@ -477,7 +476,8 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev) | |||
477 | } | 476 | } |
478 | 477 | ||
479 | 478 | ||
480 | struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int function) | 479 | static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, |
480 | unsigned int function) | ||
481 | { | 481 | { |
482 | struct pcmcia_device *p_dev, *tmp_dev; | 482 | struct pcmcia_device *p_dev, *tmp_dev; |
483 | int i; | 483 | int i; |
@@ -531,7 +531,6 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu | |||
531 | list_for_each_entry(tmp_dev, &s->devices_list, socket_device_list) | 531 | list_for_each_entry(tmp_dev, &s->devices_list, socket_device_list) |
532 | if (p_dev->func == tmp_dev->func) { | 532 | if (p_dev->func == tmp_dev->func) { |
533 | p_dev->function_config = tmp_dev->function_config; | 533 | p_dev->function_config = tmp_dev->function_config; |
534 | p_dev->io = tmp_dev->io; | ||
535 | p_dev->irq = tmp_dev->irq; | 534 | p_dev->irq = tmp_dev->irq; |
536 | kref_get(&p_dev->function_config->ref); | 535 | kref_get(&p_dev->function_config->ref); |
537 | } | 536 | } |
@@ -544,15 +543,29 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu | |||
544 | "IRQ setup failed -- device might not work\n"); | 543 | "IRQ setup failed -- device might not work\n"); |
545 | 544 | ||
546 | if (!p_dev->function_config) { | 545 | if (!p_dev->function_config) { |
546 | config_t *c; | ||
547 | dev_dbg(&p_dev->dev, "creating config_t\n"); | 547 | dev_dbg(&p_dev->dev, "creating config_t\n"); |
548 | p_dev->function_config = kzalloc(sizeof(struct config_t), | 548 | c = kzalloc(sizeof(struct config_t), GFP_KERNEL); |
549 | GFP_KERNEL); | 549 | if (!c) { |
550 | if (!p_dev->function_config) { | ||
551 | mutex_unlock(&s->ops_mutex); | 550 | mutex_unlock(&s->ops_mutex); |
552 | goto err_unreg; | 551 | goto err_unreg; |
553 | } | 552 | } |
554 | kref_init(&p_dev->function_config->ref); | 553 | p_dev->function_config = c; |
554 | kref_init(&c->ref); | ||
555 | for (i = 0; i < MAX_IO_WIN; i++) { | ||
556 | c->io[i].name = p_dev->devname; | ||
557 | c->io[i].flags = IORESOURCE_IO; | ||
558 | } | ||
559 | for (i = 0; i< MAX_WIN; i++) { | ||
560 | c->mem[i].name = p_dev->devname; | ||
561 | c->mem[i].flags = IORESOURCE_MEM; | ||
562 | } | ||
555 | } | 563 | } |
564 | for (i = 0; i < MAX_IO_WIN; i++) | ||
565 | p_dev->resource[i] = &p_dev->function_config->io[i]; | ||
566 | for (; i < (MAX_IO_WIN + MAX_WIN); i++) | ||
567 | p_dev->resource[i] = &p_dev->function_config->mem[i-MAX_IO_WIN]; | ||
568 | |||
556 | mutex_unlock(&s->ops_mutex); | 569 | mutex_unlock(&s->ops_mutex); |
557 | 570 | ||
558 | dev_printk(KERN_NOTICE, &p_dev->dev, | 571 | dev_printk(KERN_NOTICE, &p_dev->dev, |
@@ -680,7 +693,7 @@ static void pcmcia_requery(struct pcmcia_socket *s) | |||
680 | * call pcmcia_device_add() -- which will fail if both | 693 | * call pcmcia_device_add() -- which will fail if both |
681 | * devices are already registered. */ | 694 | * devices are already registered. */ |
682 | mutex_lock(&s->ops_mutex); | 695 | mutex_lock(&s->ops_mutex); |
683 | has_pfc = s->pcmcia_state.has_pfc; | 696 | has_pfc = s->pcmcia_pfc; |
684 | mutex_unlock(&s->ops_mutex); | 697 | mutex_unlock(&s->ops_mutex); |
685 | if (has_pfc) | 698 | if (has_pfc) |
686 | pcmcia_device_add(s, 0); | 699 | pcmcia_device_add(s, 0); |
@@ -812,7 +825,7 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev, | |||
812 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) { | 825 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) { |
813 | dev_dbg(&dev->dev, "this is a pseudo-multi-function device\n"); | 826 | dev_dbg(&dev->dev, "this is a pseudo-multi-function device\n"); |
814 | mutex_lock(&dev->socket->ops_mutex); | 827 | mutex_lock(&dev->socket->ops_mutex); |
815 | dev->socket->pcmcia_state.has_pfc = 1; | 828 | dev->socket->pcmcia_pfc = 1; |
816 | mutex_unlock(&dev->socket->ops_mutex); | 829 | mutex_unlock(&dev->socket->ops_mutex); |
817 | if (dev->device_no != did->device_no) | 830 | if (dev->device_no != did->device_no) |
818 | return 0; | 831 | return 0; |
@@ -826,7 +839,7 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev, | |||
826 | 839 | ||
827 | /* if this is a pseudo-multi-function device, | 840 | /* if this is a pseudo-multi-function device, |
828 | * we need explicit matches */ | 841 | * we need explicit matches */ |
829 | if (dev->socket->pcmcia_state.has_pfc) | 842 | if (dev->socket->pcmcia_pfc) |
830 | return 0; | 843 | return 0; |
831 | if (dev->device_no) | 844 | if (dev->device_no) |
832 | return 0; | 845 | return 0; |
@@ -885,14 +898,6 @@ static int pcmcia_bus_match(struct device *dev, struct device_driver *drv) | |||
885 | } | 898 | } |
886 | mutex_unlock(&p_drv->dynids.lock); | 899 | mutex_unlock(&p_drv->dynids.lock); |
887 | 900 | ||
888 | #ifdef CONFIG_PCMCIA_IOCTL | ||
889 | /* matching by cardmgr */ | ||
890 | if (p_dev->cardmgr == p_drv) { | ||
891 | dev_dbg(dev, "cardmgr matched to %s\n", drv->name); | ||
892 | return 1; | ||
893 | } | ||
894 | #endif | ||
895 | |||
896 | while (did && did->match_flags) { | 901 | while (did && did->match_flags) { |
897 | dev_dbg(dev, "trying to match to %s\n", drv->name); | 902 | dev_dbg(dev, "trying to match to %s\n", drv->name); |
898 | if (pcmcia_devmatch(p_dev, did)) { | 903 | if (pcmcia_devmatch(p_dev, did)) { |
@@ -1006,6 +1011,18 @@ pcmcia_device_stringattr(prod_id2, prod_id[1]); | |||
1006 | pcmcia_device_stringattr(prod_id3, prod_id[2]); | 1011 | pcmcia_device_stringattr(prod_id3, prod_id[2]); |
1007 | pcmcia_device_stringattr(prod_id4, prod_id[3]); | 1012 | pcmcia_device_stringattr(prod_id4, prod_id[3]); |
1008 | 1013 | ||
1014 | static ssize_t pcmcia_show_resources(struct device *dev, | ||
1015 | struct device_attribute *attr, char *buf) | ||
1016 | { | ||
1017 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | ||
1018 | char *str = buf; | ||
1019 | int i; | ||
1020 | |||
1021 | for (i = 0; i < PCMCIA_NUM_RESOURCES; i++) | ||
1022 | str += sprintf(str, "%pr\n", p_dev->resource[i]); | ||
1023 | |||
1024 | return str - buf; | ||
1025 | } | ||
1009 | 1026 | ||
1010 | static ssize_t pcmcia_show_pm_state(struct device *dev, struct device_attribute *attr, char *buf) | 1027 | static ssize_t pcmcia_show_pm_state(struct device *dev, struct device_attribute *attr, char *buf) |
1011 | { | 1028 | { |
@@ -1076,6 +1093,7 @@ static ssize_t pcmcia_store_allow_func_id_match(struct device *dev, | |||
1076 | static struct device_attribute pcmcia_dev_attrs[] = { | 1093 | static struct device_attribute pcmcia_dev_attrs[] = { |
1077 | __ATTR(function, 0444, func_show, NULL), | 1094 | __ATTR(function, 0444, func_show, NULL), |
1078 | __ATTR(pm_state, 0644, pcmcia_show_pm_state, pcmcia_store_pm_state), | 1095 | __ATTR(pm_state, 0644, pcmcia_show_pm_state, pcmcia_store_pm_state), |
1096 | __ATTR(resources, 0444, pcmcia_show_resources, NULL), | ||
1079 | __ATTR_RO(func_id), | 1097 | __ATTR_RO(func_id), |
1080 | __ATTR_RO(manf_id), | 1098 | __ATTR_RO(manf_id), |
1081 | __ATTR_RO(card_id), | 1099 | __ATTR_RO(card_id), |
@@ -1215,86 +1233,57 @@ static int pcmcia_bus_suspend(struct pcmcia_socket *skt) | |||
1215 | return 0; | 1233 | return 0; |
1216 | } | 1234 | } |
1217 | 1235 | ||
1236 | static int pcmcia_bus_remove(struct pcmcia_socket *skt) | ||
1237 | { | ||
1238 | atomic_set(&skt->present, 0); | ||
1239 | pcmcia_card_remove(skt, NULL); | ||
1218 | 1240 | ||
1219 | /*====================================================================== | 1241 | mutex_lock(&skt->ops_mutex); |
1242 | destroy_cis_cache(skt); | ||
1243 | pcmcia_cleanup_irq(skt); | ||
1244 | mutex_unlock(&skt->ops_mutex); | ||
1220 | 1245 | ||
1221 | The card status event handler. | 1246 | return 0; |
1247 | } | ||
1222 | 1248 | ||
1223 | ======================================================================*/ | 1249 | static int pcmcia_bus_add(struct pcmcia_socket *skt) |
1250 | { | ||
1251 | atomic_set(&skt->present, 1); | ||
1224 | 1252 | ||
1225 | /* Normally, the event is passed to individual drivers after | 1253 | mutex_lock(&skt->ops_mutex); |
1226 | * informing userspace. Only for CS_EVENT_CARD_REMOVAL this | 1254 | skt->pcmcia_pfc = 0; |
1227 | * is inversed to maintain historic compatibility. | 1255 | destroy_cis_cache(skt); /* to be on the safe side... */ |
1228 | */ | 1256 | mutex_unlock(&skt->ops_mutex); |
1229 | 1257 | ||
1230 | static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) | 1258 | pcmcia_card_add(skt); |
1231 | { | ||
1232 | struct pcmcia_socket *s = pcmcia_get_socket(skt); | ||
1233 | 1259 | ||
1234 | if (!s) { | 1260 | return 0; |
1235 | dev_printk(KERN_ERR, &skt->dev, | 1261 | } |
1236 | "PCMCIA obtaining reference to socket " \ | ||
1237 | "failed, event 0x%x lost!\n", event); | ||
1238 | return -ENODEV; | ||
1239 | } | ||
1240 | 1262 | ||
1241 | dev_dbg(&skt->dev, "ds_event(0x%06x, %d, 0x%p)\n", | 1263 | static int pcmcia_bus_early_resume(struct pcmcia_socket *skt) |
1242 | event, priority, skt); | 1264 | { |
1265 | if (!verify_cis_cache(skt)) { | ||
1266 | pcmcia_put_socket(skt); | ||
1267 | return 0; | ||
1268 | } | ||
1243 | 1269 | ||
1244 | switch (event) { | 1270 | dev_dbg(&skt->dev, "cis mismatch - different card\n"); |
1245 | case CS_EVENT_CARD_REMOVAL: | ||
1246 | atomic_set(&skt->present, 0); | ||
1247 | pcmcia_card_remove(skt, NULL); | ||
1248 | handle_event(skt, event); | ||
1249 | mutex_lock(&s->ops_mutex); | ||
1250 | destroy_cis_cache(s); | ||
1251 | pcmcia_cleanup_irq(s); | ||
1252 | mutex_unlock(&s->ops_mutex); | ||
1253 | break; | ||
1254 | 1271 | ||
1255 | case CS_EVENT_CARD_INSERTION: | 1272 | /* first, remove the card */ |
1256 | atomic_set(&skt->present, 1); | 1273 | pcmcia_bus_remove(skt); |
1257 | mutex_lock(&s->ops_mutex); | ||
1258 | s->pcmcia_state.has_pfc = 0; | ||
1259 | destroy_cis_cache(s); /* to be on the safe side... */ | ||
1260 | mutex_unlock(&s->ops_mutex); | ||
1261 | pcmcia_card_add(skt); | ||
1262 | handle_event(skt, event); | ||
1263 | break; | ||
1264 | |||
1265 | case CS_EVENT_EJECTION_REQUEST: | ||
1266 | break; | ||
1267 | |||
1268 | case CS_EVENT_PM_RESUME: | ||
1269 | if (verify_cis_cache(skt) != 0) { | ||
1270 | dev_dbg(&skt->dev, "cis mismatch - different card\n"); | ||
1271 | /* first, remove the card */ | ||
1272 | ds_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH); | ||
1273 | mutex_lock(&s->ops_mutex); | ||
1274 | destroy_cis_cache(skt); | ||
1275 | kfree(skt->fake_cis); | ||
1276 | skt->fake_cis = NULL; | ||
1277 | s->functions = 0; | ||
1278 | mutex_unlock(&s->ops_mutex); | ||
1279 | /* now, add the new card */ | ||
1280 | ds_event(skt, CS_EVENT_CARD_INSERTION, | ||
1281 | CS_EVENT_PRI_LOW); | ||
1282 | } | ||
1283 | handle_event(skt, event); | ||
1284 | break; | ||
1285 | 1274 | ||
1286 | case CS_EVENT_PM_SUSPEND: | 1275 | mutex_lock(&skt->ops_mutex); |
1287 | case CS_EVENT_RESET_PHYSICAL: | 1276 | destroy_cis_cache(skt); |
1288 | case CS_EVENT_CARD_RESET: | 1277 | kfree(skt->fake_cis); |
1289 | default: | 1278 | skt->fake_cis = NULL; |
1290 | handle_event(skt, event); | 1279 | skt->functions = 0; |
1291 | break; | 1280 | mutex_unlock(&skt->ops_mutex); |
1292 | } | ||
1293 | 1281 | ||
1294 | pcmcia_put_socket(s); | 1282 | /* now, add the new card */ |
1283 | pcmcia_bus_add(skt); | ||
1284 | return 0; | ||
1285 | } | ||
1295 | 1286 | ||
1296 | return 0; | ||
1297 | } /* ds_event */ | ||
1298 | 1287 | ||
1299 | /* | 1288 | /* |
1300 | * NOTE: This is racy. There's no guarantee the card will still be | 1289 | * NOTE: This is racy. There's no guarantee the card will still be |
@@ -1323,10 +1312,12 @@ EXPORT_SYMBOL(pcmcia_dev_present); | |||
1323 | 1312 | ||
1324 | static struct pcmcia_callback pcmcia_bus_callback = { | 1313 | static struct pcmcia_callback pcmcia_bus_callback = { |
1325 | .owner = THIS_MODULE, | 1314 | .owner = THIS_MODULE, |
1326 | .event = ds_event, | 1315 | .add = pcmcia_bus_add, |
1316 | .remove = pcmcia_bus_remove, | ||
1327 | .requery = pcmcia_requery, | 1317 | .requery = pcmcia_requery, |
1328 | .validate = pccard_validate_cis, | 1318 | .validate = pccard_validate_cis, |
1329 | .suspend = pcmcia_bus_suspend, | 1319 | .suspend = pcmcia_bus_suspend, |
1320 | .early_resume = pcmcia_bus_early_resume, | ||
1330 | .resume = pcmcia_bus_resume, | 1321 | .resume = pcmcia_bus_resume, |
1331 | }; | 1322 | }; |
1332 | 1323 | ||
@@ -1350,11 +1341,8 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev, | |||
1350 | return ret; | 1341 | return ret; |
1351 | } | 1342 | } |
1352 | 1343 | ||
1353 | #ifdef CONFIG_PCMCIA_IOCTL | ||
1354 | init_waitqueue_head(&socket->queue); | ||
1355 | #endif | ||
1356 | INIT_LIST_HEAD(&socket->devices_list); | 1344 | INIT_LIST_HEAD(&socket->devices_list); |
1357 | memset(&socket->pcmcia_state, 0, sizeof(u8)); | 1345 | socket->pcmcia_pfc = 0; |
1358 | socket->device_count = 0; | 1346 | socket->device_count = 0; |
1359 | atomic_set(&socket->present, 0); | 1347 | atomic_set(&socket->present, 0); |
1360 | 1348 | ||
@@ -1429,8 +1417,6 @@ static int __init init_pcmcia_bus(void) | |||
1429 | return ret; | 1417 | return ret; |
1430 | } | 1418 | } |
1431 | 1419 | ||
1432 | pcmcia_setup_ioctl(); | ||
1433 | |||
1434 | return 0; | 1420 | return 0; |
1435 | } | 1421 | } |
1436 | fs_initcall(init_pcmcia_bus); /* one level after subsys_initcall so that | 1422 | fs_initcall(init_pcmcia_bus); /* one level after subsys_initcall so that |
@@ -1439,8 +1425,6 @@ fs_initcall(init_pcmcia_bus); /* one level after subsys_initcall so that | |||
1439 | 1425 | ||
1440 | static void __exit exit_pcmcia_bus(void) | 1426 | static void __exit exit_pcmcia_bus(void) |
1441 | { | 1427 | { |
1442 | pcmcia_cleanup_ioctl(); | ||
1443 | |||
1444 | class_interface_unregister(&pcmcia_bus_interface); | 1428 | class_interface_unregister(&pcmcia_bus_interface); |
1445 | 1429 | ||
1446 | bus_unregister(&pcmcia_bus_type); | 1430 | bus_unregister(&pcmcia_bus_type); |
diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c index 3003bb3dfcc0..05d0879ce935 100644 --- a/drivers/pcmcia/i82092.c +++ b/drivers/pcmcia/i82092.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
17 | 17 | ||
18 | #include <pcmcia/cs_types.h> | ||
19 | #include <pcmcia/ss.h> | 18 | #include <pcmcia/ss.h> |
20 | #include <pcmcia/cs.h> | 19 | #include <pcmcia/cs.h> |
21 | 20 | ||
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index 9e2a15628de5..61746bd598b3 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c | |||
@@ -50,7 +50,6 @@ | |||
50 | #include <asm/io.h> | 50 | #include <asm/io.h> |
51 | #include <asm/system.h> | 51 | #include <asm/system.h> |
52 | 52 | ||
53 | #include <pcmcia/cs_types.h> | ||
54 | #include <pcmcia/ss.h> | 53 | #include <pcmcia/ss.h> |
55 | #include <pcmcia/cs.h> | 54 | #include <pcmcia/cs.h> |
56 | 55 | ||
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c index 7e16ed8eb0a4..24de49925863 100644 --- a/drivers/pcmcia/m32r_cfc.c +++ b/drivers/pcmcia/m32r_cfc.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <asm/io.h> | 26 | #include <asm/io.h> |
27 | #include <asm/system.h> | 27 | #include <asm/system.h> |
28 | 28 | ||
29 | #include <pcmcia/cs_types.h> | ||
30 | #include <pcmcia/ss.h> | 29 | #include <pcmcia/ss.h> |
31 | #include <pcmcia/cs.h> | 30 | #include <pcmcia/cs.h> |
32 | 31 | ||
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c index 6c5c3f910d71..8e4723844ad3 100644 --- a/drivers/pcmcia/m32r_pcc.c +++ b/drivers/pcmcia/m32r_pcc.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <asm/system.h> | 27 | #include <asm/system.h> |
28 | #include <asm/addrspace.h> | 28 | #include <asm/addrspace.h> |
29 | 29 | ||
30 | #include <pcmcia/cs_types.h> | ||
31 | #include <pcmcia/ss.h> | 30 | #include <pcmcia/ss.h> |
32 | #include <pcmcia/cs.h> | 31 | #include <pcmcia/cs.h> |
33 | 32 | ||
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index 25e5e30a18af..f2f90a7d3e12 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c | |||
@@ -59,7 +59,6 @@ | |||
59 | #include <asm/irq.h> | 59 | #include <asm/irq.h> |
60 | #include <asm/fs_pd.h> | 60 | #include <asm/fs_pd.h> |
61 | 61 | ||
62 | #include <pcmcia/cs_types.h> | ||
63 | #include <pcmcia/cs.h> | 62 | #include <pcmcia/cs.h> |
64 | #include <pcmcia/ss.h> | 63 | #include <pcmcia/ss.h> |
65 | 64 | ||
diff --git a/drivers/pcmcia/pcmcia_cis.c b/drivers/pcmcia/pcmcia_cis.c index 4a65eaf96b0a..0ac54da15885 100644 --- a/drivers/pcmcia/pcmcia_cis.c +++ b/drivers/pcmcia/pcmcia_cis.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/netdevice.h> | 20 | #include <linux/netdevice.h> |
21 | 21 | ||
22 | #include <pcmcia/cs_types.h> | ||
23 | #include <pcmcia/cisreg.h> | 22 | #include <pcmcia/cisreg.h> |
24 | #include <pcmcia/cistpl.h> | 23 | #include <pcmcia/cistpl.h> |
25 | #include <pcmcia/ss.h> | 24 | #include <pcmcia/ss.h> |
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c deleted file mode 100644 index d007a2a03830..000000000000 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ /dev/null | |||
@@ -1,1077 +0,0 @@ | |||
1 | /* | ||
2 | * pcmcia_ioctl.c -- ioctl interface for cardmgr and cardctl | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * The initial developer of the original code is David A. Hinds | ||
9 | * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds | ||
10 | * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. | ||
11 | * | ||
12 | * (C) 1999 David A. Hinds | ||
13 | * (C) 2003 - 2004 Dominik Brodowski | ||
14 | */ | ||
15 | |||
16 | /* | ||
17 | * This file will go away soon. | ||
18 | */ | ||
19 | |||
20 | |||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/major.h> | ||
25 | #include <linux/errno.h> | ||
26 | #include <linux/ioctl.h> | ||
27 | #include <linux/proc_fs.h> | ||
28 | #include <linux/poll.h> | ||
29 | #include <linux/pci.h> | ||
30 | #include <linux/slab.h> | ||
31 | #include <linux/seq_file.h> | ||
32 | #include <linux/smp_lock.h> | ||
33 | #include <linux/workqueue.h> | ||
34 | |||
35 | #include <pcmcia/cs_types.h> | ||
36 | #include <pcmcia/cs.h> | ||
37 | #include <pcmcia/cistpl.h> | ||
38 | #include <pcmcia/cisreg.h> | ||
39 | #include <pcmcia/ds.h> | ||
40 | #include <pcmcia/ss.h> | ||
41 | |||
42 | #include "cs_internal.h" | ||
43 | |||
44 | static int major_dev = -1; | ||
45 | |||
46 | |||
47 | /* Device user information */ | ||
48 | #define MAX_EVENTS 32 | ||
49 | #define USER_MAGIC 0x7ea4 | ||
50 | #define CHECK_USER(u) \ | ||
51 | (((u) == NULL) || ((u)->user_magic != USER_MAGIC)) | ||
52 | |||
53 | typedef struct user_info_t { | ||
54 | u_int user_magic; | ||
55 | int event_head, event_tail; | ||
56 | event_t event[MAX_EVENTS]; | ||
57 | struct user_info_t *next; | ||
58 | struct pcmcia_socket *socket; | ||
59 | } user_info_t; | ||
60 | |||
61 | |||
62 | static struct pcmcia_device *get_pcmcia_device(struct pcmcia_socket *s, | ||
63 | unsigned int function) | ||
64 | { | ||
65 | struct pcmcia_device *p_dev = NULL; | ||
66 | |||
67 | mutex_lock(&s->ops_mutex); | ||
68 | list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { | ||
69 | if (p_dev->func == function) { | ||
70 | mutex_unlock(&s->ops_mutex); | ||
71 | return pcmcia_get_dev(p_dev); | ||
72 | } | ||
73 | } | ||
74 | mutex_unlock(&s->ops_mutex); | ||
75 | return NULL; | ||
76 | } | ||
77 | |||
78 | /* backwards-compatible accessing of driver --- by name! */ | ||
79 | |||
80 | static struct pcmcia_driver *get_pcmcia_driver(dev_info_t *dev_info) | ||
81 | { | ||
82 | struct device_driver *drv; | ||
83 | struct pcmcia_driver *p_drv; | ||
84 | |||
85 | drv = driver_find((char *) dev_info, &pcmcia_bus_type); | ||
86 | if (!drv) | ||
87 | return NULL; | ||
88 | |||
89 | p_drv = container_of(drv, struct pcmcia_driver, drv); | ||
90 | |||
91 | return p_drv; | ||
92 | } | ||
93 | |||
94 | |||
95 | #ifdef CONFIG_PROC_FS | ||
96 | static struct proc_dir_entry *proc_pccard; | ||
97 | |||
98 | static int proc_read_drivers_callback(struct device_driver *driver, void *_m) | ||
99 | { | ||
100 | struct seq_file *m = _m; | ||
101 | struct pcmcia_driver *p_drv = container_of(driver, | ||
102 | struct pcmcia_driver, drv); | ||
103 | |||
104 | seq_printf(m, "%-24.24s 1 %d\n", p_drv->drv.name, | ||
105 | #ifdef CONFIG_MODULE_UNLOAD | ||
106 | (p_drv->owner) ? module_refcount(p_drv->owner) : 1 | ||
107 | #else | ||
108 | 1 | ||
109 | #endif | ||
110 | ); | ||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static int pccard_drivers_proc_show(struct seq_file *m, void *v) | ||
115 | { | ||
116 | return bus_for_each_drv(&pcmcia_bus_type, NULL, | ||
117 | m, proc_read_drivers_callback); | ||
118 | } | ||
119 | |||
120 | static int pccard_drivers_proc_open(struct inode *inode, struct file *file) | ||
121 | { | ||
122 | return single_open(file, pccard_drivers_proc_show, NULL); | ||
123 | } | ||
124 | |||
125 | static const struct file_operations pccard_drivers_proc_fops = { | ||
126 | .owner = THIS_MODULE, | ||
127 | .open = pccard_drivers_proc_open, | ||
128 | .read = seq_read, | ||
129 | .llseek = seq_lseek, | ||
130 | .release = single_release, | ||
131 | }; | ||
132 | #endif | ||
133 | |||
134 | |||
135 | #ifdef CONFIG_PCMCIA_PROBE | ||
136 | |||
137 | static int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) | ||
138 | { | ||
139 | int irq; | ||
140 | u32 mask; | ||
141 | |||
142 | irq = adj->resource.irq.IRQ; | ||
143 | if ((irq < 0) || (irq > 15)) | ||
144 | return -EINVAL; | ||
145 | |||
146 | if (adj->Action != REMOVE_MANAGED_RESOURCE) | ||
147 | return 0; | ||
148 | |||
149 | mask = 1 << irq; | ||
150 | |||
151 | if (!(s->irq_mask & mask)) | ||
152 | return 0; | ||
153 | |||
154 | s->irq_mask &= ~mask; | ||
155 | |||
156 | return 0; | ||
157 | } | ||
158 | |||
159 | #else | ||
160 | |||
161 | static inline int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) | ||
162 | { | ||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | #endif | ||
167 | |||
168 | static int pcmcia_adjust_resource_info(adjust_t *adj) | ||
169 | { | ||
170 | struct pcmcia_socket *s; | ||
171 | int ret = -ENOSYS; | ||
172 | |||
173 | down_read(&pcmcia_socket_list_rwsem); | ||
174 | list_for_each_entry(s, &pcmcia_socket_list, socket_list) { | ||
175 | |||
176 | if (adj->Resource == RES_IRQ) | ||
177 | ret = adjust_irq(s, adj); | ||
178 | |||
179 | else if (s->resource_ops->add_io) { | ||
180 | unsigned long begin, end; | ||
181 | |||
182 | /* you can't use the old interface if the new | ||
183 | * one was used before */ | ||
184 | mutex_lock(&s->ops_mutex); | ||
185 | if ((s->resource_setup_new) && | ||
186 | !(s->resource_setup_old)) { | ||
187 | mutex_unlock(&s->ops_mutex); | ||
188 | continue; | ||
189 | } else if (!(s->resource_setup_old)) | ||
190 | s->resource_setup_old = 1; | ||
191 | |||
192 | switch (adj->Resource) { | ||
193 | case RES_MEMORY_RANGE: | ||
194 | begin = adj->resource.memory.Base; | ||
195 | end = adj->resource.memory.Base + adj->resource.memory.Size - 1; | ||
196 | if (s->resource_ops->add_mem) | ||
197 | ret = s->resource_ops->add_mem(s, adj->Action, begin, end); | ||
198 | case RES_IO_RANGE: | ||
199 | begin = adj->resource.io.BasePort; | ||
200 | end = adj->resource.io.BasePort + adj->resource.io.NumPorts - 1; | ||
201 | if (s->resource_ops->add_io) | ||
202 | ret = s->resource_ops->add_io(s, adj->Action, begin, end); | ||
203 | } | ||
204 | if (!ret) { | ||
205 | /* as there's no way we know this is the | ||
206 | * last call to adjust_resource_info, we | ||
207 | * always need to assume this is the latest | ||
208 | * one... */ | ||
209 | s->resource_setup_done = 1; | ||
210 | } | ||
211 | mutex_unlock(&s->ops_mutex); | ||
212 | } | ||
213 | } | ||
214 | up_read(&pcmcia_socket_list_rwsem); | ||
215 | |||
216 | return ret; | ||
217 | } | ||
218 | |||
219 | |||
220 | /** pcmcia_get_window | ||
221 | */ | ||
222 | static int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *wh_out, | ||
223 | window_handle_t wh, win_req_t *req) | ||
224 | { | ||
225 | pccard_mem_map *win; | ||
226 | window_handle_t w; | ||
227 | |||
228 | wh--; | ||
229 | if (!s || !(s->state & SOCKET_PRESENT)) | ||
230 | return -ENODEV; | ||
231 | if (wh >= MAX_WIN) | ||
232 | return -EINVAL; | ||
233 | for (w = wh; w < MAX_WIN; w++) | ||
234 | if (s->state & SOCKET_WIN_REQ(w)) | ||
235 | break; | ||
236 | if (w == MAX_WIN) | ||
237 | return -EINVAL; | ||
238 | win = &s->win[w]; | ||
239 | req->Base = win->res->start; | ||
240 | req->Size = win->res->end - win->res->start + 1; | ||
241 | req->AccessSpeed = win->speed; | ||
242 | req->Attributes = 0; | ||
243 | if (win->flags & MAP_ATTRIB) | ||
244 | req->Attributes |= WIN_MEMORY_TYPE_AM; | ||
245 | if (win->flags & MAP_ACTIVE) | ||
246 | req->Attributes |= WIN_ENABLE; | ||
247 | if (win->flags & MAP_16BIT) | ||
248 | req->Attributes |= WIN_DATA_WIDTH_16; | ||
249 | if (win->flags & MAP_USE_WAIT) | ||
250 | req->Attributes |= WIN_USE_WAIT; | ||
251 | |||
252 | *wh_out = w + 1; | ||
253 | return 0; | ||
254 | } /* pcmcia_get_window */ | ||
255 | |||
256 | |||
257 | /** pcmcia_get_mem_page | ||
258 | * | ||
259 | * Change the card address of an already open memory window. | ||
260 | */ | ||
261 | static int pcmcia_get_mem_page(struct pcmcia_socket *skt, window_handle_t wh, | ||
262 | memreq_t *req) | ||
263 | { | ||
264 | wh--; | ||
265 | if (wh >= MAX_WIN) | ||
266 | return -EINVAL; | ||
267 | |||
268 | req->Page = 0; | ||
269 | req->CardOffset = skt->win[wh].card_start; | ||
270 | return 0; | ||
271 | } /* pcmcia_get_mem_page */ | ||
272 | |||
273 | |||
274 | /** pccard_get_status | ||
275 | * | ||
276 | * Get the current socket state bits. We don't support the latched | ||
277 | * SocketState yet: I haven't seen any point for it. | ||
278 | */ | ||
279 | |||
280 | static int pccard_get_status(struct pcmcia_socket *s, | ||
281 | struct pcmcia_device *p_dev, | ||
282 | cs_status_t *status) | ||
283 | { | ||
284 | config_t *c; | ||
285 | int val; | ||
286 | |||
287 | s->ops->get_status(s, &val); | ||
288 | status->CardState = status->SocketState = 0; | ||
289 | status->CardState |= (val & SS_DETECT) ? CS_EVENT_CARD_DETECT : 0; | ||
290 | status->CardState |= (val & SS_CARDBUS) ? CS_EVENT_CB_DETECT : 0; | ||
291 | status->CardState |= (val & SS_3VCARD) ? CS_EVENT_3VCARD : 0; | ||
292 | status->CardState |= (val & SS_XVCARD) ? CS_EVENT_XVCARD : 0; | ||
293 | if (s->state & SOCKET_SUSPEND) | ||
294 | status->CardState |= CS_EVENT_PM_SUSPEND; | ||
295 | if (!(s->state & SOCKET_PRESENT)) | ||
296 | return -ENODEV; | ||
297 | |||
298 | c = (p_dev) ? p_dev->function_config : NULL; | ||
299 | |||
300 | if ((c != NULL) && (c->state & CONFIG_LOCKED) && | ||
301 | (c->IntType & (INT_MEMORY_AND_IO | INT_ZOOMED_VIDEO))) { | ||
302 | u_char reg; | ||
303 | if (c->CardValues & PRESENT_PIN_REPLACE) { | ||
304 | mutex_lock(&s->ops_mutex); | ||
305 | pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_PRR)>>1, 1, ®); | ||
306 | mutex_unlock(&s->ops_mutex); | ||
307 | status->CardState |= | ||
308 | (reg & PRR_WP_STATUS) ? CS_EVENT_WRITE_PROTECT : 0; | ||
309 | status->CardState |= | ||
310 | (reg & PRR_READY_STATUS) ? CS_EVENT_READY_CHANGE : 0; | ||
311 | status->CardState |= | ||
312 | (reg & PRR_BVD2_STATUS) ? CS_EVENT_BATTERY_LOW : 0; | ||
313 | status->CardState |= | ||
314 | (reg & PRR_BVD1_STATUS) ? CS_EVENT_BATTERY_DEAD : 0; | ||
315 | } else { | ||
316 | /* No PRR? Then assume we're always ready */ | ||
317 | status->CardState |= CS_EVENT_READY_CHANGE; | ||
318 | } | ||
319 | if (c->CardValues & PRESENT_EXT_STATUS) { | ||
320 | mutex_lock(&s->ops_mutex); | ||
321 | pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_ESR)>>1, 1, ®); | ||
322 | mutex_unlock(&s->ops_mutex); | ||
323 | status->CardState |= | ||
324 | (reg & ESR_REQ_ATTN) ? CS_EVENT_REQUEST_ATTENTION : 0; | ||
325 | } | ||
326 | return 0; | ||
327 | } | ||
328 | status->CardState |= | ||
329 | (val & SS_WRPROT) ? CS_EVENT_WRITE_PROTECT : 0; | ||
330 | status->CardState |= | ||
331 | (val & SS_BATDEAD) ? CS_EVENT_BATTERY_DEAD : 0; | ||
332 | status->CardState |= | ||
333 | (val & SS_BATWARN) ? CS_EVENT_BATTERY_LOW : 0; | ||
334 | status->CardState |= | ||
335 | (val & SS_READY) ? CS_EVENT_READY_CHANGE : 0; | ||
336 | return 0; | ||
337 | } /* pccard_get_status */ | ||
338 | |||
339 | static int pccard_get_configuration_info(struct pcmcia_socket *s, | ||
340 | struct pcmcia_device *p_dev, | ||
341 | config_info_t *config) | ||
342 | { | ||
343 | config_t *c; | ||
344 | |||
345 | if (!(s->state & SOCKET_PRESENT)) | ||
346 | return -ENODEV; | ||
347 | |||
348 | |||
349 | #ifdef CONFIG_CARDBUS | ||
350 | if (s->state & SOCKET_CARDBUS) { | ||
351 | memset(config, 0, sizeof(config_info_t)); | ||
352 | config->Vcc = s->socket.Vcc; | ||
353 | config->Vpp1 = config->Vpp2 = s->socket.Vpp; | ||
354 | config->Option = s->cb_dev->subordinate->number; | ||
355 | if (s->state & SOCKET_CARDBUS_CONFIG) { | ||
356 | config->Attributes = CONF_VALID_CLIENT; | ||
357 | config->IntType = INT_CARDBUS; | ||
358 | config->AssignedIRQ = s->pcmcia_irq; | ||
359 | if (config->AssignedIRQ) | ||
360 | config->Attributes |= CONF_ENABLE_IRQ; | ||
361 | if (s->io[0].res) { | ||
362 | config->BasePort1 = s->io[0].res->start; | ||
363 | config->NumPorts1 = s->io[0].res->end - | ||
364 | config->BasePort1 + 1; | ||
365 | } | ||
366 | } | ||
367 | return 0; | ||
368 | } | ||
369 | #endif | ||
370 | |||
371 | if (p_dev) { | ||
372 | c = p_dev->function_config; | ||
373 | config->Function = p_dev->func; | ||
374 | } else { | ||
375 | c = NULL; | ||
376 | config->Function = 0; | ||
377 | } | ||
378 | |||
379 | if ((c == NULL) || !(c->state & CONFIG_LOCKED)) { | ||
380 | config->Attributes = 0; | ||
381 | config->Vcc = s->socket.Vcc; | ||
382 | config->Vpp1 = config->Vpp2 = s->socket.Vpp; | ||
383 | return 0; | ||
384 | } | ||
385 | |||
386 | config->Attributes = c->Attributes | CONF_VALID_CLIENT; | ||
387 | config->Vcc = s->socket.Vcc; | ||
388 | config->Vpp1 = config->Vpp2 = s->socket.Vpp; | ||
389 | config->IntType = c->IntType; | ||
390 | config->ConfigBase = c->ConfigBase; | ||
391 | config->Status = c->Status; | ||
392 | config->Pin = c->Pin; | ||
393 | config->Copy = c->Copy; | ||
394 | config->Option = c->Option; | ||
395 | config->ExtStatus = c->ExtStatus; | ||
396 | config->Present = config->CardValues = c->CardValues; | ||
397 | config->IRQAttributes = c->irq.Attributes; | ||
398 | config->AssignedIRQ = s->pcmcia_irq; | ||
399 | config->BasePort1 = c->io.BasePort1; | ||
400 | config->NumPorts1 = c->io.NumPorts1; | ||
401 | config->Attributes1 = c->io.Attributes1; | ||
402 | config->BasePort2 = c->io.BasePort2; | ||
403 | config->NumPorts2 = c->io.NumPorts2; | ||
404 | config->Attributes2 = c->io.Attributes2; | ||
405 | config->IOAddrLines = c->io.IOAddrLines; | ||
406 | |||
407 | return 0; | ||
408 | } /* pccard_get_configuration_info */ | ||
409 | |||
410 | |||
411 | /*====================================================================== | ||
412 | |||
413 | These manage a ring buffer of events pending for one user process | ||
414 | |||
415 | ======================================================================*/ | ||
416 | |||
417 | |||
418 | static int queue_empty(user_info_t *user) | ||
419 | { | ||
420 | return (user->event_head == user->event_tail); | ||
421 | } | ||
422 | |||
423 | static event_t get_queued_event(user_info_t *user) | ||
424 | { | ||
425 | user->event_tail = (user->event_tail+1) % MAX_EVENTS; | ||
426 | return user->event[user->event_tail]; | ||
427 | } | ||
428 | |||
429 | static void queue_event(user_info_t *user, event_t event) | ||
430 | { | ||
431 | user->event_head = (user->event_head+1) % MAX_EVENTS; | ||
432 | if (user->event_head == user->event_tail) | ||
433 | user->event_tail = (user->event_tail+1) % MAX_EVENTS; | ||
434 | user->event[user->event_head] = event; | ||
435 | } | ||
436 | |||
437 | void handle_event(struct pcmcia_socket *s, event_t event) | ||
438 | { | ||
439 | user_info_t *user; | ||
440 | for (user = s->user; user; user = user->next) | ||
441 | queue_event(user, event); | ||
442 | wake_up_interruptible(&s->queue); | ||
443 | } | ||
444 | |||
445 | |||
446 | /*====================================================================== | ||
447 | |||
448 | bind_request() and bind_device() are merged by now. Register_client() | ||
449 | is called right at the end of bind_request(), during the driver's | ||
450 | ->attach() call. Individual descriptions: | ||
451 | |||
452 | bind_request() connects a socket to a particular client driver. | ||
453 | It looks up the specified device ID in the list of registered | ||
454 | drivers, binds it to the socket, and tries to create an instance | ||
455 | of the device. unbind_request() deletes a driver instance. | ||
456 | |||
457 | Bind_device() associates a device driver with a particular socket. | ||
458 | It is normally called by Driver Services after it has identified | ||
459 | a newly inserted card. An instance of that driver will then be | ||
460 | eligible to register as a client of this socket. | ||
461 | |||
462 | Register_client() uses the dev_info_t handle to match the | ||
463 | caller with a socket. The driver must have already been bound | ||
464 | to a socket with bind_device() -- in fact, bind_device() | ||
465 | allocates the client structure that will be used. | ||
466 | |||
467 | ======================================================================*/ | ||
468 | |||
469 | static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info) | ||
470 | { | ||
471 | struct pcmcia_driver *p_drv; | ||
472 | struct pcmcia_device *p_dev; | ||
473 | int ret = 0; | ||
474 | |||
475 | s = pcmcia_get_socket(s); | ||
476 | if (!s) | ||
477 | return -EINVAL; | ||
478 | |||
479 | pr_debug("bind_request(%d, '%s')\n", s->sock, | ||
480 | (char *)bind_info->dev_info); | ||
481 | |||
482 | p_drv = get_pcmcia_driver(&bind_info->dev_info); | ||
483 | if (!p_drv) { | ||
484 | ret = -EINVAL; | ||
485 | goto err_put; | ||
486 | } | ||
487 | |||
488 | if (!try_module_get(p_drv->owner)) { | ||
489 | ret = -EINVAL; | ||
490 | goto err_put_driver; | ||
491 | } | ||
492 | |||
493 | mutex_lock(&s->ops_mutex); | ||
494 | list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { | ||
495 | if (p_dev->func == bind_info->function) { | ||
496 | if ((p_dev->dev.driver == &p_drv->drv)) { | ||
497 | if (p_dev->cardmgr) { | ||
498 | /* if there's already a device | ||
499 | * registered, and it was registered | ||
500 | * by userspace before, we need to | ||
501 | * return the "instance". */ | ||
502 | mutex_unlock(&s->ops_mutex); | ||
503 | bind_info->instance = p_dev; | ||
504 | ret = -EBUSY; | ||
505 | goto err_put_module; | ||
506 | } else { | ||
507 | /* the correct driver managed to bind | ||
508 | * itself magically to the correct | ||
509 | * device. */ | ||
510 | mutex_unlock(&s->ops_mutex); | ||
511 | p_dev->cardmgr = p_drv; | ||
512 | ret = 0; | ||
513 | goto err_put_module; | ||
514 | } | ||
515 | } else if (!p_dev->dev.driver) { | ||
516 | /* there's already a device available where | ||
517 | * no device has been bound to yet. So we don't | ||
518 | * need to register a device! */ | ||
519 | mutex_unlock(&s->ops_mutex); | ||
520 | goto rescan; | ||
521 | } | ||
522 | } | ||
523 | } | ||
524 | mutex_unlock(&s->ops_mutex); | ||
525 | |||
526 | p_dev = pcmcia_device_add(s, bind_info->function); | ||
527 | if (!p_dev) { | ||
528 | ret = -EIO; | ||
529 | goto err_put_module; | ||
530 | } | ||
531 | |||
532 | rescan: | ||
533 | p_dev->cardmgr = p_drv; | ||
534 | |||
535 | /* if a driver is already running, we can abort */ | ||
536 | if (p_dev->dev.driver) | ||
537 | goto err_put_module; | ||
538 | |||
539 | /* | ||
540 | * Prevent this racing with a card insertion. | ||
541 | */ | ||
542 | mutex_lock(&s->skt_mutex); | ||
543 | ret = bus_rescan_devices(&pcmcia_bus_type); | ||
544 | mutex_unlock(&s->skt_mutex); | ||
545 | if (ret) | ||
546 | goto err_put_module; | ||
547 | |||
548 | /* check whether the driver indeed matched. I don't care if this | ||
549 | * is racy or not, because it can only happen on cardmgr access | ||
550 | * paths... | ||
551 | */ | ||
552 | if (!(p_dev->dev.driver == &p_drv->drv)) | ||
553 | p_dev->cardmgr = NULL; | ||
554 | |||
555 | err_put_module: | ||
556 | module_put(p_drv->owner); | ||
557 | err_put_driver: | ||
558 | put_driver(&p_drv->drv); | ||
559 | err_put: | ||
560 | pcmcia_put_socket(s); | ||
561 | |||
562 | return ret; | ||
563 | } /* bind_request */ | ||
564 | |||
565 | #ifdef CONFIG_CARDBUS | ||
566 | |||
567 | static struct pci_bus *pcmcia_lookup_bus(struct pcmcia_socket *s) | ||
568 | { | ||
569 | if (!s || !(s->state & SOCKET_CARDBUS)) | ||
570 | return NULL; | ||
571 | |||
572 | return s->cb_dev->subordinate; | ||
573 | } | ||
574 | #endif | ||
575 | |||
576 | static int get_device_info(struct pcmcia_socket *s, bind_info_t *bind_info, int first) | ||
577 | { | ||
578 | struct pcmcia_device *p_dev; | ||
579 | struct pcmcia_driver *p_drv; | ||
580 | int ret = 0; | ||
581 | |||
582 | #ifdef CONFIG_CARDBUS | ||
583 | /* | ||
584 | * Some unbelievably ugly code to associate the PCI cardbus | ||
585 | * device and its driver with the PCMCIA "bind" information. | ||
586 | */ | ||
587 | { | ||
588 | struct pci_bus *bus; | ||
589 | |||
590 | bus = pcmcia_lookup_bus(s); | ||
591 | if (bus) { | ||
592 | struct list_head *list; | ||
593 | struct pci_dev *dev = NULL; | ||
594 | |||
595 | list = bus->devices.next; | ||
596 | while (list != &bus->devices) { | ||
597 | struct pci_dev *pdev = pci_dev_b(list); | ||
598 | list = list->next; | ||
599 | |||
600 | if (first) { | ||
601 | dev = pdev; | ||
602 | break; | ||
603 | } | ||
604 | |||
605 | /* Try to handle "next" here some way? */ | ||
606 | } | ||
607 | if (dev && dev->driver) { | ||
608 | strlcpy(bind_info->name, dev->driver->name, DEV_NAME_LEN); | ||
609 | bind_info->major = 0; | ||
610 | bind_info->minor = 0; | ||
611 | bind_info->next = NULL; | ||
612 | return 0; | ||
613 | } | ||
614 | } | ||
615 | } | ||
616 | #endif | ||
617 | |||
618 | mutex_lock(&s->ops_mutex); | ||
619 | list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { | ||
620 | if (p_dev->func == bind_info->function) { | ||
621 | p_dev = pcmcia_get_dev(p_dev); | ||
622 | if (!p_dev) | ||
623 | continue; | ||
624 | goto found; | ||
625 | } | ||
626 | } | ||
627 | mutex_unlock(&s->ops_mutex); | ||
628 | return -ENODEV; | ||
629 | |||
630 | found: | ||
631 | mutex_unlock(&s->ops_mutex); | ||
632 | |||
633 | p_drv = to_pcmcia_drv(p_dev->dev.driver); | ||
634 | if (p_drv && !p_dev->_locked) { | ||
635 | ret = -EAGAIN; | ||
636 | goto err_put; | ||
637 | } | ||
638 | |||
639 | if (!first) { | ||
640 | ret = -ENODEV; | ||
641 | goto err_put; | ||
642 | } | ||
643 | |||
644 | strlcpy(bind_info->name, dev_name(&p_dev->dev), DEV_NAME_LEN); | ||
645 | bind_info->next = NULL; | ||
646 | |||
647 | err_put: | ||
648 | pcmcia_put_dev(p_dev); | ||
649 | return ret; | ||
650 | } /* get_device_info */ | ||
651 | |||
652 | |||
653 | static int ds_open(struct inode *inode, struct file *file) | ||
654 | { | ||
655 | socket_t i = iminor(inode); | ||
656 | struct pcmcia_socket *s; | ||
657 | user_info_t *user; | ||
658 | static int warning_printed; | ||
659 | int ret = 0; | ||
660 | |||
661 | pr_debug("ds_open(socket %d)\n", i); | ||
662 | |||
663 | lock_kernel(); | ||
664 | s = pcmcia_get_socket_by_nr(i); | ||
665 | if (!s) { | ||
666 | ret = -ENODEV; | ||
667 | goto out; | ||
668 | } | ||
669 | s = pcmcia_get_socket(s); | ||
670 | if (!s) { | ||
671 | ret = -ENODEV; | ||
672 | goto out; | ||
673 | } | ||
674 | |||
675 | if ((file->f_flags & O_ACCMODE) != O_RDONLY) { | ||
676 | if (s->pcmcia_state.busy) { | ||
677 | pcmcia_put_socket(s); | ||
678 | ret = -EBUSY; | ||
679 | goto out; | ||
680 | } | ||
681 | else | ||
682 | s->pcmcia_state.busy = 1; | ||
683 | } | ||
684 | |||
685 | user = kmalloc(sizeof(user_info_t), GFP_KERNEL); | ||
686 | if (!user) { | ||
687 | pcmcia_put_socket(s); | ||
688 | ret = -ENOMEM; | ||
689 | goto out; | ||
690 | } | ||
691 | user->event_tail = user->event_head = 0; | ||
692 | user->next = s->user; | ||
693 | user->user_magic = USER_MAGIC; | ||
694 | user->socket = s; | ||
695 | s->user = user; | ||
696 | file->private_data = user; | ||
697 | |||
698 | if (!warning_printed) { | ||
699 | printk(KERN_INFO "pcmcia: Detected deprecated PCMCIA ioctl " | ||
700 | "usage from process: %s.\n", current->comm); | ||
701 | printk(KERN_INFO "pcmcia: This interface will soon be removed from " | ||
702 | "the kernel; please expect breakage unless you upgrade " | ||
703 | "to new tools.\n"); | ||
704 | printk(KERN_INFO "pcmcia: see http://www.kernel.org/pub/linux/" | ||
705 | "utils/kernel/pcmcia/pcmcia.html for details.\n"); | ||
706 | warning_printed = 1; | ||
707 | } | ||
708 | |||
709 | if (atomic_read(&s->present)) | ||
710 | queue_event(user, CS_EVENT_CARD_INSERTION); | ||
711 | out: | ||
712 | unlock_kernel(); | ||
713 | return ret; | ||
714 | } /* ds_open */ | ||
715 | |||
716 | /*====================================================================*/ | ||
717 | |||
718 | static int ds_release(struct inode *inode, struct file *file) | ||
719 | { | ||
720 | struct pcmcia_socket *s; | ||
721 | user_info_t *user, **link; | ||
722 | |||
723 | pr_debug("ds_release(socket %d)\n", iminor(inode)); | ||
724 | |||
725 | user = file->private_data; | ||
726 | if (CHECK_USER(user)) | ||
727 | goto out; | ||
728 | |||
729 | s = user->socket; | ||
730 | |||
731 | /* Unlink user data structure */ | ||
732 | if ((file->f_flags & O_ACCMODE) != O_RDONLY) | ||
733 | s->pcmcia_state.busy = 0; | ||
734 | |||
735 | file->private_data = NULL; | ||
736 | for (link = &s->user; *link; link = &(*link)->next) | ||
737 | if (*link == user) | ||
738 | break; | ||
739 | if (link == NULL) | ||
740 | goto out; | ||
741 | *link = user->next; | ||
742 | user->user_magic = 0; | ||
743 | kfree(user); | ||
744 | pcmcia_put_socket(s); | ||
745 | out: | ||
746 | return 0; | ||
747 | } /* ds_release */ | ||
748 | |||
749 | /*====================================================================*/ | ||
750 | |||
751 | static ssize_t ds_read(struct file *file, char __user *buf, | ||
752 | size_t count, loff_t *ppos) | ||
753 | { | ||
754 | struct pcmcia_socket *s; | ||
755 | user_info_t *user; | ||
756 | int ret; | ||
757 | |||
758 | pr_debug("ds_read(socket %d)\n", iminor(file->f_path.dentry->d_inode)); | ||
759 | |||
760 | if (count < 4) | ||
761 | return -EINVAL; | ||
762 | |||
763 | user = file->private_data; | ||
764 | if (CHECK_USER(user)) | ||
765 | return -EIO; | ||
766 | |||
767 | s = user->socket; | ||
768 | ret = wait_event_interruptible(s->queue, !queue_empty(user)); | ||
769 | if (ret == 0) | ||
770 | ret = put_user(get_queued_event(user), (int __user *)buf) ? -EFAULT : 4; | ||
771 | |||
772 | return ret; | ||
773 | } /* ds_read */ | ||
774 | |||
775 | /*====================================================================*/ | ||
776 | |||
777 | static ssize_t ds_write(struct file *file, const char __user *buf, | ||
778 | size_t count, loff_t *ppos) | ||
779 | { | ||
780 | pr_debug("ds_write(socket %d)\n", iminor(file->f_path.dentry->d_inode)); | ||
781 | |||
782 | if (count != 4) | ||
783 | return -EINVAL; | ||
784 | if ((file->f_flags & O_ACCMODE) == O_RDONLY) | ||
785 | return -EBADF; | ||
786 | |||
787 | return -EIO; | ||
788 | } /* ds_write */ | ||
789 | |||
790 | /*====================================================================*/ | ||
791 | |||
792 | /* No kernel lock - fine */ | ||
793 | static u_int ds_poll(struct file *file, poll_table *wait) | ||
794 | { | ||
795 | struct pcmcia_socket *s; | ||
796 | user_info_t *user; | ||
797 | |||
798 | pr_debug("ds_poll(socket %d)\n", iminor(file->f_path.dentry->d_inode)); | ||
799 | |||
800 | user = file->private_data; | ||
801 | if (CHECK_USER(user)) | ||
802 | return POLLERR; | ||
803 | s = user->socket; | ||
804 | /* | ||
805 | * We don't check for a dead socket here since that | ||
806 | * will send cardmgr into an endless spin. | ||
807 | */ | ||
808 | poll_wait(file, &s->queue, wait); | ||
809 | if (!queue_empty(user)) | ||
810 | return POLLIN | POLLRDNORM; | ||
811 | return 0; | ||
812 | } /* ds_poll */ | ||
813 | |||
814 | /*====================================================================*/ | ||
815 | |||
816 | static int ds_ioctl(struct file *file, u_int cmd, u_long arg) | ||
817 | { | ||
818 | struct pcmcia_socket *s; | ||
819 | void __user *uarg = (char __user *)arg; | ||
820 | u_int size; | ||
821 | int ret, err; | ||
822 | ds_ioctl_arg_t *buf; | ||
823 | user_info_t *user; | ||
824 | |||
825 | pr_debug("ds_ioctl(socket %d, %#x, %#lx)\n", iminor(inode), cmd, arg); | ||
826 | |||
827 | user = file->private_data; | ||
828 | if (CHECK_USER(user)) | ||
829 | return -EIO; | ||
830 | |||
831 | s = user->socket; | ||
832 | |||
833 | size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT; | ||
834 | if (size > sizeof(ds_ioctl_arg_t)) | ||
835 | return -EINVAL; | ||
836 | |||
837 | /* Permission check */ | ||
838 | if (!(cmd & IOC_OUT) && !capable(CAP_SYS_ADMIN)) | ||
839 | return -EPERM; | ||
840 | |||
841 | if (cmd & IOC_IN) { | ||
842 | if (!access_ok(VERIFY_READ, uarg, size)) { | ||
843 | pr_debug("ds_ioctl(): verify_read = %d\n", -EFAULT); | ||
844 | return -EFAULT; | ||
845 | } | ||
846 | } | ||
847 | if (cmd & IOC_OUT) { | ||
848 | if (!access_ok(VERIFY_WRITE, uarg, size)) { | ||
849 | pr_debug("ds_ioctl(): verify_write = %d\n", -EFAULT); | ||
850 | return -EFAULT; | ||
851 | } | ||
852 | } | ||
853 | buf = kmalloc(sizeof(ds_ioctl_arg_t), GFP_KERNEL); | ||
854 | if (!buf) | ||
855 | return -ENOMEM; | ||
856 | |||
857 | err = ret = 0; | ||
858 | |||
859 | if (cmd & IOC_IN) { | ||
860 | if (__copy_from_user((char *)buf, uarg, size)) { | ||
861 | err = -EFAULT; | ||
862 | goto free_out; | ||
863 | } | ||
864 | } | ||
865 | |||
866 | switch (cmd) { | ||
867 | case DS_ADJUST_RESOURCE_INFO: | ||
868 | ret = pcmcia_adjust_resource_info(&buf->adjust); | ||
869 | break; | ||
870 | case DS_GET_CONFIGURATION_INFO: | ||
871 | if (buf->config.Function && | ||
872 | (buf->config.Function >= s->functions)) | ||
873 | ret = -EINVAL; | ||
874 | else { | ||
875 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function); | ||
876 | ret = pccard_get_configuration_info(s, p_dev, &buf->config); | ||
877 | pcmcia_put_dev(p_dev); | ||
878 | } | ||
879 | break; | ||
880 | case DS_GET_FIRST_TUPLE: | ||
881 | mutex_lock(&s->skt_mutex); | ||
882 | pcmcia_validate_mem(s); | ||
883 | mutex_unlock(&s->skt_mutex); | ||
884 | ret = pccard_get_first_tuple(s, BIND_FN_ALL, &buf->tuple); | ||
885 | break; | ||
886 | case DS_GET_NEXT_TUPLE: | ||
887 | ret = pccard_get_next_tuple(s, BIND_FN_ALL, &buf->tuple); | ||
888 | break; | ||
889 | case DS_GET_TUPLE_DATA: | ||
890 | buf->tuple.TupleData = buf->tuple_parse.data; | ||
891 | buf->tuple.TupleDataMax = sizeof(buf->tuple_parse.data); | ||
892 | ret = pccard_get_tuple_data(s, &buf->tuple); | ||
893 | break; | ||
894 | case DS_PARSE_TUPLE: | ||
895 | buf->tuple.TupleData = buf->tuple_parse.data; | ||
896 | ret = pcmcia_parse_tuple(&buf->tuple, &buf->tuple_parse.parse); | ||
897 | break; | ||
898 | case DS_RESET_CARD: | ||
899 | ret = pcmcia_reset_card(s); | ||
900 | break; | ||
901 | case DS_GET_STATUS: | ||
902 | if (buf->status.Function && | ||
903 | (buf->status.Function >= s->functions)) | ||
904 | ret = -EINVAL; | ||
905 | else { | ||
906 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function); | ||
907 | ret = pccard_get_status(s, p_dev, &buf->status); | ||
908 | pcmcia_put_dev(p_dev); | ||
909 | } | ||
910 | break; | ||
911 | case DS_VALIDATE_CIS: | ||
912 | mutex_lock(&s->skt_mutex); | ||
913 | pcmcia_validate_mem(s); | ||
914 | mutex_unlock(&s->skt_mutex); | ||
915 | ret = pccard_validate_cis(s, &buf->cisinfo.Chains); | ||
916 | break; | ||
917 | case DS_SUSPEND_CARD: | ||
918 | pcmcia_parse_uevents(s, PCMCIA_UEVENT_SUSPEND); | ||
919 | break; | ||
920 | case DS_RESUME_CARD: | ||
921 | pcmcia_parse_uevents(s, PCMCIA_UEVENT_RESUME); | ||
922 | break; | ||
923 | case DS_EJECT_CARD: | ||
924 | pcmcia_parse_uevents(s, PCMCIA_UEVENT_EJECT); | ||
925 | break; | ||
926 | case DS_INSERT_CARD: | ||
927 | pcmcia_parse_uevents(s, PCMCIA_UEVENT_INSERT); | ||
928 | break; | ||
929 | case DS_ACCESS_CONFIGURATION_REGISTER: | ||
930 | if ((buf->conf_reg.Action == CS_WRITE) && !capable(CAP_SYS_ADMIN)) { | ||
931 | err = -EPERM; | ||
932 | goto free_out; | ||
933 | } | ||
934 | |||
935 | ret = -EINVAL; | ||
936 | |||
937 | if (!(buf->conf_reg.Function && | ||
938 | (buf->conf_reg.Function >= s->functions))) { | ||
939 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->conf_reg.Function); | ||
940 | if (p_dev) { | ||
941 | ret = pcmcia_access_configuration_register(p_dev, &buf->conf_reg); | ||
942 | pcmcia_put_dev(p_dev); | ||
943 | } | ||
944 | } | ||
945 | break; | ||
946 | case DS_GET_FIRST_REGION: | ||
947 | case DS_GET_NEXT_REGION: | ||
948 | case DS_BIND_MTD: | ||
949 | if (!capable(CAP_SYS_ADMIN)) { | ||
950 | err = -EPERM; | ||
951 | goto free_out; | ||
952 | } else { | ||
953 | printk_once(KERN_WARNING | ||
954 | "2.6. kernels use pcmciamtd instead of memory_cs.c and do not require special\n"); | ||
955 | printk_once(KERN_WARNING "MTD handling any more.\n"); | ||
956 | } | ||
957 | err = -EINVAL; | ||
958 | goto free_out; | ||
959 | break; | ||
960 | case DS_GET_FIRST_WINDOW: | ||
961 | ret = pcmcia_get_window(s, &buf->win_info.handle, 1, | ||
962 | &buf->win_info.window); | ||
963 | break; | ||
964 | case DS_GET_NEXT_WINDOW: | ||
965 | ret = pcmcia_get_window(s, &buf->win_info.handle, | ||
966 | buf->win_info.handle + 1, &buf->win_info.window); | ||
967 | break; | ||
968 | case DS_GET_MEM_PAGE: | ||
969 | ret = pcmcia_get_mem_page(s, buf->win_info.handle, | ||
970 | &buf->win_info.map); | ||
971 | break; | ||
972 | case DS_REPLACE_CIS: | ||
973 | ret = pcmcia_replace_cis(s, buf->cisdump.Data, buf->cisdump.Length); | ||
974 | break; | ||
975 | case DS_BIND_REQUEST: | ||
976 | if (!capable(CAP_SYS_ADMIN)) { | ||
977 | err = -EPERM; | ||
978 | goto free_out; | ||
979 | } | ||
980 | err = bind_request(s, &buf->bind_info); | ||
981 | break; | ||
982 | case DS_GET_DEVICE_INFO: | ||
983 | err = get_device_info(s, &buf->bind_info, 1); | ||
984 | break; | ||
985 | case DS_GET_NEXT_DEVICE: | ||
986 | err = get_device_info(s, &buf->bind_info, 0); | ||
987 | break; | ||
988 | case DS_UNBIND_REQUEST: | ||
989 | err = 0; | ||
990 | break; | ||
991 | default: | ||
992 | err = -EINVAL; | ||
993 | } | ||
994 | |||
995 | if ((err == 0) && (ret != 0)) { | ||
996 | pr_debug("ds_ioctl: ret = %d\n", ret); | ||
997 | switch (ret) { | ||
998 | case -ENODEV: | ||
999 | case -EINVAL: | ||
1000 | case -EBUSY: | ||
1001 | case -ENOSYS: | ||
1002 | err = ret; | ||
1003 | break; | ||
1004 | case -ENOMEM: | ||
1005 | err = -ENOSPC; break; | ||
1006 | case -ENOSPC: | ||
1007 | err = -ENODATA; break; | ||
1008 | default: | ||
1009 | err = -EIO; break; | ||
1010 | } | ||
1011 | } | ||
1012 | |||
1013 | if (cmd & IOC_OUT) { | ||
1014 | if (__copy_to_user(uarg, (char *)buf, size)) | ||
1015 | err = -EFAULT; | ||
1016 | } | ||
1017 | |||
1018 | free_out: | ||
1019 | kfree(buf); | ||
1020 | return err; | ||
1021 | } /* ds_ioctl */ | ||
1022 | |||
1023 | static long ds_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
1024 | { | ||
1025 | int ret; | ||
1026 | |||
1027 | lock_kernel(); | ||
1028 | ret = ds_ioctl(file, cmd, arg); | ||
1029 | unlock_kernel(); | ||
1030 | |||
1031 | return ret; | ||
1032 | } | ||
1033 | |||
1034 | |||
1035 | /*====================================================================*/ | ||
1036 | |||
1037 | static const struct file_operations ds_fops = { | ||
1038 | .owner = THIS_MODULE, | ||
1039 | .open = ds_open, | ||
1040 | .release = ds_release, | ||
1041 | .unlocked_ioctl = ds_unlocked_ioctl, | ||
1042 | .read = ds_read, | ||
1043 | .write = ds_write, | ||
1044 | .poll = ds_poll, | ||
1045 | }; | ||
1046 | |||
1047 | void __init pcmcia_setup_ioctl(void) | ||
1048 | { | ||
1049 | int i; | ||
1050 | |||
1051 | /* Set up character device for user mode clients */ | ||
1052 | i = register_chrdev(0, "pcmcia", &ds_fops); | ||
1053 | if (i < 0) | ||
1054 | printk(KERN_NOTICE "unable to find a free device # for " | ||
1055 | "Driver Services (error=%d)\n", i); | ||
1056 | else | ||
1057 | major_dev = i; | ||
1058 | |||
1059 | #ifdef CONFIG_PROC_FS | ||
1060 | proc_pccard = proc_mkdir("bus/pccard", NULL); | ||
1061 | if (proc_pccard) | ||
1062 | proc_create("drivers", 0, proc_pccard, &pccard_drivers_proc_fops); | ||
1063 | #endif | ||
1064 | } | ||
1065 | |||
1066 | |||
1067 | void __exit pcmcia_cleanup_ioctl(void) | ||
1068 | { | ||
1069 | #ifdef CONFIG_PROC_FS | ||
1070 | if (proc_pccard) { | ||
1071 | remove_proc_entry("drivers", proc_pccard); | ||
1072 | remove_proc_entry("bus/pccard", NULL); | ||
1073 | } | ||
1074 | #endif | ||
1075 | if (major_dev != -1) | ||
1076 | unregister_chrdev(major_dev, "pcmcia"); | ||
1077 | } | ||
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index a4cd9adfcbc0..54aa1c238cb3 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -25,7 +25,6 @@ | |||
25 | 25 | ||
26 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
27 | 27 | ||
28 | #include <pcmcia/cs_types.h> | ||
29 | #include <pcmcia/ss.h> | 28 | #include <pcmcia/ss.h> |
30 | #include <pcmcia/cs.h> | 29 | #include <pcmcia/cs.h> |
31 | #include <pcmcia/cistpl.h> | 30 | #include <pcmcia/cistpl.h> |
@@ -57,77 +56,107 @@ struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align, | |||
57 | } | 56 | } |
58 | 57 | ||
59 | 58 | ||
59 | static void release_io_space(struct pcmcia_socket *s, struct resource *res) | ||
60 | { | ||
61 | resource_size_t num = resource_size(res); | ||
62 | int i; | ||
63 | |||
64 | dev_dbg(&s->dev, "release_io_space for %pR\n", res); | ||
65 | |||
66 | for (i = 0; i < MAX_IO_WIN; i++) { | ||
67 | if (!s->io[i].res) | ||
68 | continue; | ||
69 | if ((s->io[i].res->start <= res->start) && | ||
70 | (s->io[i].res->end >= res->end)) { | ||
71 | s->io[i].InUse -= num; | ||
72 | if (res->parent) | ||
73 | release_resource(res); | ||
74 | res->start = res->end = 0; | ||
75 | res->flags = IORESOURCE_IO; | ||
76 | /* Free the window if no one else is using it */ | ||
77 | if (s->io[i].InUse == 0) { | ||
78 | release_resource(s->io[i].res); | ||
79 | kfree(s->io[i].res); | ||
80 | s->io[i].res = NULL; | ||
81 | } | ||
82 | } | ||
83 | } | ||
84 | } /* release_io_space */ | ||
85 | |||
60 | /** alloc_io_space | 86 | /** alloc_io_space |
61 | * | 87 | * |
62 | * Special stuff for managing IO windows, because they are scarce | 88 | * Special stuff for managing IO windows, because they are scarce |
63 | */ | 89 | */ |
64 | 90 | static int alloc_io_space(struct pcmcia_socket *s, struct resource *res, | |
65 | static int alloc_io_space(struct pcmcia_socket *s, u_int attr, | 91 | unsigned int lines) |
66 | unsigned int *base, unsigned int num, u_int lines) | ||
67 | { | 92 | { |
68 | unsigned int align; | 93 | unsigned int align; |
94 | unsigned int base = res->start; | ||
95 | unsigned int num = res->end; | ||
96 | int ret; | ||
69 | 97 | ||
70 | align = (*base) ? (lines ? 1<<lines : 0) : 1; | 98 | res->flags |= IORESOURCE_IO; |
99 | |||
100 | dev_dbg(&s->dev, "alloc_io_space request for %pR, %d lines\n", | ||
101 | res, lines); | ||
102 | |||
103 | align = base ? (lines ? 1<<lines : 0) : 1; | ||
71 | if (align && (align < num)) { | 104 | if (align && (align < num)) { |
72 | if (*base) { | 105 | if (base) { |
73 | dev_dbg(&s->dev, "odd IO request: num %#x align %#x\n", | 106 | dev_dbg(&s->dev, "odd IO request\n"); |
74 | num, align); | ||
75 | align = 0; | 107 | align = 0; |
76 | } else | 108 | } else |
77 | while (align && (align < num)) | 109 | while (align && (align < num)) |
78 | align <<= 1; | 110 | align <<= 1; |
79 | } | 111 | } |
80 | if (*base & ~(align-1)) { | 112 | if (base & ~(align-1)) { |
81 | dev_dbg(&s->dev, "odd IO request: base %#x align %#x\n", | 113 | dev_dbg(&s->dev, "odd IO request\n"); |
82 | *base, align); | ||
83 | align = 0; | 114 | align = 0; |
84 | } | 115 | } |
85 | 116 | ||
86 | return s->resource_ops->find_io(s, attr, base, num, align); | 117 | ret = s->resource_ops->find_io(s, res->flags, &base, num, align, |
87 | } /* alloc_io_space */ | 118 | &res->parent); |
88 | 119 | if (ret) { | |
120 | dev_dbg(&s->dev, "alloc_io_space request failed (%d)\n", ret); | ||
121 | return -EINVAL; | ||
122 | } | ||
89 | 123 | ||
90 | static void release_io_space(struct pcmcia_socket *s, unsigned int base, | 124 | res->start = base; |
91 | unsigned int num) | 125 | res->end = res->start + num - 1; |
92 | { | ||
93 | int i; | ||
94 | 126 | ||
95 | for (i = 0; i < MAX_IO_WIN; i++) { | 127 | if (res->parent) { |
96 | if (!s->io[i].res) | 128 | ret = request_resource(res->parent, res); |
97 | continue; | 129 | if (ret) { |
98 | if ((s->io[i].res->start <= base) && | 130 | dev_warn(&s->dev, |
99 | (s->io[i].res->end >= base+num-1)) { | 131 | "request_resource %pR failed: %d\n", res, ret); |
100 | s->io[i].InUse -= num; | 132 | res->parent = NULL; |
101 | /* Free the window if no one else is using it */ | 133 | release_io_space(s, res); |
102 | if (s->io[i].InUse == 0) { | ||
103 | release_resource(s->io[i].res); | ||
104 | kfree(s->io[i].res); | ||
105 | s->io[i].res = NULL; | ||
106 | } | ||
107 | } | 134 | } |
108 | } | 135 | } |
109 | } /* release_io_space */ | 136 | dev_dbg(&s->dev, "alloc_io_space request result %d: %pR\n", ret, res); |
137 | return ret; | ||
138 | } /* alloc_io_space */ | ||
110 | 139 | ||
111 | 140 | ||
112 | /** pccard_access_configuration_register | 141 | /** |
142 | * pcmcia_access_config() - read or write card configuration registers | ||
113 | * | 143 | * |
114 | * Access_configuration_register() reads and writes configuration | 144 | * pcmcia_access_config() reads and writes configuration registers in |
115 | * registers in attribute memory. Memory window 0 is reserved for | 145 | * attribute memory. Memory window 0 is reserved for this and the tuple |
116 | * this and the tuple reading services. | 146 | * reading services. Drivers must use pcmcia_read_config_byte() or |
147 | * pcmcia_write_config_byte(). | ||
117 | */ | 148 | */ |
118 | 149 | static int pcmcia_access_config(struct pcmcia_device *p_dev, | |
119 | int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, | 150 | off_t where, u8 *val, |
120 | conf_reg_t *reg) | 151 | int (*accessf) (struct pcmcia_socket *s, |
152 | int attr, unsigned int addr, | ||
153 | unsigned int len, void *ptr)) | ||
121 | { | 154 | { |
122 | struct pcmcia_socket *s; | 155 | struct pcmcia_socket *s; |
123 | config_t *c; | 156 | config_t *c; |
124 | int addr; | 157 | int addr; |
125 | u_char val; | ||
126 | int ret = 0; | 158 | int ret = 0; |
127 | 159 | ||
128 | if (!p_dev || !p_dev->function_config) | ||
129 | return -EINVAL; | ||
130 | |||
131 | s = p_dev->socket; | 160 | s = p_dev->socket; |
132 | 161 | ||
133 | mutex_lock(&s->ops_mutex); | 162 | mutex_lock(&s->ops_mutex); |
@@ -139,44 +168,57 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, | |||
139 | return -EACCES; | 168 | return -EACCES; |
140 | } | 169 | } |
141 | 170 | ||
142 | addr = (c->ConfigBase + reg->Offset) >> 1; | 171 | addr = (c->ConfigBase + where) >> 1; |
172 | |||
173 | ret = accessf(s, 1, addr, 1, val); | ||
143 | 174 | ||
144 | switch (reg->Action) { | ||
145 | case CS_READ: | ||
146 | ret = pcmcia_read_cis_mem(s, 1, addr, 1, &val); | ||
147 | reg->Value = val; | ||
148 | break; | ||
149 | case CS_WRITE: | ||
150 | val = reg->Value; | ||
151 | pcmcia_write_cis_mem(s, 1, addr, 1, &val); | ||
152 | break; | ||
153 | default: | ||
154 | dev_dbg(&s->dev, "Invalid conf register request\n"); | ||
155 | ret = -EINVAL; | ||
156 | break; | ||
157 | } | ||
158 | mutex_unlock(&s->ops_mutex); | 175 | mutex_unlock(&s->ops_mutex); |
176 | |||
159 | return ret; | 177 | return ret; |
160 | } /* pcmcia_access_configuration_register */ | 178 | } /* pcmcia_access_config */ |
161 | EXPORT_SYMBOL(pcmcia_access_configuration_register); | 179 | |
180 | |||
181 | /** | ||
182 | * pcmcia_read_config_byte() - read a byte from a card configuration register | ||
183 | * | ||
184 | * pcmcia_read_config_byte() reads a byte from a configuration register in | ||
185 | * attribute memory. | ||
186 | */ | ||
187 | int pcmcia_read_config_byte(struct pcmcia_device *p_dev, off_t where, u8 *val) | ||
188 | { | ||
189 | return pcmcia_access_config(p_dev, where, val, pcmcia_read_cis_mem); | ||
190 | } | ||
191 | EXPORT_SYMBOL(pcmcia_read_config_byte); | ||
192 | |||
193 | |||
194 | /** | ||
195 | * pcmcia_write_config_byte() - write a byte to a card configuration register | ||
196 | * | ||
197 | * pcmcia_write_config_byte() writes a byte to a configuration register in | ||
198 | * attribute memory. | ||
199 | */ | ||
200 | int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val) | ||
201 | { | ||
202 | return pcmcia_access_config(p_dev, where, &val, pcmcia_write_cis_mem); | ||
203 | } | ||
204 | EXPORT_SYMBOL(pcmcia_write_config_byte); | ||
162 | 205 | ||
163 | 206 | ||
164 | int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh, | 207 | int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh, |
165 | memreq_t *req) | 208 | unsigned int offset) |
166 | { | 209 | { |
167 | struct pcmcia_socket *s = p_dev->socket; | 210 | struct pcmcia_socket *s = p_dev->socket; |
211 | struct resource *res = wh; | ||
212 | unsigned int w; | ||
168 | int ret; | 213 | int ret; |
169 | 214 | ||
170 | wh--; | 215 | w = ((res->flags & IORESOURCE_BITS & WIN_FLAGS_REQ) >> 2) - 1; |
171 | if (wh >= MAX_WIN) | 216 | if (w >= MAX_WIN) |
172 | return -EINVAL; | 217 | return -EINVAL; |
173 | if (req->Page != 0) { | 218 | |
174 | dev_dbg(&s->dev, "failure: requested page is zero\n"); | ||
175 | return -EINVAL; | ||
176 | } | ||
177 | mutex_lock(&s->ops_mutex); | 219 | mutex_lock(&s->ops_mutex); |
178 | s->win[wh].card_start = req->CardOffset; | 220 | s->win[w].card_start = offset; |
179 | ret = s->ops->set_mem_map(s, &s->win[wh]); | 221 | ret = s->ops->set_mem_map(s, &s->win[w]); |
180 | if (ret) | 222 | if (ret) |
181 | dev_warn(&s->dev, "failed to set_mem_map\n"); | 223 | dev_warn(&s->dev, "failed to set_mem_map\n"); |
182 | mutex_unlock(&s->ops_mutex); | 224 | mutex_unlock(&s->ops_mutex); |
@@ -316,31 +358,25 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev) | |||
316 | * don't bother checking the port ranges against the current socket | 358 | * don't bother checking the port ranges against the current socket |
317 | * values. | 359 | * values. |
318 | */ | 360 | */ |
319 | static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req) | 361 | static int pcmcia_release_io(struct pcmcia_device *p_dev) |
320 | { | 362 | { |
321 | struct pcmcia_socket *s = p_dev->socket; | 363 | struct pcmcia_socket *s = p_dev->socket; |
322 | int ret = -EINVAL; | 364 | int ret = -EINVAL; |
323 | config_t *c; | 365 | config_t *c; |
324 | 366 | ||
325 | mutex_lock(&s->ops_mutex); | 367 | mutex_lock(&s->ops_mutex); |
326 | c = p_dev->function_config; | ||
327 | |||
328 | if (!p_dev->_io) | 368 | if (!p_dev->_io) |
329 | goto out; | 369 | goto out; |
330 | 370 | ||
331 | p_dev->_io = 0; | 371 | c = p_dev->function_config; |
332 | 372 | ||
333 | if ((c->io.BasePort1 != req->BasePort1) || | 373 | release_io_space(s, &c->io[0]); |
334 | (c->io.NumPorts1 != req->NumPorts1) || | ||
335 | (c->io.BasePort2 != req->BasePort2) || | ||
336 | (c->io.NumPorts2 != req->NumPorts2)) | ||
337 | goto out; | ||
338 | 374 | ||
339 | c->state &= ~CONFIG_IO_REQ; | 375 | if (c->io[1].end) |
376 | release_io_space(s, &c->io[1]); | ||
340 | 377 | ||
341 | release_io_space(s, req->BasePort1, req->NumPorts1); | 378 | p_dev->_io = 0; |
342 | if (req->NumPorts2) | 379 | c->state &= ~CONFIG_IO_REQ; |
343 | release_io_space(s, req->BasePort2, req->NumPorts2); | ||
344 | 380 | ||
345 | out: | 381 | out: |
346 | mutex_unlock(&s->ops_mutex); | 382 | mutex_unlock(&s->ops_mutex); |
@@ -349,19 +385,22 @@ out: | |||
349 | } /* pcmcia_release_io */ | 385 | } /* pcmcia_release_io */ |
350 | 386 | ||
351 | 387 | ||
352 | int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t wh) | 388 | int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) |
353 | { | 389 | { |
354 | struct pcmcia_socket *s = p_dev->socket; | 390 | struct pcmcia_socket *s = p_dev->socket; |
355 | pccard_mem_map *win; | 391 | pccard_mem_map *win; |
392 | unsigned int w; | ||
393 | |||
394 | dev_dbg(&p_dev->dev, "releasing window %pR\n", res); | ||
356 | 395 | ||
357 | wh--; | 396 | w = ((res->flags & IORESOURCE_BITS & WIN_FLAGS_REQ) >> 2) - 1; |
358 | if (wh >= MAX_WIN) | 397 | if (w >= MAX_WIN) |
359 | return -EINVAL; | 398 | return -EINVAL; |
360 | 399 | ||
361 | mutex_lock(&s->ops_mutex); | 400 | mutex_lock(&s->ops_mutex); |
362 | win = &s->win[wh]; | 401 | win = &s->win[w]; |
363 | 402 | ||
364 | if (!(p_dev->_win & CLIENT_WIN_REQ(wh))) { | 403 | if (!(p_dev->_win & CLIENT_WIN_REQ(w))) { |
365 | dev_dbg(&s->dev, "not releasing unknown window\n"); | 404 | dev_dbg(&s->dev, "not releasing unknown window\n"); |
366 | mutex_unlock(&s->ops_mutex); | 405 | mutex_unlock(&s->ops_mutex); |
367 | return -EINVAL; | 406 | return -EINVAL; |
@@ -370,15 +409,16 @@ int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t wh) | |||
370 | /* Shut down memory window */ | 409 | /* Shut down memory window */ |
371 | win->flags &= ~MAP_ACTIVE; | 410 | win->flags &= ~MAP_ACTIVE; |
372 | s->ops->set_mem_map(s, win); | 411 | s->ops->set_mem_map(s, win); |
373 | s->state &= ~SOCKET_WIN_REQ(wh); | 412 | s->state &= ~SOCKET_WIN_REQ(w); |
374 | 413 | ||
375 | /* Release system memory */ | 414 | /* Release system memory */ |
376 | if (win->res) { | 415 | if (win->res) { |
416 | release_resource(res); | ||
377 | release_resource(win->res); | 417 | release_resource(win->res); |
378 | kfree(win->res); | 418 | kfree(win->res); |
379 | win->res = NULL; | 419 | win->res = NULL; |
380 | } | 420 | } |
381 | p_dev->_win &= ~CLIENT_WIN_REQ(wh); | 421 | p_dev->_win &= ~CLIENT_WIN_REQ(w); |
382 | mutex_unlock(&s->ops_mutex); | 422 | mutex_unlock(&s->ops_mutex); |
383 | 423 | ||
384 | return 0; | 424 | return 0; |
@@ -473,13 +513,13 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, | |||
473 | pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, &c->ExtStatus); | 513 | pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, &c->ExtStatus); |
474 | } | 514 | } |
475 | if (req->Present & PRESENT_IOBASE_0) { | 515 | if (req->Present & PRESENT_IOBASE_0) { |
476 | u_char b = c->io.BasePort1 & 0xff; | 516 | u8 b = c->io[0].start & 0xff; |
477 | pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b); | 517 | pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b); |
478 | b = (c->io.BasePort1 >> 8) & 0xff; | 518 | b = (c->io[0].start >> 8) & 0xff; |
479 | pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b); | 519 | pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b); |
480 | } | 520 | } |
481 | if (req->Present & PRESENT_IOSIZE) { | 521 | if (req->Present & PRESENT_IOSIZE) { |
482 | u_char b = c->io.NumPorts1 + c->io.NumPorts2 - 1; | 522 | u8 b = resource_size(&c->io[0]) + resource_size(&c->io[1]) - 1; |
483 | pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b); | 523 | pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b); |
484 | } | 524 | } |
485 | 525 | ||
@@ -513,28 +553,29 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, | |||
513 | EXPORT_SYMBOL(pcmcia_request_configuration); | 553 | EXPORT_SYMBOL(pcmcia_request_configuration); |
514 | 554 | ||
515 | 555 | ||
516 | /** pcmcia_request_io | 556 | /** |
557 | * pcmcia_request_io() - attempt to reserve port ranges for PCMCIA devices | ||
517 | * | 558 | * |
518 | * Request_io() reserves ranges of port addresses for a socket. | 559 | * pcmcia_request_io() attepts to reserve the IO port ranges specified in |
519 | * I have not implemented range sharing or alias addressing. | 560 | * &struct pcmcia_device @p_dev->resource[0] and @p_dev->resource[1]. The |
561 | * "start" value is the requested start of the IO port resource; "end" | ||
562 | * reflects the number of ports requested. The number of IO lines requested | ||
563 | * is specified in &struct pcmcia_device @p_dev->io_lines. | ||
520 | */ | 564 | */ |
521 | int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) | 565 | int pcmcia_request_io(struct pcmcia_device *p_dev) |
522 | { | 566 | { |
523 | struct pcmcia_socket *s = p_dev->socket; | 567 | struct pcmcia_socket *s = p_dev->socket; |
524 | config_t *c; | 568 | config_t *c = p_dev->function_config; |
525 | int ret = -EINVAL; | 569 | int ret = -EINVAL; |
526 | 570 | ||
527 | mutex_lock(&s->ops_mutex); | 571 | mutex_lock(&s->ops_mutex); |
572 | dev_dbg(&s->dev, "pcmcia_request_io: %pR , %pR", &c->io[0], &c->io[1]); | ||
528 | 573 | ||
529 | if (!(s->state & SOCKET_PRESENT)) { | 574 | if (!(s->state & SOCKET_PRESENT)) { |
530 | dev_dbg(&s->dev, "No card present\n"); | 575 | dev_dbg(&s->dev, "pcmcia_request_io: No card present\n"); |
531 | goto out; | 576 | goto out; |
532 | } | 577 | } |
533 | 578 | ||
534 | if (!req) | ||
535 | goto out; | ||
536 | |||
537 | c = p_dev->function_config; | ||
538 | if (c->state & CONFIG_LOCKED) { | 579 | if (c->state & CONFIG_LOCKED) { |
539 | dev_dbg(&s->dev, "Configuration is locked\n"); | 580 | dev_dbg(&s->dev, "Configuration is locked\n"); |
540 | goto out; | 581 | goto out; |
@@ -543,40 +584,25 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) | |||
543 | dev_dbg(&s->dev, "IO already configured\n"); | 584 | dev_dbg(&s->dev, "IO already configured\n"); |
544 | goto out; | 585 | goto out; |
545 | } | 586 | } |
546 | if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) { | ||
547 | dev_dbg(&s->dev, "bad attribute setting for IO region 1\n"); | ||
548 | goto out; | ||
549 | } | ||
550 | if ((req->NumPorts2 > 0) && | ||
551 | (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) { | ||
552 | dev_dbg(&s->dev, "bad attribute setting for IO region 2\n"); | ||
553 | goto out; | ||
554 | } | ||
555 | 587 | ||
556 | dev_dbg(&s->dev, "trying to allocate resource 1\n"); | 588 | ret = alloc_io_space(s, &c->io[0], p_dev->io_lines); |
557 | ret = alloc_io_space(s, req->Attributes1, &req->BasePort1, | 589 | if (ret) |
558 | req->NumPorts1, req->IOAddrLines); | ||
559 | if (ret) { | ||
560 | dev_dbg(&s->dev, "allocation of resource 1 failed\n"); | ||
561 | goto out; | 590 | goto out; |
562 | } | ||
563 | 591 | ||
564 | if (req->NumPorts2) { | 592 | if (c->io[1].end) { |
565 | dev_dbg(&s->dev, "trying to allocate resource 2\n"); | 593 | ret = alloc_io_space(s, &c->io[1], p_dev->io_lines); |
566 | ret = alloc_io_space(s, req->Attributes2, &req->BasePort2, | ||
567 | req->NumPorts2, req->IOAddrLines); | ||
568 | if (ret) { | 594 | if (ret) { |
569 | dev_dbg(&s->dev, "allocation of resource 2 failed\n"); | 595 | release_io_space(s, &c->io[0]); |
570 | release_io_space(s, req->BasePort1, req->NumPorts1); | ||
571 | goto out; | 596 | goto out; |
572 | } | 597 | } |
573 | } | 598 | } else |
599 | c->io[1].start = 0; | ||
574 | 600 | ||
575 | c->io = *req; | ||
576 | c->state |= CONFIG_IO_REQ; | 601 | c->state |= CONFIG_IO_REQ; |
577 | p_dev->_io = 1; | 602 | p_dev->_io = 1; |
578 | dev_dbg(&s->dev, "allocating resources succeeded: %d\n", ret); | ||
579 | 603 | ||
604 | dev_dbg(&s->dev, "pcmcia_request_io succeeded: %pR , %pR", | ||
605 | &c->io[0], &c->io[1]); | ||
580 | out: | 606 | out: |
581 | mutex_unlock(&s->ops_mutex); | 607 | mutex_unlock(&s->ops_mutex); |
582 | 608 | ||
@@ -651,7 +677,7 @@ EXPORT_SYMBOL(__pcmcia_request_exclusive_irq); | |||
651 | #ifdef CONFIG_PCMCIA_PROBE | 677 | #ifdef CONFIG_PCMCIA_PROBE |
652 | 678 | ||
653 | /* mask of IRQs already reserved by other cards, we should avoid using them */ | 679 | /* mask of IRQs already reserved by other cards, we should avoid using them */ |
654 | static u8 pcmcia_used_irq[NR_IRQS]; | 680 | static u8 pcmcia_used_irq[32]; |
655 | 681 | ||
656 | static irqreturn_t test_action(int cpl, void *dev_id) | 682 | static irqreturn_t test_action(int cpl, void *dev_id) |
657 | { | 683 | { |
@@ -674,6 +700,9 @@ static int pcmcia_setup_isa_irq(struct pcmcia_device *p_dev, int type) | |||
674 | for (try = 0; try < 64; try++) { | 700 | for (try = 0; try < 64; try++) { |
675 | irq = try % 32; | 701 | irq = try % 32; |
676 | 702 | ||
703 | if (irq > NR_IRQS) | ||
704 | continue; | ||
705 | |||
677 | /* marked as available by driver, not blocked by userspace? */ | 706 | /* marked as available by driver, not blocked by userspace? */ |
678 | if (!((mask >> irq) & 1)) | 707 | if (!((mask >> irq) & 1)) |
679 | continue; | 708 | continue; |
@@ -767,23 +796,18 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha | |||
767 | struct pcmcia_socket *s = p_dev->socket; | 796 | struct pcmcia_socket *s = p_dev->socket; |
768 | pccard_mem_map *win; | 797 | pccard_mem_map *win; |
769 | u_long align; | 798 | u_long align; |
799 | struct resource *res; | ||
770 | int w; | 800 | int w; |
771 | 801 | ||
772 | if (!(s->state & SOCKET_PRESENT)) { | 802 | if (!(s->state & SOCKET_PRESENT)) { |
773 | dev_dbg(&s->dev, "No card present\n"); | 803 | dev_dbg(&s->dev, "No card present\n"); |
774 | return -ENODEV; | 804 | return -ENODEV; |
775 | } | 805 | } |
776 | if (req->Attributes & (WIN_PAGED | WIN_SHARED)) { | ||
777 | dev_dbg(&s->dev, "bad attribute setting for iomem region\n"); | ||
778 | return -EINVAL; | ||
779 | } | ||
780 | 806 | ||
781 | /* Window size defaults to smallest available */ | 807 | /* Window size defaults to smallest available */ |
782 | if (req->Size == 0) | 808 | if (req->Size == 0) |
783 | req->Size = s->map_size; | 809 | req->Size = s->map_size; |
784 | align = (((s->features & SS_CAP_MEM_ALIGN) || | 810 | align = (s->features & SS_CAP_MEM_ALIGN) ? req->Size : s->map_size; |
785 | (req->Attributes & WIN_STRICT_ALIGN)) ? | ||
786 | req->Size : s->map_size); | ||
787 | if (req->Size & (s->map_size-1)) { | 811 | if (req->Size & (s->map_size-1)) { |
788 | dev_dbg(&s->dev, "invalid map size\n"); | 812 | dev_dbg(&s->dev, "invalid map size\n"); |
789 | return -EINVAL; | 813 | return -EINVAL; |
@@ -797,20 +821,21 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha | |||
797 | align = 0; | 821 | align = 0; |
798 | 822 | ||
799 | /* Allocate system memory window */ | 823 | /* Allocate system memory window */ |
824 | mutex_lock(&s->ops_mutex); | ||
800 | for (w = 0; w < MAX_WIN; w++) | 825 | for (w = 0; w < MAX_WIN; w++) |
801 | if (!(s->state & SOCKET_WIN_REQ(w))) | 826 | if (!(s->state & SOCKET_WIN_REQ(w))) |
802 | break; | 827 | break; |
803 | if (w == MAX_WIN) { | 828 | if (w == MAX_WIN) { |
804 | dev_dbg(&s->dev, "all windows are used already\n"); | 829 | dev_dbg(&s->dev, "all windows are used already\n"); |
830 | mutex_unlock(&s->ops_mutex); | ||
805 | return -EINVAL; | 831 | return -EINVAL; |
806 | } | 832 | } |
807 | 833 | ||
808 | mutex_lock(&s->ops_mutex); | ||
809 | win = &s->win[w]; | 834 | win = &s->win[w]; |
810 | 835 | ||
811 | if (!(s->features & SS_CAP_STATIC_MAP)) { | 836 | if (!(s->features & SS_CAP_STATIC_MAP)) { |
812 | win->res = pcmcia_find_mem_region(req->Base, req->Size, align, | 837 | win->res = pcmcia_find_mem_region(req->Base, req->Size, align, |
813 | (req->Attributes & WIN_MAP_BELOW_1MB), s); | 838 | 0, s); |
814 | if (!win->res) { | 839 | if (!win->res) { |
815 | dev_dbg(&s->dev, "allocating mem region failed\n"); | 840 | dev_dbg(&s->dev, "allocating mem region failed\n"); |
816 | mutex_unlock(&s->ops_mutex); | 841 | mutex_unlock(&s->ops_mutex); |
@@ -821,16 +846,8 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha | |||
821 | 846 | ||
822 | /* Configure the socket controller */ | 847 | /* Configure the socket controller */ |
823 | win->map = w+1; | 848 | win->map = w+1; |
824 | win->flags = 0; | 849 | win->flags = req->Attributes; |
825 | win->speed = req->AccessSpeed; | 850 | win->speed = req->AccessSpeed; |
826 | if (req->Attributes & WIN_MEMORY_TYPE) | ||
827 | win->flags |= MAP_ATTRIB; | ||
828 | if (req->Attributes & WIN_ENABLE) | ||
829 | win->flags |= MAP_ACTIVE; | ||
830 | if (req->Attributes & WIN_DATA_WIDTH_16) | ||
831 | win->flags |= MAP_16BIT; | ||
832 | if (req->Attributes & WIN_USE_WAIT) | ||
833 | win->flags |= MAP_USE_WAIT; | ||
834 | win->card_start = 0; | 851 | win->card_start = 0; |
835 | 852 | ||
836 | if (s->ops->set_mem_map(s, win) != 0) { | 853 | if (s->ops->set_mem_map(s, win) != 0) { |
@@ -846,8 +863,21 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha | |||
846 | else | 863 | else |
847 | req->Base = win->res->start; | 864 | req->Base = win->res->start; |
848 | 865 | ||
866 | /* convert to new-style resources */ | ||
867 | res = p_dev->resource[w + MAX_IO_WIN]; | ||
868 | res->start = req->Base; | ||
869 | res->end = req->Base + req->Size - 1; | ||
870 | res->flags &= ~IORESOURCE_BITS; | ||
871 | res->flags |= (req->Attributes & WIN_FLAGS_MAP) | (win->map << 2); | ||
872 | res->flags |= IORESOURCE_MEM; | ||
873 | res->parent = win->res; | ||
874 | if (win->res) | ||
875 | request_resource(&iomem_resource, res); | ||
876 | |||
877 | dev_dbg(&s->dev, "request_window results in %pR\n", res); | ||
878 | |||
849 | mutex_unlock(&s->ops_mutex); | 879 | mutex_unlock(&s->ops_mutex); |
850 | *wh = w + 1; | 880 | *wh = res; |
851 | 881 | ||
852 | return 0; | 882 | return 0; |
853 | } /* pcmcia_request_window */ | 883 | } /* pcmcia_request_window */ |
@@ -855,13 +885,18 @@ EXPORT_SYMBOL(pcmcia_request_window); | |||
855 | 885 | ||
856 | void pcmcia_disable_device(struct pcmcia_device *p_dev) | 886 | void pcmcia_disable_device(struct pcmcia_device *p_dev) |
857 | { | 887 | { |
888 | int i; | ||
889 | for (i = 0; i < MAX_WIN; i++) { | ||
890 | struct resource *res = p_dev->resource[MAX_IO_WIN + i]; | ||
891 | if (res->flags & WIN_FLAGS_REQ) | ||
892 | pcmcia_release_window(p_dev, res); | ||
893 | } | ||
894 | |||
858 | pcmcia_release_configuration(p_dev); | 895 | pcmcia_release_configuration(p_dev); |
859 | pcmcia_release_io(p_dev, &p_dev->io); | 896 | pcmcia_release_io(p_dev); |
860 | if (p_dev->_irq) { | 897 | if (p_dev->_irq) { |
861 | free_irq(p_dev->irq, p_dev->priv); | 898 | free_irq(p_dev->irq, p_dev->priv); |
862 | p_dev->_irq = 0; | 899 | p_dev->_irq = 0; |
863 | } | 900 | } |
864 | if (p_dev->win) | ||
865 | pcmcia_release_window(p_dev, p_dev->win); | ||
866 | } | 901 | } |
867 | EXPORT_SYMBOL(pcmcia_disable_device); | 902 | EXPORT_SYMBOL(pcmcia_disable_device); |
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index b61a13663a0a..b8a869af0f44 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | 19 | ||
20 | #include <pcmcia/cs_types.h> | ||
21 | #include <pcmcia/ss.h> | 20 | #include <pcmcia/ss.h> |
22 | #include <pcmcia/cs.h> | 21 | #include <pcmcia/cs.h> |
23 | 22 | ||
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index f370476d5417..ae07b4db8a6e 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <mach/pxa2xx-regs.h> | 32 | #include <mach/pxa2xx-regs.h> |
33 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
34 | 34 | ||
35 | #include <pcmcia/cs_types.h> | ||
36 | #include <pcmcia/ss.h> | 35 | #include <pcmcia/ss.h> |
37 | #include <pcmcia/cistpl.h> | 36 | #include <pcmcia/cistpl.h> |
38 | 37 | ||
diff --git a/drivers/pcmcia/rsrc_iodyn.c b/drivers/pcmcia/rsrc_iodyn.c index d0bf35021065..8510c35d2952 100644 --- a/drivers/pcmcia/rsrc_iodyn.c +++ b/drivers/pcmcia/rsrc_iodyn.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | 18 | ||
19 | #include <pcmcia/cs_types.h> | ||
20 | #include <pcmcia/ss.h> | 19 | #include <pcmcia/ss.h> |
21 | #include <pcmcia/cs.h> | 20 | #include <pcmcia/cs.h> |
22 | #include <pcmcia/cistpl.h> | 21 | #include <pcmcia/cistpl.h> |
@@ -88,7 +87,7 @@ static struct resource *__iodyn_find_io_region(struct pcmcia_socket *s, | |||
88 | 87 | ||
89 | static int iodyn_find_io(struct pcmcia_socket *s, unsigned int attr, | 88 | static int iodyn_find_io(struct pcmcia_socket *s, unsigned int attr, |
90 | unsigned int *base, unsigned int num, | 89 | unsigned int *base, unsigned int num, |
91 | unsigned int align) | 90 | unsigned int align, struct resource **parent) |
92 | { | 91 | { |
93 | int i, ret = 0; | 92 | int i, ret = 0; |
94 | 93 | ||
@@ -129,6 +128,7 @@ static int iodyn_find_io(struct pcmcia_socket *s, unsigned int attr, | |||
129 | ((res->flags & ~IORESOURCE_BITS) | | 128 | ((res->flags & ~IORESOURCE_BITS) | |
130 | (attr & IORESOURCE_BITS)); | 129 | (attr & IORESOURCE_BITS)); |
131 | s->io[i].InUse = num; | 130 | s->io[i].InUse = num; |
131 | *parent = res; | ||
132 | return 0; | 132 | return 0; |
133 | } | 133 | } |
134 | 134 | ||
@@ -140,6 +140,7 @@ static int iodyn_find_io(struct pcmcia_socket *s, unsigned int attr, | |||
140 | continue; | 140 | continue; |
141 | *base = try; | 141 | *base = try; |
142 | s->io[i].InUse += num; | 142 | s->io[i].InUse += num; |
143 | *parent = res; | ||
143 | return 0; | 144 | return 0; |
144 | } | 145 | } |
145 | 146 | ||
@@ -152,6 +153,7 @@ static int iodyn_find_io(struct pcmcia_socket *s, unsigned int attr, | |||
152 | continue; | 153 | continue; |
153 | *base = try; | 154 | *base = try; |
154 | s->io[i].InUse += num; | 155 | s->io[i].InUse += num; |
156 | *parent = res; | ||
155 | return 0; | 157 | return 0; |
156 | } | 158 | } |
157 | } | 159 | } |
@@ -164,8 +166,6 @@ struct pccard_resource_ops pccard_iodyn_ops = { | |||
164 | .validate_mem = NULL, | 166 | .validate_mem = NULL, |
165 | .find_io = iodyn_find_io, | 167 | .find_io = iodyn_find_io, |
166 | .find_mem = NULL, | 168 | .find_mem = NULL, |
167 | .add_io = NULL, | ||
168 | .add_mem = NULL, | ||
169 | .init = static_init, | 169 | .init = static_init, |
170 | .exit = NULL, | 170 | .exit = NULL, |
171 | }; | 171 | }; |
diff --git a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c index 142efac3c387..4e80421fd908 100644 --- a/drivers/pcmcia/rsrc_mgr.c +++ b/drivers/pcmcia/rsrc_mgr.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | 18 | ||
19 | #include <pcmcia/cs_types.h> | ||
20 | #include <pcmcia/ss.h> | 19 | #include <pcmcia/ss.h> |
21 | #include <pcmcia/cs.h> | 20 | #include <pcmcia/cs.h> |
22 | #include <pcmcia/cistpl.h> | 21 | #include <pcmcia/cistpl.h> |
@@ -48,11 +47,12 @@ struct resource *pcmcia_make_resource(unsigned long start, unsigned long end, | |||
48 | 47 | ||
49 | static int static_find_io(struct pcmcia_socket *s, unsigned int attr, | 48 | static int static_find_io(struct pcmcia_socket *s, unsigned int attr, |
50 | unsigned int *base, unsigned int num, | 49 | unsigned int *base, unsigned int num, |
51 | unsigned int align) | 50 | unsigned int align, struct resource **parent) |
52 | { | 51 | { |
53 | if (!s->io_offset) | 52 | if (!s->io_offset) |
54 | return -EINVAL; | 53 | return -EINVAL; |
55 | *base = s->io_offset | (*base & 0x0fff); | 54 | *base = s->io_offset | (*base & 0x0fff); |
55 | *parent = NULL; | ||
56 | 56 | ||
57 | return 0; | 57 | return 0; |
58 | } | 58 | } |
@@ -62,8 +62,6 @@ struct pccard_resource_ops pccard_static_ops = { | |||
62 | .validate_mem = NULL, | 62 | .validate_mem = NULL, |
63 | .find_io = static_find_io, | 63 | .find_io = static_find_io, |
64 | .find_mem = NULL, | 64 | .find_mem = NULL, |
65 | .add_io = NULL, | ||
66 | .add_mem = NULL, | ||
67 | .init = static_init, | 65 | .init = static_init, |
68 | .exit = NULL, | 66 | .exit = NULL, |
69 | }; | 67 | }; |
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index dcd1a4ad3d63..96f348b35fde 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c | |||
@@ -28,7 +28,6 @@ | |||
28 | 28 | ||
29 | #include <asm/irq.h> | 29 | #include <asm/irq.h> |
30 | 30 | ||
31 | #include <pcmcia/cs_types.h> | ||
32 | #include <pcmcia/ss.h> | 31 | #include <pcmcia/ss.h> |
33 | #include <pcmcia/cs.h> | 32 | #include <pcmcia/cs.h> |
34 | #include <pcmcia/cistpl.h> | 33 | #include <pcmcia/cistpl.h> |
@@ -64,6 +63,9 @@ struct socket_data { | |||
64 | #define MEM_PROBE_LOW (1 << 0) | 63 | #define MEM_PROBE_LOW (1 << 0) |
65 | #define MEM_PROBE_HIGH (1 << 1) | 64 | #define MEM_PROBE_HIGH (1 << 1) |
66 | 65 | ||
66 | /* Action field */ | ||
67 | #define REMOVE_MANAGED_RESOURCE 1 | ||
68 | #define ADD_MANAGED_RESOURCE 2 | ||
67 | 69 | ||
68 | /*====================================================================== | 70 | /*====================================================================== |
69 | 71 | ||
@@ -716,7 +718,7 @@ static struct resource *__nonstatic_find_io_region(struct pcmcia_socket *s, | |||
716 | 718 | ||
717 | static int nonstatic_find_io(struct pcmcia_socket *s, unsigned int attr, | 719 | static int nonstatic_find_io(struct pcmcia_socket *s, unsigned int attr, |
718 | unsigned int *base, unsigned int num, | 720 | unsigned int *base, unsigned int num, |
719 | unsigned int align) | 721 | unsigned int align, struct resource **parent) |
720 | { | 722 | { |
721 | int i, ret = 0; | 723 | int i, ret = 0; |
722 | 724 | ||
@@ -758,6 +760,7 @@ static int nonstatic_find_io(struct pcmcia_socket *s, unsigned int attr, | |||
758 | ((res->flags & ~IORESOURCE_BITS) | | 760 | ((res->flags & ~IORESOURCE_BITS) | |
759 | (attr & IORESOURCE_BITS)); | 761 | (attr & IORESOURCE_BITS)); |
760 | s->io[i].InUse = num; | 762 | s->io[i].InUse = num; |
763 | *parent = res; | ||
761 | return 0; | 764 | return 0; |
762 | } | 765 | } |
763 | 766 | ||
@@ -773,6 +776,7 @@ static int nonstatic_find_io(struct pcmcia_socket *s, unsigned int attr, | |||
773 | continue; | 776 | continue; |
774 | *base = try; | 777 | *base = try; |
775 | s->io[i].InUse += num; | 778 | s->io[i].InUse += num; |
779 | *parent = res; | ||
776 | return 0; | 780 | return 0; |
777 | } | 781 | } |
778 | } | 782 | } |
@@ -791,6 +795,7 @@ static int nonstatic_find_io(struct pcmcia_socket *s, unsigned int attr, | |||
791 | continue; | 795 | continue; |
792 | *base = try; | 796 | *base = try; |
793 | s->io[i].InUse += num; | 797 | s->io[i].InUse += num; |
798 | *parent = res; | ||
794 | return 0; | 799 | return 0; |
795 | } | 800 | } |
796 | } | 801 | } |
@@ -1055,8 +1060,6 @@ struct pccard_resource_ops pccard_nonstatic_ops = { | |||
1055 | .validate_mem = pcmcia_nonstatic_validate_mem, | 1060 | .validate_mem = pcmcia_nonstatic_validate_mem, |
1056 | .find_io = nonstatic_find_io, | 1061 | .find_io = nonstatic_find_io, |
1057 | .find_mem = nonstatic_find_mem_region, | 1062 | .find_mem = nonstatic_find_mem_region, |
1058 | .add_io = adjust_io, | ||
1059 | .add_mem = adjust_memory, | ||
1060 | .init = nonstatic_init, | 1063 | .init = nonstatic_init, |
1061 | .exit = nonstatic_release_resource_db, | 1064 | .exit = nonstatic_release_resource_db, |
1062 | }; | 1065 | }; |
@@ -1115,8 +1118,6 @@ static ssize_t store_io_db(struct device *dev, | |||
1115 | 1118 | ||
1116 | mutex_lock(&s->ops_mutex); | 1119 | mutex_lock(&s->ops_mutex); |
1117 | ret = adjust_io(s, add, start_addr, end_addr); | 1120 | ret = adjust_io(s, add, start_addr, end_addr); |
1118 | if (!ret) | ||
1119 | s->resource_setup_new = 1; | ||
1120 | mutex_unlock(&s->ops_mutex); | 1121 | mutex_unlock(&s->ops_mutex); |
1121 | 1122 | ||
1122 | return ret ? ret : count; | 1123 | return ret ? ret : count; |
@@ -1183,8 +1184,6 @@ static ssize_t store_mem_db(struct device *dev, | |||
1183 | 1184 | ||
1184 | mutex_lock(&s->ops_mutex); | 1185 | mutex_lock(&s->ops_mutex); |
1185 | ret = adjust_memory(s, add, start_addr, end_addr); | 1186 | ret = adjust_memory(s, add, start_addr, end_addr); |
1186 | if (!ret) | ||
1187 | s->resource_setup_new = 1; | ||
1188 | mutex_unlock(&s->ops_mutex); | 1187 | mutex_unlock(&s->ops_mutex); |
1189 | 1188 | ||
1190 | return ret ? ret : count; | 1189 | return ret ? ret : count; |
diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index edbd8c472628..e09851480295 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
36 | #include <linux/platform_device.h> | 36 | #include <linux/platform_device.h> |
37 | 37 | ||
38 | #include <pcmcia/cs_types.h> | ||
39 | #include <pcmcia/cs.h> | 38 | #include <pcmcia/cs.h> |
40 | #include <pcmcia/ss.h> | 39 | #include <pcmcia/ss.h> |
41 | 40 | ||
diff --git a/drivers/pcmcia/soc_common.h b/drivers/pcmcia/soc_common.h index e40824ce6b0b..3fba3a679128 100644 --- a/drivers/pcmcia/soc_common.h +++ b/drivers/pcmcia/soc_common.h | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | /* include the world */ | 12 | /* include the world */ |
13 | #include <linux/cpufreq.h> | 13 | #include <linux/cpufreq.h> |
14 | #include <pcmcia/cs_types.h> | ||
15 | #include <pcmcia/cs.h> | 14 | #include <pcmcia/cs.h> |
16 | #include <pcmcia/ss.h> | 15 | #include <pcmcia/ss.h> |
17 | #include <pcmcia/cistpl.h> | 16 | #include <pcmcia/cistpl.h> |
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index 80e36bc407da..cb0d3ace18bd 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <asm/system.h> | 26 | #include <asm/system.h> |
27 | #include <asm/irq.h> | 27 | #include <asm/irq.h> |
28 | 28 | ||
29 | #include <pcmcia/cs_types.h> | ||
30 | #include <pcmcia/ss.h> | 29 | #include <pcmcia/ss.h> |
31 | #include <pcmcia/cs.h> | 30 | #include <pcmcia/cs.h> |
32 | #include <pcmcia/cistpl.h> | 31 | #include <pcmcia/cistpl.h> |
diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c index 56004a1b5bba..be0d841c7ebd 100644 --- a/drivers/pcmcia/tcic.c +++ b/drivers/pcmcia/tcic.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <asm/io.h> | 49 | #include <asm/io.h> |
50 | #include <asm/system.h> | 50 | #include <asm/system.h> |
51 | 51 | ||
52 | #include <pcmcia/cs_types.h> | ||
53 | #include <pcmcia/cs.h> | 52 | #include <pcmcia/cs.h> |
54 | #include <pcmcia/ss.h> | 53 | #include <pcmcia/ss.h> |
55 | #include "tcic.h" | 54 | #include "tcic.h" |
diff --git a/drivers/pcmcia/xxs1500_ss.c b/drivers/pcmcia/xxs1500_ss.c index 201ccfa1e97b..fa88c360c37a 100644 --- a/drivers/pcmcia/xxs1500_ss.c +++ b/drivers/pcmcia/xxs1500_ss.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
19 | 19 | ||
20 | #include <pcmcia/cs_types.h> | ||
21 | #include <pcmcia/cs.h> | 20 | #include <pcmcia/cs.h> |
22 | #include <pcmcia/ss.h> | 21 | #include <pcmcia/ss.h> |
23 | #include <pcmcia/cistpl.h> | 22 | #include <pcmcia/cistpl.h> |
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index f1d41374eea7..414d9a6f9a32 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | 21 | ||
22 | #include <pcmcia/cs_types.h> | ||
23 | #include <pcmcia/ss.h> | 22 | #include <pcmcia/ss.h> |
24 | #include <pcmcia/cs.h> | 23 | #include <pcmcia/cs.h> |
25 | 24 | ||
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 9d70aef99227..61f49bdcc0c2 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <scsi/scsi_host.h> | 49 | #include <scsi/scsi_host.h> |
50 | #include "aha152x.h" | 50 | #include "aha152x.h" |
51 | 51 | ||
52 | #include <pcmcia/cs_types.h> | ||
53 | #include <pcmcia/cs.h> | 52 | #include <pcmcia/cs.h> |
54 | #include <pcmcia/cistpl.h> | 53 | #include <pcmcia/cistpl.h> |
55 | #include <pcmcia/ds.h> | 54 | #include <pcmcia/ds.h> |
@@ -101,9 +100,8 @@ static int aha152x_probe(struct pcmcia_device *link) | |||
101 | info->p_dev = link; | 100 | info->p_dev = link; |
102 | link->priv = info; | 101 | link->priv = info; |
103 | 102 | ||
104 | link->io.NumPorts1 = 0x20; | 103 | link->resource[0]->end = 0x20; |
105 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 104 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
106 | link->io.IOAddrLines = 10; | ||
107 | link->conf.Attributes = CONF_ENABLE_IRQ; | 105 | link->conf.Attributes = CONF_ENABLE_IRQ; |
108 | link->conf.IntType = INT_MEMORY_AND_IO; | 106 | link->conf.IntType = INT_MEMORY_AND_IO; |
109 | link->conf.Present = PRESENT_OPTION; | 107 | link->conf.Present = PRESENT_OPTION; |
@@ -131,15 +129,16 @@ static int aha152x_config_check(struct pcmcia_device *p_dev, | |||
131 | unsigned int vcc, | 129 | unsigned int vcc, |
132 | void *priv_data) | 130 | void *priv_data) |
133 | { | 131 | { |
132 | p_dev->io_lines = 10; | ||
134 | /* For New Media T&J, look for a SCSI window */ | 133 | /* For New Media T&J, look for a SCSI window */ |
135 | if (cfg->io.win[0].len >= 0x20) | 134 | if (cfg->io.win[0].len >= 0x20) |
136 | p_dev->io.BasePort1 = cfg->io.win[0].base; | 135 | p_dev->resource[0]->start = cfg->io.win[0].base; |
137 | else if ((cfg->io.nwin > 1) && | 136 | else if ((cfg->io.nwin > 1) && |
138 | (cfg->io.win[1].len >= 0x20)) | 137 | (cfg->io.win[1].len >= 0x20)) |
139 | p_dev->io.BasePort1 = cfg->io.win[1].base; | 138 | p_dev->resource[0]->start = cfg->io.win[1].base; |
140 | if ((cfg->io.nwin > 0) && | 139 | if ((cfg->io.nwin > 0) && |
141 | (p_dev->io.BasePort1 < 0xffff)) { | 140 | (p_dev->resource[0]->start < 0xffff)) { |
142 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | 141 | if (!pcmcia_request_io(p_dev)) |
143 | return 0; | 142 | return 0; |
144 | } | 143 | } |
145 | return -EINVAL; | 144 | return -EINVAL; |
@@ -168,7 +167,7 @@ static int aha152x_config_cs(struct pcmcia_device *link) | |||
168 | /* Set configuration options for the aha152x driver */ | 167 | /* Set configuration options for the aha152x driver */ |
169 | memset(&s, 0, sizeof(s)); | 168 | memset(&s, 0, sizeof(s)); |
170 | s.conf = "PCMCIA setup"; | 169 | s.conf = "PCMCIA setup"; |
171 | s.io_port = link->io.BasePort1; | 170 | s.io_port = link->resource[0]->start; |
172 | s.irq = link->irq; | 171 | s.irq = link->irq; |
173 | s.scsiid = host_id; | 172 | s.scsiid = host_id; |
174 | s.reconnect = reconnect; | 173 | s.reconnect = reconnect; |
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index 21b141151dfc..13dbe5c48492 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <scsi/scsi_host.h> | 46 | #include <scsi/scsi_host.h> |
47 | #include "fdomain.h" | 47 | #include "fdomain.h" |
48 | 48 | ||
49 | #include <pcmcia/cs_types.h> | ||
50 | #include <pcmcia/cs.h> | 49 | #include <pcmcia/cs.h> |
51 | #include <pcmcia/cistpl.h> | 50 | #include <pcmcia/cistpl.h> |
52 | #include <pcmcia/ds.h> | 51 | #include <pcmcia/ds.h> |
@@ -84,9 +83,8 @@ static int fdomain_probe(struct pcmcia_device *link) | |||
84 | 83 | ||
85 | info->p_dev = link; | 84 | info->p_dev = link; |
86 | link->priv = info; | 85 | link->priv = info; |
87 | link->io.NumPorts1 = 0x10; | 86 | link->resource[0]->end = 0x10; |
88 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 87 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
89 | link->io.IOAddrLines = 10; | ||
90 | link->conf.Attributes = CONF_ENABLE_IRQ; | 88 | link->conf.Attributes = CONF_ENABLE_IRQ; |
91 | link->conf.IntType = INT_MEMORY_AND_IO; | 89 | link->conf.IntType = INT_MEMORY_AND_IO; |
92 | link->conf.Present = PRESENT_OPTION; | 90 | link->conf.Present = PRESENT_OPTION; |
@@ -113,8 +111,9 @@ static int fdomain_config_check(struct pcmcia_device *p_dev, | |||
113 | unsigned int vcc, | 111 | unsigned int vcc, |
114 | void *priv_data) | 112 | void *priv_data) |
115 | { | 113 | { |
116 | p_dev->io.BasePort1 = cfg->io.win[0].base; | 114 | p_dev->io_lines = 10; |
117 | return pcmcia_request_io(p_dev, &p_dev->io); | 115 | p_dev->resource[0]->start = cfg->io.win[0].base; |
116 | return pcmcia_request_io(p_dev); | ||
118 | } | 117 | } |
119 | 118 | ||
120 | 119 | ||
@@ -138,10 +137,10 @@ static int fdomain_config(struct pcmcia_device *link) | |||
138 | goto failed; | 137 | goto failed; |
139 | 138 | ||
140 | /* A bad hack... */ | 139 | /* A bad hack... */ |
141 | release_region(link->io.BasePort1, link->io.NumPorts1); | 140 | release_region(link->resource[0]->start, resource_size(link->resource[0])); |
142 | 141 | ||
143 | /* Set configuration options for the fdomain driver */ | 142 | /* Set configuration options for the fdomain driver */ |
144 | sprintf(str, "%d,%d", link->io.BasePort1, link->irq); | 143 | sprintf(str, "%d,%d", (unsigned int) link->resource[0]->start, link->irq); |
145 | fdomain_setup(str); | 144 | fdomain_setup(str); |
146 | 145 | ||
147 | host = __fdomain_16x0_detect(&fdomain_driver_template); | 146 | host = __fdomain_16x0_detect(&fdomain_driver_template); |
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index 0f0e112c3f8e..dd9b40306f3d 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
@@ -47,7 +47,6 @@ | |||
47 | #include <scsi/scsi.h> | 47 | #include <scsi/scsi.h> |
48 | #include <scsi/scsi_ioctl.h> | 48 | #include <scsi/scsi_ioctl.h> |
49 | 49 | ||
50 | #include <pcmcia/cs_types.h> | ||
51 | #include <pcmcia/cs.h> | 50 | #include <pcmcia/cs.h> |
52 | #include <pcmcia/cistpl.h> | 51 | #include <pcmcia/cistpl.h> |
53 | #include <pcmcia/cisreg.h> | 52 | #include <pcmcia/cisreg.h> |
@@ -1559,9 +1558,8 @@ static int nsp_cs_probe(struct pcmcia_device *link) | |||
1559 | nsp_dbg(NSP_DEBUG_INIT, "info=0x%p", info); | 1558 | nsp_dbg(NSP_DEBUG_INIT, "info=0x%p", info); |
1560 | 1559 | ||
1561 | /* The io structure describes IO port mapping */ | 1560 | /* The io structure describes IO port mapping */ |
1562 | link->io.NumPorts1 = 0x10; | 1561 | link->resource[0]->end = 0x10; |
1563 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 1562 | link->resource[0]->flags = IO_DATA_PATH_WIDTH_AUTO; |
1564 | link->io.IOAddrLines = 10; /* not used */ | ||
1565 | 1563 | ||
1566 | /* General socket configuration */ | 1564 | /* General socket configuration */ |
1567 | link->conf.Attributes = CONF_ENABLE_IRQ; | 1565 | link->conf.Attributes = CONF_ENABLE_IRQ; |
@@ -1642,29 +1640,27 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, | |||
1642 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 1640 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
1643 | 1641 | ||
1644 | /* IO window settings */ | 1642 | /* IO window settings */ |
1645 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 1643 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
1646 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 1644 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
1647 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 1645 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
1648 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 1646 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; |
1649 | if (!(io->flags & CISTPL_IO_8BIT)) | 1647 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
1650 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 1648 | p_dev->resource[0]->flags |= |
1651 | if (!(io->flags & CISTPL_IO_16BIT)) | 1649 | pcmcia_io_cfg_data_width(io->flags); |
1652 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 1650 | p_dev->resource[0]->start = io->win[0].base; |
1653 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | 1651 | p_dev->resource[0]->end = io->win[0].len; |
1654 | p_dev->io.BasePort1 = io->win[0].base; | ||
1655 | p_dev->io.NumPorts1 = io->win[0].len; | ||
1656 | if (io->nwin > 1) { | 1652 | if (io->nwin > 1) { |
1657 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 1653 | p_dev->resource[1]->flags = |
1658 | p_dev->io.BasePort2 = io->win[1].base; | 1654 | p_dev->resource[0]->flags; |
1659 | p_dev->io.NumPorts2 = io->win[1].len; | 1655 | p_dev->resource[1]->start = io->win[1].base; |
1656 | p_dev->resource[1]->end = io->win[1].len; | ||
1660 | } | 1657 | } |
1661 | /* This reserves IO space but doesn't actually enable it */ | 1658 | /* This reserves IO space but doesn't actually enable it */ |
1662 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | 1659 | if (pcmcia_request_io(p_dev) != 0) |
1663 | goto next_entry; | 1660 | goto next_entry; |
1664 | } | 1661 | } |
1665 | 1662 | ||
1666 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { | 1663 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { |
1667 | memreq_t map; | ||
1668 | cistpl_mem_t *mem = | 1664 | cistpl_mem_t *mem = |
1669 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; | 1665 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; |
1670 | cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; | 1666 | cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; |
@@ -1676,8 +1672,8 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, | |||
1676 | cfg_mem->req.AccessSpeed = 0; | 1672 | cfg_mem->req.AccessSpeed = 0; |
1677 | if (pcmcia_request_window(p_dev, &cfg_mem->req, &p_dev->win) != 0) | 1673 | if (pcmcia_request_window(p_dev, &cfg_mem->req, &p_dev->win) != 0) |
1678 | goto next_entry; | 1674 | goto next_entry; |
1679 | map.Page = 0; map.CardOffset = mem->win[0].card_addr; | 1675 | if (pcmcia_map_mem_page(p_dev, p_dev->win, |
1680 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0) | 1676 | mem->win[0].card_addr) != 0) |
1681 | goto next_entry; | 1677 | goto next_entry; |
1682 | 1678 | ||
1683 | cfg_mem->data->MmioAddress = (unsigned long) ioremap_nocache(cfg_mem->req.Base, cfg_mem->req.Size); | 1679 | cfg_mem->data->MmioAddress = (unsigned long) ioremap_nocache(cfg_mem->req.Base, cfg_mem->req.Size); |
@@ -1720,17 +1716,19 @@ static int nsp_cs_config(struct pcmcia_device *link) | |||
1720 | goto cs_failed; | 1716 | goto cs_failed; |
1721 | 1717 | ||
1722 | if (free_ports) { | 1718 | if (free_ports) { |
1723 | if (link->io.BasePort1) { | 1719 | if (link->resource[0]) { |
1724 | release_region(link->io.BasePort1, link->io.NumPorts1); | 1720 | release_region(link->resource[0]->start, |
1721 | resource_size(link->resource[0])); | ||
1725 | } | 1722 | } |
1726 | if (link->io.BasePort2) { | 1723 | if (link->resource[1]) { |
1727 | release_region(link->io.BasePort2, link->io.NumPorts2); | 1724 | release_region(link->resource[1]->start, |
1725 | resource_size(link->resource[1])); | ||
1728 | } | 1726 | } |
1729 | } | 1727 | } |
1730 | 1728 | ||
1731 | /* Set port and IRQ */ | 1729 | /* Set port and IRQ */ |
1732 | data->BaseAddress = link->io.BasePort1; | 1730 | data->BaseAddress = link->resource[0]->start; |
1733 | data->NumAddress = link->io.NumPorts1; | 1731 | data->NumAddress = resource_size(link->resource[0]); |
1734 | data->IrqNumber = link->irq; | 1732 | data->IrqNumber = link->irq; |
1735 | 1733 | ||
1736 | nsp_dbg(NSP_DEBUG_INIT, "I/O[0x%x+0x%x] IRQ %d", | 1734 | nsp_dbg(NSP_DEBUG_INIT, "I/O[0x%x+0x%x] IRQ %d", |
@@ -1765,13 +1763,10 @@ static int nsp_cs_config(struct pcmcia_device *link) | |||
1765 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | 1763 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
1766 | printk(", irq %d", link->irq); | 1764 | printk(", irq %d", link->irq); |
1767 | } | 1765 | } |
1768 | if (link->io.NumPorts1) { | 1766 | if (link->resource[0]) |
1769 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 1767 | printk(", io %pR", link->resource[0]); |
1770 | link->io.BasePort1+link->io.NumPorts1-1); | 1768 | if (link->resource[1]) |
1771 | } | 1769 | printk(" & %pR", link->resource[1]); |
1772 | if (link->io.NumPorts2) | ||
1773 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
1774 | link->io.BasePort2+link->io.NumPorts2-1); | ||
1775 | if (link->win) | 1770 | if (link->win) |
1776 | printk(", mem 0x%06lx-0x%06lx", cfg_mem->req.Base, | 1771 | printk(", mem 0x%06lx-0x%06lx", cfg_mem->req.Base, |
1777 | cfg_mem->req.Base+cfg_mem->req.Size-1); | 1772 | cfg_mem->req.Base+cfg_mem->req.Size-1); |
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index f0fc6baed9fc..eb775f1a523c 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c | |||
@@ -48,7 +48,6 @@ | |||
48 | #include <scsi/scsi_host.h> | 48 | #include <scsi/scsi_host.h> |
49 | #include "../qlogicfas408.h" | 49 | #include "../qlogicfas408.h" |
50 | 50 | ||
51 | #include <pcmcia/cs_types.h> | ||
52 | #include <pcmcia/cs.h> | 51 | #include <pcmcia/cs.h> |
53 | #include <pcmcia/cistpl.h> | 52 | #include <pcmcia/cistpl.h> |
54 | #include <pcmcia/ds.h> | 53 | #include <pcmcia/ds.h> |
@@ -157,9 +156,8 @@ static int qlogic_probe(struct pcmcia_device *link) | |||
157 | return -ENOMEM; | 156 | return -ENOMEM; |
158 | info->p_dev = link; | 157 | info->p_dev = link; |
159 | link->priv = info; | 158 | link->priv = info; |
160 | link->io.NumPorts1 = 16; | 159 | link->resource[0]->end = 16; |
161 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 160 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
162 | link->io.IOAddrLines = 10; | ||
163 | link->conf.Attributes = CONF_ENABLE_IRQ; | 161 | link->conf.Attributes = CONF_ENABLE_IRQ; |
164 | link->conf.IntType = INT_MEMORY_AND_IO; | 162 | link->conf.IntType = INT_MEMORY_AND_IO; |
165 | link->conf.Present = PRESENT_OPTION; | 163 | link->conf.Present = PRESENT_OPTION; |
@@ -186,13 +184,14 @@ static int qlogic_config_check(struct pcmcia_device *p_dev, | |||
186 | unsigned int vcc, | 184 | unsigned int vcc, |
187 | void *priv_data) | 185 | void *priv_data) |
188 | { | 186 | { |
189 | p_dev->io.BasePort1 = cfg->io.win[0].base; | 187 | p_dev->io_lines = 10; |
190 | p_dev->io.NumPorts1 = cfg->io.win[0].len; | 188 | p_dev->resource[0]->start = cfg->io.win[0].base; |
189 | p_dev->resource[0]->end = cfg->io.win[0].len; | ||
191 | 190 | ||
192 | if (p_dev->io.BasePort1 == 0) | 191 | if (p_dev->resource[0]->start == 0) |
193 | return -ENODEV; | 192 | return -ENODEV; |
194 | 193 | ||
195 | return pcmcia_request_io(p_dev, &p_dev->io); | 194 | return pcmcia_request_io(p_dev); |
196 | } | 195 | } |
197 | 196 | ||
198 | static int qlogic_config(struct pcmcia_device * link) | 197 | static int qlogic_config(struct pcmcia_device * link) |
@@ -216,18 +215,18 @@ static int qlogic_config(struct pcmcia_device * link) | |||
216 | 215 | ||
217 | if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) { | 216 | if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) { |
218 | /* set ATAcmd */ | 217 | /* set ATAcmd */ |
219 | outb(0xb4, link->io.BasePort1 + 0xd); | 218 | outb(0xb4, link->resource[0]->start + 0xd); |
220 | outb(0x24, link->io.BasePort1 + 0x9); | 219 | outb(0x24, link->resource[0]->start + 0x9); |
221 | outb(0x04, link->io.BasePort1 + 0xd); | 220 | outb(0x04, link->resource[0]->start + 0xd); |
222 | } | 221 | } |
223 | 222 | ||
224 | /* The KXL-810AN has a bigger IO port window */ | 223 | /* The KXL-810AN has a bigger IO port window */ |
225 | if (link->io.NumPorts1 == 32) | 224 | if (resource_size(link->resource[0]) == 32) |
226 | host = qlogic_detect(&qlogicfas_driver_template, link, | 225 | host = qlogic_detect(&qlogicfas_driver_template, link, |
227 | link->io.BasePort1 + 16, link->irq); | 226 | link->resource[0]->start + 16, link->irq); |
228 | else | 227 | else |
229 | host = qlogic_detect(&qlogicfas_driver_template, link, | 228 | host = qlogic_detect(&qlogicfas_driver_template, link, |
230 | link->io.BasePort1, link->irq); | 229 | link->resource[0]->start, link->irq); |
231 | 230 | ||
232 | if (!host) { | 231 | if (!host) { |
233 | printk(KERN_INFO "%s: no SCSI devices found\n", qlogic_name); | 232 | printk(KERN_INFO "%s: no SCSI devices found\n", qlogic_name); |
@@ -269,9 +268,9 @@ static int qlogic_resume(struct pcmcia_device *link) | |||
269 | if ((info->manf_id == MANFID_MACNICA) || | 268 | if ((info->manf_id == MANFID_MACNICA) || |
270 | (info->manf_id == MANFID_PIONEER) || | 269 | (info->manf_id == MANFID_PIONEER) || |
271 | (info->manf_id == 0x0098)) { | 270 | (info->manf_id == 0x0098)) { |
272 | outb(0x80, link->io.BasePort1 + 0xd); | 271 | outb(0x80, link->resource[0]->start + 0xd); |
273 | outb(0x24, link->io.BasePort1 + 0x9); | 272 | outb(0x24, link->resource[0]->start + 0x9); |
274 | outb(0x04, link->io.BasePort1 + 0xd); | 273 | outb(0x04, link->resource[0]->start + 0xd); |
275 | } | 274 | } |
276 | /* Ugggglllyyyy!!! */ | 275 | /* Ugggglllyyyy!!! */ |
277 | qlogicfas408_bus_reset(NULL); | 276 | qlogicfas408_bus_reset(NULL); |
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index a51164171179..321e390c9120 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c | |||
@@ -71,7 +71,6 @@ | |||
71 | #include <scsi/scsi.h> | 71 | #include <scsi/scsi.h> |
72 | #include <scsi/scsi_host.h> | 72 | #include <scsi/scsi_host.h> |
73 | 73 | ||
74 | #include <pcmcia/cs_types.h> | ||
75 | #include <pcmcia/cs.h> | 74 | #include <pcmcia/cs.h> |
76 | #include <pcmcia/cistpl.h> | 75 | #include <pcmcia/cistpl.h> |
77 | #include <pcmcia/ds.h> | 76 | #include <pcmcia/ds.h> |
@@ -691,13 +690,14 @@ static int SYM53C500_config_check(struct pcmcia_device *p_dev, | |||
691 | unsigned int vcc, | 690 | unsigned int vcc, |
692 | void *priv_data) | 691 | void *priv_data) |
693 | { | 692 | { |
694 | p_dev->io.BasePort1 = cfg->io.win[0].base; | 693 | p_dev->io_lines = 10; |
695 | p_dev->io.NumPorts1 = cfg->io.win[0].len; | 694 | p_dev->resource[0]->start = cfg->io.win[0].base; |
695 | p_dev->resource[0]->end = cfg->io.win[0].len; | ||
696 | 696 | ||
697 | if (p_dev->io.BasePort1 == 0) | 697 | if (p_dev->resource[0]->start == 0) |
698 | return -ENODEV; | 698 | return -ENODEV; |
699 | 699 | ||
700 | return pcmcia_request_io(p_dev, &p_dev->io); | 700 | return pcmcia_request_io(p_dev); |
701 | } | 701 | } |
702 | 702 | ||
703 | static int | 703 | static int |
@@ -734,9 +734,9 @@ SYM53C500_config(struct pcmcia_device *link) | |||
734 | (info->manf_id == MANFID_PIONEER) || | 734 | (info->manf_id == MANFID_PIONEER) || |
735 | (info->manf_id == 0x0098)) { | 735 | (info->manf_id == 0x0098)) { |
736 | /* set ATAcmd */ | 736 | /* set ATAcmd */ |
737 | outb(0xb4, link->io.BasePort1 + 0xd); | 737 | outb(0xb4, link->resource[0]->start + 0xd); |
738 | outb(0x24, link->io.BasePort1 + 0x9); | 738 | outb(0x24, link->resource[0]->start + 0x9); |
739 | outb(0x04, link->io.BasePort1 + 0xd); | 739 | outb(0x04, link->resource[0]->start + 0xd); |
740 | } | 740 | } |
741 | 741 | ||
742 | /* | 742 | /* |
@@ -749,7 +749,7 @@ SYM53C500_config(struct pcmcia_device *link) | |||
749 | * 0x130, 0x230, 0x280, 0x290, | 749 | * 0x130, 0x230, 0x280, 0x290, |
750 | * 0x320, 0x330, 0x340, 0x350 | 750 | * 0x320, 0x330, 0x340, 0x350 |
751 | */ | 751 | */ |
752 | port_base = link->io.BasePort1; | 752 | port_base = link->resource[0]->start; |
753 | irq_level = link->irq; | 753 | irq_level = link->irq; |
754 | 754 | ||
755 | DEB(printk("SYM53C500: port_base=0x%x, irq=%d, fast_pio=%d\n", | 755 | DEB(printk("SYM53C500: port_base=0x%x, irq=%d, fast_pio=%d\n", |
@@ -822,15 +822,15 @@ static int sym53c500_resume(struct pcmcia_device *link) | |||
822 | if ((info->manf_id == MANFID_MACNICA) || | 822 | if ((info->manf_id == MANFID_MACNICA) || |
823 | (info->manf_id == MANFID_PIONEER) || | 823 | (info->manf_id == MANFID_PIONEER) || |
824 | (info->manf_id == 0x0098)) { | 824 | (info->manf_id == 0x0098)) { |
825 | outb(0x80, link->io.BasePort1 + 0xd); | 825 | outb(0x80, link->resource[0]->start + 0xd); |
826 | outb(0x24, link->io.BasePort1 + 0x9); | 826 | outb(0x24, link->resource[0]->start + 0x9); |
827 | outb(0x04, link->io.BasePort1 + 0xd); | 827 | outb(0x04, link->resource[0]->start + 0xd); |
828 | } | 828 | } |
829 | /* | 829 | /* |
830 | * If things don't work after a "resume", | 830 | * If things don't work after a "resume", |
831 | * this is a good place to start looking. | 831 | * this is a good place to start looking. |
832 | */ | 832 | */ |
833 | SYM53C500_int_host_reset(link->io.BasePort1); | 833 | SYM53C500_int_host_reset(link->resource[0]->start); |
834 | 834 | ||
835 | return 0; | 835 | return 0; |
836 | } | 836 | } |
@@ -859,9 +859,8 @@ SYM53C500_probe(struct pcmcia_device *link) | |||
859 | return -ENOMEM; | 859 | return -ENOMEM; |
860 | info->p_dev = link; | 860 | info->p_dev = link; |
861 | link->priv = info; | 861 | link->priv = info; |
862 | link->io.NumPorts1 = 16; | 862 | link->resource[0]->end = 16; |
863 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 863 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
864 | link->io.IOAddrLines = 10; | ||
865 | link->conf.Attributes = CONF_ENABLE_IRQ; | 864 | link->conf.Attributes = CONF_ENABLE_IRQ; |
866 | link->conf.IntType = INT_MEMORY_AND_IO; | 865 | link->conf.IntType = INT_MEMORY_AND_IO; |
867 | 866 | ||
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index ab17c08ddc03..141c69554bd4 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <asm/io.h> | 45 | #include <asm/io.h> |
46 | #include <asm/system.h> | 46 | #include <asm/system.h> |
47 | 47 | ||
48 | #include <pcmcia/cs_types.h> | ||
49 | #include <pcmcia/cs.h> | 48 | #include <pcmcia/cs.h> |
50 | #include <pcmcia/cistpl.h> | 49 | #include <pcmcia/cistpl.h> |
51 | #include <pcmcia/ciscode.h> | 50 | #include <pcmcia/ciscode.h> |
@@ -115,16 +114,14 @@ static void quirk_setup_brainboxes_0104(struct pcmcia_device *link, struct uart_ | |||
115 | 114 | ||
116 | static int quirk_post_ibm(struct pcmcia_device *link) | 115 | static int quirk_post_ibm(struct pcmcia_device *link) |
117 | { | 116 | { |
118 | conf_reg_t reg = { 0, CS_READ, 0x800, 0 }; | 117 | u8 val; |
119 | int ret; | 118 | int ret; |
120 | 119 | ||
121 | ret = pcmcia_access_configuration_register(link, ®); | 120 | ret = pcmcia_read_config_byte(link, 0x800, &val); |
122 | if (ret) | 121 | if (ret) |
123 | goto failed; | 122 | goto failed; |
124 | 123 | ||
125 | reg.Action = CS_WRITE; | 124 | ret = pcmcia_write_config_byte(link, 0x800, val | 1); |
126 | reg.Value = reg.Value | 1; | ||
127 | ret = pcmcia_access_configuration_register(link, ®); | ||
128 | if (ret) | 125 | if (ret) |
129 | goto failed; | 126 | goto failed; |
130 | return 0; | 127 | return 0; |
@@ -338,8 +335,8 @@ static int serial_probe(struct pcmcia_device *link) | |||
338 | info->p_dev = link; | 335 | info->p_dev = link; |
339 | link->priv = info; | 336 | link->priv = info; |
340 | 337 | ||
341 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 338 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
342 | link->io.NumPorts1 = 8; | 339 | link->resource[0]->end = 8; |
343 | link->conf.Attributes = CONF_ENABLE_IRQ; | 340 | link->conf.Attributes = CONF_ENABLE_IRQ; |
344 | if (do_sound) { | 341 | if (do_sound) { |
345 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 342 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
@@ -427,12 +424,13 @@ static int simple_config_check(struct pcmcia_device *p_dev, | |||
427 | p_dev->conf.Vpp = | 424 | p_dev->conf.Vpp = |
428 | cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; | 425 | cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; |
429 | 426 | ||
427 | p_dev->io_lines = ((*try & 0x1) == 0) ? | ||
428 | 16 : cf->io.flags & CISTPL_IO_LINES_MASK; | ||
429 | |||
430 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[(*try >> 1)]) | 430 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[(*try >> 1)]) |
431 | && (cf->io.win[0].base != 0)) { | 431 | && (cf->io.win[0].base != 0)) { |
432 | p_dev->io.BasePort1 = cf->io.win[0].base; | 432 | p_dev->resource[0]->start = cf->io.win[0].base; |
433 | p_dev->io.IOAddrLines = ((*try & 0x1) == 0) ? | 433 | if (!pcmcia_request_io(p_dev)) |
434 | 16 : cf->io.flags & CISTPL_IO_LINES_MASK; | ||
435 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | ||
436 | return 0; | 434 | return 0; |
437 | } | 435 | } |
438 | return -EINVAL; | 436 | return -EINVAL; |
@@ -449,9 +447,9 @@ static int simple_config_check_notpicky(struct pcmcia_device *p_dev, | |||
449 | 447 | ||
450 | if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { | 448 | if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { |
451 | for (j = 0; j < 5; j++) { | 449 | for (j = 0; j < 5; j++) { |
452 | p_dev->io.BasePort1 = base[j]; | 450 | p_dev->resource[0]->start = base[j]; |
453 | p_dev->io.IOAddrLines = base[j] ? 16 : 3; | 451 | p_dev->io_lines = base[j] ? 16 : 3; |
454 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | 452 | if (!pcmcia_request_io(p_dev)) |
455 | return 0; | 453 | return 0; |
456 | } | 454 | } |
457 | } | 455 | } |
@@ -466,13 +464,13 @@ static int simple_config(struct pcmcia_device *link) | |||
466 | /* If the card is already configured, look up the port and irq */ | 464 | /* If the card is already configured, look up the port and irq */ |
467 | if (link->function_config) { | 465 | if (link->function_config) { |
468 | unsigned int port = 0; | 466 | unsigned int port = 0; |
469 | if ((link->io.BasePort2 != 0) && | 467 | if ((link->resource[1]->end != 0) && |
470 | (link->io.NumPorts2 == 8)) { | 468 | (resource_size(link->resource[1]) == 8)) { |
471 | port = link->io.BasePort2; | 469 | port = link->resource[1]->end; |
472 | info->slave = 1; | 470 | info->slave = 1; |
473 | } else if ((info->manfid == MANFID_OSITECH) && | 471 | } else if ((info->manfid == MANFID_OSITECH) && |
474 | (link->io.NumPorts1 == 0x40)) { | 472 | (resource_size(link->resource[0]) == 0x40)) { |
475 | port = link->io.BasePort1 + 0x28; | 473 | port = link->resource[0]->start + 0x28; |
476 | info->slave = 1; | 474 | info->slave = 1; |
477 | } | 475 | } |
478 | if (info->slave) { | 476 | if (info->slave) { |
@@ -510,7 +508,7 @@ found_port: | |||
510 | i = pcmcia_request_configuration(link, &link->conf); | 508 | i = pcmcia_request_configuration(link, &link->conf); |
511 | if (i != 0) | 509 | if (i != 0) |
512 | return -1; | 510 | return -1; |
513 | return setup_serial(link, info, link->io.BasePort1, link->irq); | 511 | return setup_serial(link, info, link->resource[0]->start, link->irq); |
514 | } | 512 | } |
515 | 513 | ||
516 | static int multi_config_check(struct pcmcia_device *p_dev, | 514 | static int multi_config_check(struct pcmcia_device *p_dev, |
@@ -524,10 +522,10 @@ static int multi_config_check(struct pcmcia_device *p_dev, | |||
524 | /* The quad port cards have bad CIS's, so just look for a | 522 | /* The quad port cards have bad CIS's, so just look for a |
525 | window larger than 8 ports and assume it will be right */ | 523 | window larger than 8 ports and assume it will be right */ |
526 | if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { | 524 | if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { |
527 | p_dev->io.BasePort1 = cf->io.win[0].base; | 525 | p_dev->resource[0]->start = cf->io.win[0].base; |
528 | p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; | 526 | p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; |
529 | if (!pcmcia_request_io(p_dev, &p_dev->io)) { | 527 | if (!pcmcia_request_io(p_dev)) { |
530 | *base2 = p_dev->io.BasePort1 + 8; | 528 | *base2 = p_dev->resource[0]->start + 8; |
531 | return 0; | 529 | return 0; |
532 | } | 530 | } |
533 | } | 531 | } |
@@ -543,11 +541,11 @@ static int multi_config_check_notpicky(struct pcmcia_device *p_dev, | |||
543 | int *base2 = priv_data; | 541 | int *base2 = priv_data; |
544 | 542 | ||
545 | if (cf->io.nwin == 2) { | 543 | if (cf->io.nwin == 2) { |
546 | p_dev->io.BasePort1 = cf->io.win[0].base; | 544 | p_dev->resource[0]->start = cf->io.win[0].base; |
547 | p_dev->io.BasePort2 = cf->io.win[1].base; | 545 | p_dev->resource[1]->start = cf->io.win[1].base; |
548 | p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; | 546 | p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; |
549 | if (!pcmcia_request_io(p_dev, &p_dev->io)) { | 547 | if (!pcmcia_request_io(p_dev)) { |
550 | *base2 = p_dev->io.BasePort2; | 548 | *base2 = p_dev->resource[1]->start; |
551 | return 0; | 549 | return 0; |
552 | } | 550 | } |
553 | } | 551 | } |
@@ -560,10 +558,10 @@ static int multi_config(struct pcmcia_device *link) | |||
560 | int i, base2 = 0; | 558 | int i, base2 = 0; |
561 | 559 | ||
562 | /* First, look for a generic full-sized window */ | 560 | /* First, look for a generic full-sized window */ |
563 | link->io.NumPorts1 = info->multi * 8; | 561 | link->resource[0]->end = info->multi * 8; |
564 | if (pcmcia_loop_config(link, multi_config_check, &base2)) { | 562 | if (pcmcia_loop_config(link, multi_config_check, &base2)) { |
565 | /* If that didn't work, look for two windows */ | 563 | /* If that didn't work, look for two windows */ |
566 | link->io.NumPorts1 = link->io.NumPorts2 = 8; | 564 | link->resource[0]->end = link->resource[1]->end = 8; |
567 | info->multi = 2; | 565 | info->multi = 2; |
568 | if (pcmcia_loop_config(link, multi_config_check_notpicky, | 566 | if (pcmcia_loop_config(link, multi_config_check_notpicky, |
569 | &base2)) { | 567 | &base2)) { |
@@ -599,9 +597,9 @@ static int multi_config(struct pcmcia_device *link) | |||
599 | link->conf.ConfigIndex == 3) { | 597 | link->conf.ConfigIndex == 3) { |
600 | err = setup_serial(link, info, base2, | 598 | err = setup_serial(link, info, base2, |
601 | link->irq); | 599 | link->irq); |
602 | base2 = link->io.BasePort1; | 600 | base2 = link->resource[0]->start;; |
603 | } else { | 601 | } else { |
604 | err = setup_serial(link, info, link->io.BasePort1, | 602 | err = setup_serial(link, info, link->resource[0]->start, |
605 | link->irq); | 603 | link->irq); |
606 | } | 604 | } |
607 | info->c950ctrl = base2; | 605 | info->c950ctrl = base2; |
@@ -616,7 +614,7 @@ static int multi_config(struct pcmcia_device *link) | |||
616 | return 0; | 614 | return 0; |
617 | } | 615 | } |
618 | 616 | ||
619 | setup_serial(link, info, link->io.BasePort1, link->irq); | 617 | setup_serial(link, info, link->resource[0]->start, link->irq); |
620 | for (i = 0; i < info->multi - 1; i++) | 618 | for (i = 0; i < info->multi - 1; i++) |
621 | setup_serial(link, info, base2 + (8 * i), | 619 | setup_serial(link, info, base2 + (8 * i), |
622 | link->irq); | 620 | link->irq); |
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index 7cee7f4eb60b..7892ac163522 100644 --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/mmc/sdio_func.h> | 20 | #include <linux/mmc/sdio_func.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | 22 | ||
23 | #include <pcmcia/cs_types.h> | ||
24 | #include <pcmcia/cs.h> | 23 | #include <pcmcia/cs.h> |
25 | #include <pcmcia/cistpl.h> | 24 | #include <pcmcia/cistpl.h> |
26 | #include <pcmcia/ds.h> | 25 | #include <pcmcia/ds.h> |
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c index e72f4046a5e0..526682d68de8 100644 --- a/drivers/ssb/pcmcia.c +++ b/drivers/ssb/pcmcia.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/io.h> | 13 | #include <linux/io.h> |
14 | #include <linux/etherdevice.h> | 14 | #include <linux/etherdevice.h> |
15 | 15 | ||
16 | #include <pcmcia/cs_types.h> | ||
17 | #include <pcmcia/cs.h> | 16 | #include <pcmcia/cs.h> |
18 | #include <pcmcia/cistpl.h> | 17 | #include <pcmcia/cistpl.h> |
19 | #include <pcmcia/ciscode.h> | 18 | #include <pcmcia/ciscode.h> |
@@ -72,14 +71,9 @@ | |||
72 | /* Write to a PCMCIA configuration register. */ | 71 | /* Write to a PCMCIA configuration register. */ |
73 | static int ssb_pcmcia_cfg_write(struct ssb_bus *bus, u8 offset, u8 value) | 72 | static int ssb_pcmcia_cfg_write(struct ssb_bus *bus, u8 offset, u8 value) |
74 | { | 73 | { |
75 | conf_reg_t reg; | ||
76 | int res; | 74 | int res; |
77 | 75 | ||
78 | memset(®, 0, sizeof(reg)); | 76 | res = pcmcia_write_config_byte(bus->host_pcmcia, offset, value); |
79 | reg.Offset = offset; | ||
80 | reg.Action = CS_WRITE; | ||
81 | reg.Value = value; | ||
82 | res = pcmcia_access_configuration_register(bus->host_pcmcia, ®); | ||
83 | if (unlikely(res != 0)) | 77 | if (unlikely(res != 0)) |
84 | return -EBUSY; | 78 | return -EBUSY; |
85 | 79 | ||
@@ -89,16 +83,11 @@ static int ssb_pcmcia_cfg_write(struct ssb_bus *bus, u8 offset, u8 value) | |||
89 | /* Read from a PCMCIA configuration register. */ | 83 | /* Read from a PCMCIA configuration register. */ |
90 | static int ssb_pcmcia_cfg_read(struct ssb_bus *bus, u8 offset, u8 *value) | 84 | static int ssb_pcmcia_cfg_read(struct ssb_bus *bus, u8 offset, u8 *value) |
91 | { | 85 | { |
92 | conf_reg_t reg; | ||
93 | int res; | 86 | int res; |
94 | 87 | ||
95 | memset(®, 0, sizeof(reg)); | 88 | res = pcmcia_read_config_byte(bus->host_pcmcia, offset, value); |
96 | reg.Offset = offset; | ||
97 | reg.Action = CS_READ; | ||
98 | res = pcmcia_access_configuration_register(bus->host_pcmcia, ®); | ||
99 | if (unlikely(res != 0)) | 89 | if (unlikely(res != 0)) |
100 | return -EBUSY; | 90 | return -EBUSY; |
101 | *value = reg.Value; | ||
102 | 91 | ||
103 | return 0; | 92 | return 0; |
104 | } | 93 | } |
diff --git a/drivers/ssb/scan.c b/drivers/ssb/scan.c index 0d6c0280eb34..9738cad4ba13 100644 --- a/drivers/ssb/scan.c +++ b/drivers/ssb/scan.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/pci.h> | 17 | #include <linux/pci.h> |
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | 19 | ||
20 | #include <pcmcia/cs_types.h> | ||
21 | #include <pcmcia/cs.h> | 20 | #include <pcmcia/cs.h> |
22 | #include <pcmcia/cistpl.h> | 21 | #include <pcmcia/cistpl.h> |
23 | #include <pcmcia/ds.h> | 22 | #include <pcmcia/ds.h> |
diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 6d893c65adc8..f8ede1182ccc 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c | |||
@@ -37,7 +37,6 @@ Status: experimental | |||
37 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
38 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
39 | 39 | ||
40 | #include <pcmcia/cs_types.h> | ||
41 | #include <pcmcia/cs.h> | 40 | #include <pcmcia/cs.h> |
42 | #include <pcmcia/cistpl.h> | 41 | #include <pcmcia/cistpl.h> |
43 | #include <pcmcia/ds.h> | 42 | #include <pcmcia/ds.h> |
@@ -171,7 +170,7 @@ static int das16cs_attach(struct comedi_device *dev, | |||
171 | if (!link) | 170 | if (!link) |
172 | return -EIO; | 171 | return -EIO; |
173 | 172 | ||
174 | dev->iobase = link->io.BasePort1; | 173 | dev->iobase = link->resource[0]->start;; |
175 | printk("I/O base=0x%04lx ", dev->iobase); | 174 | printk("I/O base=0x%04lx ", dev->iobase); |
176 | 175 | ||
177 | printk("fingerprint:\n"); | 176 | printk("fingerprint:\n"); |
@@ -662,14 +661,6 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *); | |||
662 | less on other parts of the kernel. | 661 | less on other parts of the kernel. |
663 | */ | 662 | */ |
664 | 663 | ||
665 | /* | ||
666 | The dev_info variable is the "key" that is used to match up this | ||
667 | device driver with appropriate cards, through the card configuration | ||
668 | database. | ||
669 | */ | ||
670 | |||
671 | static dev_info_t dev_info = "cb_das16_cs"; | ||
672 | |||
673 | struct local_info_t { | 664 | struct local_info_t { |
674 | struct pcmcia_device *link; | 665 | struct pcmcia_device *link; |
675 | int stop; | 666 | int stop; |
@@ -736,24 +727,22 @@ static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
736 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 727 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
737 | 728 | ||
738 | /* IO window settings */ | 729 | /* IO window settings */ |
739 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 730 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
740 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 731 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
741 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 732 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
742 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 733 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; |
743 | if (!(io->flags & CISTPL_IO_8BIT)) | 734 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
744 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 735 | p_dev->resource[0]->flags |= |
745 | if (!(io->flags & CISTPL_IO_16BIT)) | 736 | pcmcia_io_cfg_data_width(io->flags); |
746 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 737 | p_dev->resource[0]->start = io->win[0].base; |
747 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | 738 | p_dev->resource[0]->end = io->win[0].len; |
748 | p_dev->io.BasePort1 = io->win[0].base; | ||
749 | p_dev->io.NumPorts1 = io->win[0].len; | ||
750 | if (io->nwin > 1) { | 739 | if (io->nwin > 1) { |
751 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 740 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
752 | p_dev->io.BasePort2 = io->win[1].base; | 741 | p_dev->resource[1]->start = io->win[1].base; |
753 | p_dev->io.NumPorts2 = io->win[1].len; | 742 | p_dev->resource[1]->end = io->win[1].len; |
754 | } | 743 | } |
755 | /* This reserves IO space but doesn't actually enable it */ | 744 | /* This reserves IO space but doesn't actually enable it */ |
756 | return pcmcia_request_io(p_dev, &p_dev->io); | 745 | return pcmcia_request_io(p_dev); |
757 | } | 746 | } |
758 | 747 | ||
759 | return 0; | 748 | return 0; |
@@ -787,12 +776,10 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) | |||
787 | dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); | 776 | dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); |
788 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 777 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
789 | printk(", irq %u", link->irq); | 778 | printk(", irq %u", link->irq); |
790 | if (link->io.NumPorts1) | 779 | if (link->resource[0]) |
791 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 780 | printk(", io %pR", link->resource[0]); |
792 | link->io.BasePort1 + link->io.NumPorts1 - 1); | 781 | if (link->resource[1]) |
793 | if (link->io.NumPorts2) | 782 | printk(", io %pR", link->resource[1]); |
794 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
795 | link->io.BasePort2 + link->io.NumPorts2 - 1); | ||
796 | printk("\n"); | 783 | printk("\n"); |
797 | 784 | ||
798 | return; | 785 | return; |
@@ -846,7 +833,7 @@ struct pcmcia_driver das16cs_driver = { | |||
846 | .id_table = das16cs_id_table, | 833 | .id_table = das16cs_id_table, |
847 | .owner = THIS_MODULE, | 834 | .owner = THIS_MODULE, |
848 | .drv = { | 835 | .drv = { |
849 | .name = dev_info, | 836 | .name = "cb_das16_cs", |
850 | }, | 837 | }, |
851 | }; | 838 | }; |
852 | 839 | ||
diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index fb561ab7f07c..c6aa52f8dcee 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c | |||
@@ -48,7 +48,6 @@ Command support does not exist, but could be added for this board. | |||
48 | #include "das08.h" | 48 | #include "das08.h" |
49 | 49 | ||
50 | /* pcmcia includes */ | 50 | /* pcmcia includes */ |
51 | #include <pcmcia/cs_types.h> | ||
52 | #include <pcmcia/cs.h> | 51 | #include <pcmcia/cs.h> |
53 | #include <pcmcia/cistpl.h> | 52 | #include <pcmcia/cistpl.h> |
54 | #include <pcmcia/ds.h> | 53 | #include <pcmcia/ds.h> |
@@ -89,7 +88,7 @@ static int das08_cs_attach(struct comedi_device *dev, | |||
89 | printk(" no pcmcia cards found\n"); | 88 | printk(" no pcmcia cards found\n"); |
90 | return -EIO; | 89 | return -EIO; |
91 | } | 90 | } |
92 | iobase = link->io.BasePort1; | 91 | iobase = link->resource[0]->start; |
93 | } else { | 92 | } else { |
94 | printk(" bug! board does not have PCMCIA bustype\n"); | 93 | printk(" bug! board does not have PCMCIA bustype\n"); |
95 | return -EINVAL; | 94 | return -EINVAL; |
@@ -132,14 +131,6 @@ static void das08_pcmcia_detach(struct pcmcia_device *); | |||
132 | less on other parts of the kernel. | 131 | less on other parts of the kernel. |
133 | */ | 132 | */ |
134 | 133 | ||
135 | /* | ||
136 | The dev_info variable is the "key" that is used to match up this | ||
137 | device driver with appropriate cards, through the card configuration | ||
138 | database. | ||
139 | */ | ||
140 | |||
141 | static const dev_info_t dev_info = "pcm-das08"; | ||
142 | |||
143 | struct local_info_t { | 134 | struct local_info_t { |
144 | struct pcmcia_device *link; | 135 | struct pcmcia_device *link; |
145 | int stop; | 136 | int stop; |
@@ -224,24 +215,23 @@ static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
224 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 215 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
225 | 216 | ||
226 | /* IO window settings */ | 217 | /* IO window settings */ |
227 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 218 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
228 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 219 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
229 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 220 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
230 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 221 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; |
231 | if (!(io->flags & CISTPL_IO_8BIT)) | 222 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
232 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 223 | p_dev->resource[0]->flags |= |
233 | if (!(io->flags & CISTPL_IO_16BIT)) | 224 | pcmcia_io_cfg_data_width(io->flags); |
234 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
235 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | 225 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; |
236 | p_dev->io.BasePort1 = io->win[0].base; | 226 | p_dev->resource[0]->start = io->win[0].base; |
237 | p_dev->io.NumPorts1 = io->win[0].len; | 227 | p_dev->resource[0]->end = io->win[0].len; |
238 | if (io->nwin > 1) { | 228 | if (io->nwin > 1) { |
239 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 229 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
240 | p_dev->io.BasePort2 = io->win[1].base; | 230 | p_dev->resource[1]->start = io->win[1].base; |
241 | p_dev->io.NumPorts2 = io->win[1].len; | 231 | p_dev->resource[1]->end = io->win[1].len; |
242 | } | 232 | } |
243 | /* This reserves IO space but doesn't actually enable it */ | 233 | /* This reserves IO space but doesn't actually enable it */ |
244 | return pcmcia_request_io(p_dev, &p_dev->io); | 234 | return pcmcia_request_io(p_dev); |
245 | } | 235 | } |
246 | return 0; | 236 | return 0; |
247 | } | 237 | } |
@@ -283,12 +273,10 @@ static void das08_pcmcia_config(struct pcmcia_device *link) | |||
283 | dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); | 273 | dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); |
284 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 274 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
285 | printk(", irq %u", link->irq); | 275 | printk(", irq %u", link->irq); |
286 | if (link->io.NumPorts1) | 276 | if (link->resource[0]) |
287 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 277 | printk(", io %pR", link->resource[0]); |
288 | link->io.BasePort1 + link->io.NumPorts1 - 1); | 278 | if (link->resource[1]) |
289 | if (link->io.NumPorts2) | 279 | printk(" & %pR", link->resource[1]); |
290 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
291 | link->io.BasePort2 + link->io.NumPorts2 - 1); | ||
292 | printk("\n"); | 280 | printk("\n"); |
293 | 281 | ||
294 | return; | 282 | return; |
@@ -362,7 +350,7 @@ struct pcmcia_driver das08_cs_driver = { | |||
362 | .id_table = das08_cs_id_table, | 350 | .id_table = das08_cs_id_table, |
363 | .owner = THIS_MODULE, | 351 | .owner = THIS_MODULE, |
364 | .drv = { | 352 | .drv = { |
365 | .name = dev_info, | 353 | .name = "pcm-das08", |
366 | }, | 354 | }, |
367 | }; | 355 | }; |
368 | 356 | ||
diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 701abd9eabe6..cc15666e5cc1 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c | |||
@@ -47,7 +47,6 @@ IRQ is assigned but not used. | |||
47 | 47 | ||
48 | #include <linux/ioport.h> | 48 | #include <linux/ioport.h> |
49 | 49 | ||
50 | #include <pcmcia/cs_types.h> | ||
51 | #include <pcmcia/cs.h> | 50 | #include <pcmcia/cs.h> |
52 | #include <pcmcia/cistpl.h> | 51 | #include <pcmcia/cistpl.h> |
53 | #include <pcmcia/cisreg.h> | 52 | #include <pcmcia/cisreg.h> |
@@ -377,7 +376,7 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
377 | link = pcmcia_cur_dev; /* XXX hack */ | 376 | link = pcmcia_cur_dev; /* XXX hack */ |
378 | if (!link) | 377 | if (!link) |
379 | return -EIO; | 378 | return -EIO; |
380 | iobase = link->io.BasePort1; | 379 | iobase = link->resource[0]->start; |
381 | #ifdef incomplete | 380 | #ifdef incomplete |
382 | irq = link->irq; | 381 | irq = link->irq; |
383 | #endif | 382 | #endif |
@@ -459,14 +458,6 @@ static void dio700_cs_detach(struct pcmcia_device *); | |||
459 | less on other parts of the kernel. | 458 | less on other parts of the kernel. |
460 | */ | 459 | */ |
461 | 460 | ||
462 | /* | ||
463 | The dev_info variable is the "key" that is used to match up this | ||
464 | device driver with appropriate cards, through the card configuration | ||
465 | database. | ||
466 | */ | ||
467 | |||
468 | static const dev_info_t dev_info = "ni_daq_700"; | ||
469 | |||
470 | struct local_info_t { | 461 | struct local_info_t { |
471 | struct pcmcia_device *link; | 462 | struct pcmcia_device *link; |
472 | int stop; | 463 | int stop; |
@@ -555,9 +546,6 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
555 | unsigned int vcc, | 546 | unsigned int vcc, |
556 | void *priv_data) | 547 | void *priv_data) |
557 | { | 548 | { |
558 | win_req_t *req = priv_data; | ||
559 | memreq_t map; | ||
560 | |||
561 | if (cfg->index == 0) | 549 | if (cfg->index == 0) |
562 | return -ENODEV; | 550 | return -ENODEV; |
563 | 551 | ||
@@ -571,44 +559,25 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
571 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 559 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
572 | 560 | ||
573 | /* IO window settings */ | 561 | /* IO window settings */ |
574 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 562 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
575 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 563 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
576 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 564 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
577 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 565 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; |
578 | if (!(io->flags & CISTPL_IO_8BIT)) | 566 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
579 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 567 | p_dev->resource[0]->flags |= |
580 | if (!(io->flags & CISTPL_IO_16BIT)) | 568 | pcmcia_io_cfg_data_width(io->flags); |
581 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 569 | p_dev->resource[0]->start = io->win[0].base; |
582 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | 570 | p_dev->resource[0]->end = io->win[0].len; |
583 | p_dev->io.BasePort1 = io->win[0].base; | ||
584 | p_dev->io.NumPorts1 = io->win[0].len; | ||
585 | if (io->nwin > 1) { | 571 | if (io->nwin > 1) { |
586 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 572 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
587 | p_dev->io.BasePort2 = io->win[1].base; | 573 | p_dev->resource[1]->start = io->win[1].base; |
588 | p_dev->io.NumPorts2 = io->win[1].len; | 574 | p_dev->resource[1]->end = io->win[1].len; |
589 | } | 575 | } |
590 | /* This reserves IO space but doesn't actually enable it */ | 576 | /* This reserves IO space but doesn't actually enable it */ |
591 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | 577 | if (pcmcia_request_io(p_dev) != 0) |
592 | return -ENODEV; | 578 | return -ENODEV; |
593 | } | 579 | } |
594 | 580 | ||
595 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { | ||
596 | cistpl_mem_t *mem = | ||
597 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; | ||
598 | req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; | ||
599 | req->Attributes |= WIN_ENABLE; | ||
600 | req->Base = mem->win[0].host_addr; | ||
601 | req->Size = mem->win[0].len; | ||
602 | if (req->Size < 0x1000) | ||
603 | req->Size = 0x1000; | ||
604 | req->AccessSpeed = 0; | ||
605 | if (pcmcia_request_window(p_dev, req, &p_dev->win)) | ||
606 | return -ENODEV; | ||
607 | map.Page = 0; | ||
608 | map.CardOffset = mem->win[0].card_addr; | ||
609 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map)) | ||
610 | return -ENODEV; | ||
611 | } | ||
612 | /* If we got this far, we're cool! */ | 581 | /* If we got this far, we're cool! */ |
613 | return 0; | 582 | return 0; |
614 | } | 583 | } |
@@ -622,7 +591,7 @@ static void dio700_config(struct pcmcia_device *link) | |||
622 | 591 | ||
623 | dev_dbg(&link->dev, "dio700_config\n"); | 592 | dev_dbg(&link->dev, "dio700_config\n"); |
624 | 593 | ||
625 | ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, &req); | 594 | ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, NULL); |
626 | if (ret) { | 595 | if (ret) { |
627 | dev_warn(&link->dev, "no configuration found\n"); | 596 | dev_warn(&link->dev, "no configuration found\n"); |
628 | goto failed; | 597 | goto failed; |
@@ -644,15 +613,10 @@ static void dio700_config(struct pcmcia_device *link) | |||
644 | dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); | 613 | dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); |
645 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 614 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
646 | printk(", irq %d", link->irq); | 615 | printk(", irq %d", link->irq); |
647 | if (link->io.NumPorts1) | 616 | if (link->resource[0]) |
648 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 617 | printk(", io %pR", link->resource[0]); |
649 | link->io.BasePort1 + link->io.NumPorts1 - 1); | 618 | if (link->resource[1]) |
650 | if (link->io.NumPorts2) | 619 | printk(" & %pR", link->resource[1]); |
651 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
652 | link->io.BasePort2 + link->io.NumPorts2 - 1); | ||
653 | if (link->win) | ||
654 | printk(", mem 0x%06lx-0x%06lx", req.Base, | ||
655 | req.Base + req.Size - 1); | ||
656 | printk("\n"); | 620 | printk("\n"); |
657 | 621 | ||
658 | return; | 622 | return; |
@@ -722,7 +686,7 @@ struct pcmcia_driver dio700_cs_driver = { | |||
722 | .id_table = dio700_cs_ids, | 686 | .id_table = dio700_cs_ids, |
723 | .owner = THIS_MODULE, | 687 | .owner = THIS_MODULE, |
724 | .drv = { | 688 | .drv = { |
725 | .name = dev_info, | 689 | .name = "ni_daq_700", |
726 | }, | 690 | }, |
727 | }; | 691 | }; |
728 | 692 | ||
diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index 0b65f247d5dd..773ae2044e0e 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c | |||
@@ -48,7 +48,6 @@ the PCMCIA interface. | |||
48 | 48 | ||
49 | #include "8255.h" | 49 | #include "8255.h" |
50 | 50 | ||
51 | #include <pcmcia/cs_types.h> | ||
52 | #include <pcmcia/cs.h> | 51 | #include <pcmcia/cs.h> |
53 | #include <pcmcia/cistpl.h> | 52 | #include <pcmcia/cistpl.h> |
54 | #include <pcmcia/cisreg.h> | 53 | #include <pcmcia/cisreg.h> |
@@ -129,7 +128,7 @@ static int dio24_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
129 | link = pcmcia_cur_dev; /* XXX hack */ | 128 | link = pcmcia_cur_dev; /* XXX hack */ |
130 | if (!link) | 129 | if (!link) |
131 | return -EIO; | 130 | return -EIO; |
132 | iobase = link->io.BasePort1; | 131 | iobase = link->resource[0]->start; |
133 | #ifdef incomplete | 132 | #ifdef incomplete |
134 | irq = link->irq; | 133 | irq = link->irq; |
135 | #endif | 134 | #endif |
@@ -211,14 +210,6 @@ static void dio24_cs_detach(struct pcmcia_device *); | |||
211 | less on other parts of the kernel. | 210 | less on other parts of the kernel. |
212 | */ | 211 | */ |
213 | 212 | ||
214 | /* | ||
215 | The dev_info variable is the "key" that is used to match up this | ||
216 | device driver with appropriate cards, through the card configuration | ||
217 | database. | ||
218 | */ | ||
219 | |||
220 | static const dev_info_t dev_info = "ni_daq_dio24"; | ||
221 | |||
222 | struct local_info_t { | 213 | struct local_info_t { |
223 | struct pcmcia_device *link; | 214 | struct pcmcia_device *link; |
224 | int stop; | 215 | int stop; |
@@ -307,9 +298,6 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
307 | unsigned int vcc, | 298 | unsigned int vcc, |
308 | void *priv_data) | 299 | void *priv_data) |
309 | { | 300 | { |
310 | win_req_t *req = priv_data; | ||
311 | memreq_t map; | ||
312 | |||
313 | if (cfg->index == 0) | 301 | if (cfg->index == 0) |
314 | return -ENODEV; | 302 | return -ENODEV; |
315 | 303 | ||
@@ -323,44 +311,25 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
323 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 311 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
324 | 312 | ||
325 | /* IO window settings */ | 313 | /* IO window settings */ |
326 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 314 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
327 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 315 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
328 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 316 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
329 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 317 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; |
330 | if (!(io->flags & CISTPL_IO_8BIT)) | 318 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
331 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 319 | p_dev->resource[0]->flags |= |
332 | if (!(io->flags & CISTPL_IO_16BIT)) | 320 | pcmcia_io_cfg_data_width(io->flags); |
333 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 321 | p_dev->resource[0]->start = io->win[0].base; |
334 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | 322 | p_dev->resource[0]->end = io->win[0].len; |
335 | p_dev->io.BasePort1 = io->win[0].base; | ||
336 | p_dev->io.NumPorts1 = io->win[0].len; | ||
337 | if (io->nwin > 1) { | 323 | if (io->nwin > 1) { |
338 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 324 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
339 | p_dev->io.BasePort2 = io->win[1].base; | 325 | p_dev->resource[1]->start = io->win[1].base; |
340 | p_dev->io.NumPorts2 = io->win[1].len; | 326 | p_dev->resource[1]->end = io->win[1].len; |
341 | } | 327 | } |
342 | /* This reserves IO space but doesn't actually enable it */ | 328 | /* This reserves IO space but doesn't actually enable it */ |
343 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | 329 | if (pcmcia_request_io(p_dev) != 0) |
344 | return -ENODEV; | 330 | return -ENODEV; |
345 | } | 331 | } |
346 | 332 | ||
347 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { | ||
348 | cistpl_mem_t *mem = | ||
349 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; | ||
350 | req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; | ||
351 | req->Attributes |= WIN_ENABLE; | ||
352 | req->Base = mem->win[0].host_addr; | ||
353 | req->Size = mem->win[0].len; | ||
354 | if (req->Size < 0x1000) | ||
355 | req->Size = 0x1000; | ||
356 | req->AccessSpeed = 0; | ||
357 | if (pcmcia_request_window(p_dev, req, &p_dev->win)) | ||
358 | return -ENODEV; | ||
359 | map.Page = 0; | ||
360 | map.CardOffset = mem->win[0].card_addr; | ||
361 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map)) | ||
362 | return -ENODEV; | ||
363 | } | ||
364 | /* If we got this far, we're cool! */ | 333 | /* If we got this far, we're cool! */ |
365 | return 0; | 334 | return 0; |
366 | } | 335 | } |
@@ -368,13 +337,12 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
368 | static void dio24_config(struct pcmcia_device *link) | 337 | static void dio24_config(struct pcmcia_device *link) |
369 | { | 338 | { |
370 | int ret; | 339 | int ret; |
371 | win_req_t req; | ||
372 | 340 | ||
373 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO! - config\n"); | 341 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO! - config\n"); |
374 | 342 | ||
375 | dev_dbg(&link->dev, "dio24_config\n"); | 343 | dev_dbg(&link->dev, "dio24_config\n"); |
376 | 344 | ||
377 | ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, &req); | 345 | ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, NULL); |
378 | if (ret) { | 346 | if (ret) { |
379 | dev_warn(&link->dev, "no configuration found\n"); | 347 | dev_warn(&link->dev, "no configuration found\n"); |
380 | goto failed; | 348 | goto failed; |
@@ -396,15 +364,10 @@ static void dio24_config(struct pcmcia_device *link) | |||
396 | dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); | 364 | dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); |
397 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 365 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
398 | printk(", irq %d", link->irq); | 366 | printk(", irq %d", link->irq); |
399 | if (link->io.NumPorts1) | 367 | if (link->resource[0]) |
400 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 368 | printk(" & %pR", link->resource[0]); |
401 | link->io.BasePort1 + link->io.NumPorts1 - 1); | 369 | if (link->resource[1]) |
402 | if (link->io.NumPorts2) | 370 | printk(" & %pR", link->resource[1]); |
403 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
404 | link->io.BasePort2 + link->io.NumPorts2 - 1); | ||
405 | if (link->win) | ||
406 | printk(", mem 0x%06lx-0x%06lx", req.Base, | ||
407 | req.Base + req.Size - 1); | ||
408 | printk("\n"); | 371 | printk("\n"); |
409 | 372 | ||
410 | return; | 373 | return; |
@@ -473,7 +436,7 @@ struct pcmcia_driver dio24_cs_driver = { | |||
473 | .id_table = dio24_cs_ids, | 436 | .id_table = dio24_cs_ids, |
474 | .owner = THIS_MODULE, | 437 | .owner = THIS_MODULE, |
475 | .drv = { | 438 | .drv = { |
476 | .name = dev_info, | 439 | .name = "ni_daq_dio24", |
477 | }, | 440 | }, |
478 | }; | 441 | }; |
479 | 442 | ||
diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index 163245ebb311..68c4ecbd93ae 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c | |||
@@ -71,7 +71,6 @@ NI manuals: | |||
71 | #include "comedi_fc.h" | 71 | #include "comedi_fc.h" |
72 | #include "ni_labpc.h" | 72 | #include "ni_labpc.h" |
73 | 73 | ||
74 | #include <pcmcia/cs_types.h> | ||
75 | #include <pcmcia/cs.h> | 74 | #include <pcmcia/cs.h> |
76 | #include <pcmcia/cistpl.h> | 75 | #include <pcmcia/cistpl.h> |
77 | #include <pcmcia/cisreg.h> | 76 | #include <pcmcia/cisreg.h> |
@@ -143,7 +142,7 @@ static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
143 | link = pcmcia_cur_dev; /* XXX hack */ | 142 | link = pcmcia_cur_dev; /* XXX hack */ |
144 | if (!link) | 143 | if (!link) |
145 | return -EIO; | 144 | return -EIO; |
146 | iobase = link->io.BasePort1; | 145 | iobase = link->resource[0]->start; |
147 | irq = link->irq; | 146 | irq = link->irq; |
148 | break; | 147 | break; |
149 | default: | 148 | default: |
@@ -189,14 +188,6 @@ static void labpc_cs_detach(struct pcmcia_device *); | |||
189 | less on other parts of the kernel. | 188 | less on other parts of the kernel. |
190 | */ | 189 | */ |
191 | 190 | ||
192 | /* | ||
193 | The dev_info variable is the "key" that is used to match up this | ||
194 | device driver with appropriate cards, through the card configuration | ||
195 | database. | ||
196 | */ | ||
197 | |||
198 | static const dev_info_t dev_info = "daqcard-1200"; | ||
199 | |||
200 | struct local_info_t { | 191 | struct local_info_t { |
201 | struct pcmcia_device *link; | 192 | struct pcmcia_device *link; |
202 | int stop; | 193 | int stop; |
@@ -286,9 +277,6 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
286 | unsigned int vcc, | 277 | unsigned int vcc, |
287 | void *priv_data) | 278 | void *priv_data) |
288 | { | 279 | { |
289 | win_req_t *req = priv_data; | ||
290 | memreq_t map; | ||
291 | |||
292 | if (cfg->index == 0) | 280 | if (cfg->index == 0) |
293 | return -ENODEV; | 281 | return -ENODEV; |
294 | 282 | ||
@@ -302,44 +290,25 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
302 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; | 290 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; |
303 | 291 | ||
304 | /* IO window settings */ | 292 | /* IO window settings */ |
305 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 293 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
306 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 294 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
307 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 295 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
308 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 296 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; |
309 | if (!(io->flags & CISTPL_IO_8BIT)) | 297 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
310 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 298 | p_dev->resource[0]->flags |= |
311 | if (!(io->flags & CISTPL_IO_16BIT)) | 299 | pcmcia_io_cfg_data_width(io->flags); |
312 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 300 | p_dev->resource[0]->start = io->win[0].base; |
313 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | 301 | p_dev->resource[0]->end = io->win[0].len; |
314 | p_dev->io.BasePort1 = io->win[0].base; | ||
315 | p_dev->io.NumPorts1 = io->win[0].len; | ||
316 | if (io->nwin > 1) { | 302 | if (io->nwin > 1) { |
317 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 303 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
318 | p_dev->io.BasePort2 = io->win[1].base; | 304 | p_dev->resource[1]->start = io->win[1].base; |
319 | p_dev->io.NumPorts2 = io->win[1].len; | 305 | p_dev->resource[1]->end = io->win[1].len; |
320 | } | 306 | } |
321 | /* This reserves IO space but doesn't actually enable it */ | 307 | /* This reserves IO space but doesn't actually enable it */ |
322 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | 308 | if (pcmcia_request_io(p_dev) != 0) |
323 | return -ENODEV; | 309 | return -ENODEV; |
324 | } | 310 | } |
325 | 311 | ||
326 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { | ||
327 | cistpl_mem_t *mem = | ||
328 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; | ||
329 | req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; | ||
330 | req->Attributes |= WIN_ENABLE; | ||
331 | req->Base = mem->win[0].host_addr; | ||
332 | req->Size = mem->win[0].len; | ||
333 | if (req->Size < 0x1000) | ||
334 | req->Size = 0x1000; | ||
335 | req->AccessSpeed = 0; | ||
336 | if (pcmcia_request_window(p_dev, req, &p_dev->win)) | ||
337 | return -ENODEV; | ||
338 | map.Page = 0; | ||
339 | map.CardOffset = mem->win[0].card_addr; | ||
340 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map)) | ||
341 | return -ENODEV; | ||
342 | } | ||
343 | /* If we got this far, we're cool! */ | 312 | /* If we got this far, we're cool! */ |
344 | return 0; | 313 | return 0; |
345 | } | 314 | } |
@@ -348,11 +317,10 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
348 | static void labpc_config(struct pcmcia_device *link) | 317 | static void labpc_config(struct pcmcia_device *link) |
349 | { | 318 | { |
350 | int ret; | 319 | int ret; |
351 | win_req_t req; | ||
352 | 320 | ||
353 | dev_dbg(&link->dev, "labpc_config\n"); | 321 | dev_dbg(&link->dev, "labpc_config\n"); |
354 | 322 | ||
355 | ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, &req); | 323 | ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, NULL); |
356 | if (ret) { | 324 | if (ret) { |
357 | dev_warn(&link->dev, "no configuration found\n"); | 325 | dev_warn(&link->dev, "no configuration found\n"); |
358 | goto failed; | 326 | goto failed; |
@@ -374,15 +342,10 @@ static void labpc_config(struct pcmcia_device *link) | |||
374 | dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); | 342 | dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); |
375 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 343 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
376 | printk(", irq %d", link->irq); | 344 | printk(", irq %d", link->irq); |
377 | if (link->io.NumPorts1) | 345 | if (link->resource[0]) |
378 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 346 | printk(" & %pR", link->resource[0]); |
379 | link->io.BasePort1 + link->io.NumPorts1 - 1); | 347 | if (link->resource[1]) |
380 | if (link->io.NumPorts2) | 348 | printk(" & %pR", link->resource[1]); |
381 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
382 | link->io.BasePort2 + link->io.NumPorts2 - 1); | ||
383 | if (link->win) | ||
384 | printk(", mem 0x%06lx-0x%06lx", req.Base, | ||
385 | req.Base + req.Size - 1); | ||
386 | printk("\n"); | 349 | printk("\n"); |
387 | 350 | ||
388 | return; | 351 | return; |
@@ -449,7 +412,7 @@ struct pcmcia_driver labpc_cs_driver = { | |||
449 | .id_table = labpc_cs_ids, | 412 | .id_table = labpc_cs_ids, |
450 | .owner = THIS_MODULE, | 413 | .owner = THIS_MODULE, |
451 | .drv = { | 414 | .drv = { |
452 | .name = dev_info, | 415 | .name = "daqcard-1200", |
453 | }, | 416 | }, |
454 | }; | 417 | }; |
455 | 418 | ||
diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index 3a46f0c0bff9..1f2426352eb5 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c | |||
@@ -48,7 +48,6 @@ See the notes in the ni_atmio.o driver. | |||
48 | #include "ni_stc.h" | 48 | #include "ni_stc.h" |
49 | #include "8255.h" | 49 | #include "8255.h" |
50 | 50 | ||
51 | #include <pcmcia/cs_types.h> | ||
52 | #include <pcmcia/cs.h> | 51 | #include <pcmcia/cs.h> |
53 | #include <pcmcia/cistpl.h> | 52 | #include <pcmcia/cistpl.h> |
54 | #include <pcmcia/ds.h> | 53 | #include <pcmcia/ds.h> |
@@ -261,12 +260,11 @@ static void cs_release(struct pcmcia_device *link); | |||
261 | static void cs_detach(struct pcmcia_device *); | 260 | static void cs_detach(struct pcmcia_device *); |
262 | 261 | ||
263 | static struct pcmcia_device *cur_dev = NULL; | 262 | static struct pcmcia_device *cur_dev = NULL; |
264 | static const dev_info_t dev_info = "ni_mio_cs"; | ||
265 | 263 | ||
266 | static int cs_attach(struct pcmcia_device *link) | 264 | static int cs_attach(struct pcmcia_device *link) |
267 | { | 265 | { |
268 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 266 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; |
269 | link->io.NumPorts1 = 16; | 267 | link->resource[0]->end = 16; |
270 | link->conf.Attributes = CONF_ENABLE_IRQ; | 268 | link->conf.Attributes = CONF_ENABLE_IRQ; |
271 | link->conf.IntType = INT_MEMORY_AND_IO; | 269 | link->conf.IntType = INT_MEMORY_AND_IO; |
272 | 270 | ||
@@ -311,13 +309,12 @@ static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
311 | { | 309 | { |
312 | int base, ret; | 310 | int base, ret; |
313 | 311 | ||
314 | p_dev->io.NumPorts1 = cfg->io.win[0].len; | 312 | p_dev->resource[0]->end = cfg->io.win[0].len; |
315 | p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK; | 313 | p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK; |
316 | p_dev->io.NumPorts2 = 0; | ||
317 | 314 | ||
318 | for (base = 0x000; base < 0x400; base += 0x20) { | 315 | for (base = 0x000; base < 0x400; base += 0x20) { |
319 | p_dev->io.BasePort1 = base; | 316 | p_dev->resource[0]->start = base; |
320 | ret = pcmcia_request_io(p_dev, &p_dev->io); | 317 | ret = pcmcia_request_io(p_dev); |
321 | if (!ret) | 318 | if (!ret) |
322 | return 0; | 319 | return 0; |
323 | } | 320 | } |
@@ -356,7 +353,7 @@ static int mio_cs_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
356 | return -EIO; | 353 | return -EIO; |
357 | 354 | ||
358 | dev->driver = &driver_ni_mio_cs; | 355 | dev->driver = &driver_ni_mio_cs; |
359 | dev->iobase = link->io.BasePort1; | 356 | dev->iobase = link->resource[0]->start; |
360 | 357 | ||
361 | irq = link->irq; | 358 | irq = link->irq; |
362 | 359 | ||
@@ -450,7 +447,7 @@ struct pcmcia_driver ni_mio_cs_driver = { | |||
450 | .id_table = ni_mio_cs_ids, | 447 | .id_table = ni_mio_cs_ids, |
451 | .owner = THIS_MODULE, | 448 | .owner = THIS_MODULE, |
452 | .drv = { | 449 | .drv = { |
453 | .name = dev_info, | 450 | .name = "ni_mio_cs", |
454 | }, | 451 | }, |
455 | }; | 452 | }; |
456 | 453 | ||
diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 8b49cb12c2e5..bf489d7f4990 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c | |||
@@ -50,7 +50,6 @@ Devices: [Quatech] DAQP-208 (daqp), DAQP-308 | |||
50 | #include "../comedidev.h" | 50 | #include "../comedidev.h" |
51 | #include <linux/semaphore.h> | 51 | #include <linux/semaphore.h> |
52 | 52 | ||
53 | #include <pcmcia/cs_types.h> | ||
54 | #include <pcmcia/cs.h> | 53 | #include <pcmcia/cs.h> |
55 | #include <pcmcia/cistpl.h> | 54 | #include <pcmcia/cistpl.h> |
56 | #include <pcmcia/cisreg.h> | 55 | #include <pcmcia/cisreg.h> |
@@ -871,7 +870,7 @@ static int daqp_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
871 | } | 870 | } |
872 | } | 871 | } |
873 | 872 | ||
874 | dev->iobase = local->link->io.BasePort1; | 873 | dev->iobase = local->link->resource[0]->start; |
875 | 874 | ||
876 | ret = alloc_subdevices(dev, 4); | 875 | ret = alloc_subdevices(dev, 4); |
877 | if (ret < 0) | 876 | if (ret < 0) |
@@ -995,14 +994,6 @@ static int daqp_cs_resume(struct pcmcia_device *p_dev); | |||
995 | static int daqp_cs_attach(struct pcmcia_device *); | 994 | static int daqp_cs_attach(struct pcmcia_device *); |
996 | static void daqp_cs_detach(struct pcmcia_device *); | 995 | static void daqp_cs_detach(struct pcmcia_device *); |
997 | 996 | ||
998 | /* | ||
999 | The dev_info variable is the "key" that is used to match up this | ||
1000 | device driver with appropriate cards, through the card configuration | ||
1001 | database. | ||
1002 | */ | ||
1003 | |||
1004 | static const dev_info_t dev_info = "quatech_daqp_cs"; | ||
1005 | |||
1006 | /*====================================================================== | 997 | /*====================================================================== |
1007 | 998 | ||
1008 | daqp_cs_attach() creates an "instance" of the driver, allocating | 999 | daqp_cs_attach() creates an "instance" of the driver, allocating |
@@ -1101,26 +1092,24 @@ static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
1101 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 1092 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
1102 | 1093 | ||
1103 | /* IO window settings */ | 1094 | /* IO window settings */ |
1104 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 1095 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
1105 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 1096 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
1106 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 1097 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
1107 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 1098 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; |
1108 | if (!(io->flags & CISTPL_IO_8BIT)) | 1099 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
1109 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 1100 | p_dev->resource[0]->flags |= |
1110 | if (!(io->flags & CISTPL_IO_16BIT)) | 1101 | pcmcia_io_cfg_data_width(io->flags); |
1111 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 1102 | p_dev->resource[0]->start = io->win[0].base; |
1112 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | 1103 | p_dev->resource[0]->end = io->win[0].len; |
1113 | p_dev->io.BasePort1 = io->win[0].base; | ||
1114 | p_dev->io.NumPorts1 = io->win[0].len; | ||
1115 | if (io->nwin > 1) { | 1104 | if (io->nwin > 1) { |
1116 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 1105 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
1117 | p_dev->io.BasePort2 = io->win[1].base; | 1106 | p_dev->resource[1]->start = io->win[1].base; |
1118 | p_dev->io.NumPorts2 = io->win[1].len; | 1107 | p_dev->resource[1]->end = io->win[1].len; |
1119 | } | 1108 | } |
1120 | } | 1109 | } |
1121 | 1110 | ||
1122 | /* This reserves IO space but doesn't actually enable it */ | 1111 | /* This reserves IO space but doesn't actually enable it */ |
1123 | return pcmcia_request_io(p_dev, &p_dev->io); | 1112 | return pcmcia_request_io(p_dev); |
1124 | } | 1113 | } |
1125 | 1114 | ||
1126 | static void daqp_cs_config(struct pcmcia_device *link) | 1115 | static void daqp_cs_config(struct pcmcia_device *link) |
@@ -1151,13 +1140,11 @@ static void daqp_cs_config(struct pcmcia_device *link) | |||
1151 | /* Finally, report what we've done */ | 1140 | /* Finally, report what we've done */ |
1152 | dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); | 1141 | dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); |
1153 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 1142 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
1154 | printk(KERN_INFO ", irq %u", link->irq); | 1143 | printk(", irq %u", link->irq); |
1155 | if (link->io.NumPorts1) | 1144 | if (link->resource[0]) |
1156 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 1145 | printk(" & %pR", link->resource[0]); |
1157 | link->io.BasePort1 + link->io.NumPorts1 - 1); | 1146 | if (link->resource[1]) |
1158 | if (link->io.NumPorts2) | 1147 | printk(" & %pR", link->resource[1]); |
1159 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
1160 | link->io.BasePort2 + link->io.NumPorts2 - 1); | ||
1161 | printk("\n"); | 1148 | printk("\n"); |
1162 | 1149 | ||
1163 | return; | 1150 | return; |
@@ -1226,7 +1213,7 @@ static struct pcmcia_driver daqp_cs_driver = { | |||
1226 | .id_table = daqp_cs_id_table, | 1213 | .id_table = daqp_cs_id_table, |
1227 | .owner = THIS_MODULE, | 1214 | .owner = THIS_MODULE, |
1228 | .drv = { | 1215 | .drv = { |
1229 | .name = dev_info, | 1216 | .name = "quatech_daqp_cs", |
1230 | }, | 1217 | }, |
1231 | }; | 1218 | }; |
1232 | 1219 | ||
diff --git a/drivers/staging/wlags49_h2/wl_cs.c b/drivers/staging/wlags49_h2/wl_cs.c index 464b0673da42..19c335458653 100644 --- a/drivers/staging/wlags49_h2/wl_cs.c +++ b/drivers/staging/wlags49_h2/wl_cs.c | |||
@@ -83,7 +83,6 @@ | |||
83 | #include <linux/if_arp.h> | 83 | #include <linux/if_arp.h> |
84 | #include <linux/ioport.h> | 84 | #include <linux/ioport.h> |
85 | 85 | ||
86 | #include <pcmcia/cs_types.h> | ||
87 | #include <pcmcia/cs.h> | 86 | #include <pcmcia/cs.h> |
88 | #include <pcmcia/cistpl.h> | 87 | #include <pcmcia/cistpl.h> |
89 | #include <pcmcia/cisreg.h> | 88 | #include <pcmcia/cisreg.h> |
@@ -146,9 +145,8 @@ static int wl_adapter_attach(struct pcmcia_device *link) | |||
146 | return -ENOMEM; | 145 | return -ENOMEM; |
147 | } | 146 | } |
148 | 147 | ||
149 | link->io.NumPorts1 = HCF_NUM_IO_PORTS; | 148 | link->resource[0]->end = HCF_NUM_IO_PORTS; |
150 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 149 | link->resource[0]->flags= IO_DATA_PATH_WIDTH_16; |
151 | link->io.IOAddrLines = 6; | ||
152 | link->conf.Attributes = CONF_ENABLE_IRQ; | 150 | link->conf.Attributes = CONF_ENABLE_IRQ; |
153 | link->conf.IntType = INT_MEMORY_AND_IO; | 151 | link->conf.IntType = INT_MEMORY_AND_IO; |
154 | link->conf.ConfigIndex = 5; | 152 | link->conf.ConfigIndex = 5; |
@@ -305,8 +303,9 @@ void wl_adapter_insert(struct pcmcia_device *link) | |||
305 | 303 | ||
306 | /* Do we need to allocate an interrupt? */ | 304 | /* Do we need to allocate an interrupt? */ |
307 | link->conf.Attributes |= CONF_ENABLE_IRQ; | 305 | link->conf.Attributes |= CONF_ENABLE_IRQ; |
306 | link->io_lines = 6; | ||
308 | 307 | ||
309 | ret = pcmcia_request_io(link, &link->io); | 308 | ret = pcmcia_request_io(link); |
310 | if (ret != 0) | 309 | if (ret != 0) |
311 | goto failed; | 310 | goto failed; |
312 | 311 | ||
@@ -319,7 +318,7 @@ void wl_adapter_insert(struct pcmcia_device *link) | |||
319 | goto failed; | 318 | goto failed; |
320 | 319 | ||
321 | dev->irq = link->irq; | 320 | dev->irq = link->irq; |
322 | dev->base_addr = link->io.BasePort1; | 321 | dev->base_addr = link->resource[0]->start; |
323 | 322 | ||
324 | SET_NETDEV_DEV(dev, &link->dev); | 323 | SET_NETDEV_DEV(dev, &link->dev); |
325 | if (register_netdev(dev) != 0) { | 324 | if (register_netdev(dev) != 0) { |
diff --git a/drivers/staging/wlags49_h2/wl_internal.h b/drivers/staging/wlags49_h2/wl_internal.h index d9a0ad039c19..02f0a20e178a 100644 --- a/drivers/staging/wlags49_h2/wl_internal.h +++ b/drivers/staging/wlags49_h2/wl_internal.h | |||
@@ -69,7 +69,6 @@ | |||
69 | ******************************************************************************/ | 69 | ******************************************************************************/ |
70 | #include <linux/version.h> | 70 | #include <linux/version.h> |
71 | #ifdef BUS_PCMCIA | 71 | #ifdef BUS_PCMCIA |
72 | #include <pcmcia/cs_types.h> | ||
73 | #include <pcmcia/cs.h> | 72 | #include <pcmcia/cs.h> |
74 | #include <pcmcia/cistpl.h> | 73 | #include <pcmcia/cistpl.h> |
75 | #include <pcmcia/cisreg.h> | 74 | #include <pcmcia/cisreg.h> |
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index 99cb2246ac72..a1900e502518 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <linux/errno.h> /* error codes */ | 8 | #include <linux/errno.h> /* error codes */ |
9 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
10 | 10 | ||
11 | #include <pcmcia/cs_types.h> | ||
12 | #include <pcmcia/cs.h> | 11 | #include <pcmcia/cs.h> |
13 | #include <pcmcia/cistpl.h> | 12 | #include <pcmcia/cistpl.h> |
14 | #include <pcmcia/ds.h> | 13 | #include <pcmcia/ds.h> |
@@ -33,9 +32,8 @@ static int ixj_probe(struct pcmcia_device *p_dev) | |||
33 | { | 32 | { |
34 | dev_dbg(&p_dev->dev, "ixj_attach()\n"); | 33 | dev_dbg(&p_dev->dev, "ixj_attach()\n"); |
35 | /* Create new ixj device */ | 34 | /* Create new ixj device */ |
36 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 35 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
37 | p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 36 | p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; |
38 | p_dev->io.IOAddrLines = 3; | ||
39 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | 37 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
40 | p_dev->priv = kzalloc(sizeof(struct ixj_info_t), GFP_KERNEL); | 38 | p_dev->priv = kzalloc(sizeof(struct ixj_info_t), GFP_KERNEL); |
41 | if (!p_dev->priv) { | 39 | if (!p_dev->priv) { |
@@ -121,13 +119,14 @@ static int ixj_config_check(struct pcmcia_device *p_dev, | |||
121 | { | 119 | { |
122 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 120 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
123 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 121 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
124 | p_dev->io.BasePort1 = io->win[0].base; | 122 | p_dev->resource[0]->start = io->win[0].base; |
125 | p_dev->io.NumPorts1 = io->win[0].len; | 123 | p_dev->resource[0]->end = io->win[0].len; |
124 | p_dev->io_lines = 3; | ||
126 | if (io->nwin == 2) { | 125 | if (io->nwin == 2) { |
127 | p_dev->io.BasePort2 = io->win[1].base; | 126 | p_dev->resource[1]->start = io->win[1].base; |
128 | p_dev->io.NumPorts2 = io->win[1].len; | 127 | p_dev->resource[1]->end = io->win[1].len; |
129 | } | 128 | } |
130 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | 129 | if (!pcmcia_request_io(p_dev)) |
131 | return 0; | 130 | return 0; |
132 | } | 131 | } |
133 | return -ENODEV; | 132 | return -ENODEV; |
@@ -151,7 +150,8 @@ static int ixj_config(struct pcmcia_device * link) | |||
151 | /* | 150 | /* |
152 | * Register the card with the core. | 151 | * Register the card with the core. |
153 | */ | 152 | */ |
154 | j = ixj_pcmcia_probe(link->io.BasePort1, link->io.BasePort1 + 0x10); | 153 | j = ixj_pcmcia_probe(link->resource[0]->start, |
154 | link->resource[0]->start + 0x10); | ||
155 | 155 | ||
156 | info->ndev = 1; | 156 | info->ndev = 1; |
157 | ixj_get_serial(link, j); | 157 | ixj_get_serial(link, j); |
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 58cb73c8420a..0e13a00eb2ed 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/ioport.h> | 20 | #include <linux/ioport.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | 22 | ||
23 | #include <pcmcia/cs_types.h> | ||
24 | #include <pcmcia/cs.h> | 23 | #include <pcmcia/cs.h> |
25 | #include <pcmcia/cistpl.h> | 24 | #include <pcmcia/cistpl.h> |
26 | #include <pcmcia/cisreg.h> | 25 | #include <pcmcia/cisreg.h> |
@@ -43,8 +42,6 @@ MODULE_LICENSE("GPL"); | |||
43 | /* VARIABLES */ | 42 | /* VARIABLES */ |
44 | /*====================================================================*/ | 43 | /*====================================================================*/ |
45 | 44 | ||
46 | static const char driver_name[DEV_NAME_LEN] = "sl811_cs"; | ||
47 | |||
48 | typedef struct local_info_t { | 45 | typedef struct local_info_t { |
49 | struct pcmcia_device *p_dev; | 46 | struct pcmcia_device *p_dev; |
50 | } local_info_t; | 47 | } local_info_t; |
@@ -165,16 +162,16 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev, | |||
165 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 162 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
166 | 163 | ||
167 | /* IO window settings */ | 164 | /* IO window settings */ |
168 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 165 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
169 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 166 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
170 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 167 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
168 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; | ||
171 | 169 | ||
172 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 170 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
173 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | 171 | p_dev->resource[0]->start = io->win[0].base; |
174 | p_dev->io.BasePort1 = io->win[0].base; | 172 | p_dev->resource[0]->end = io->win[0].len; |
175 | p_dev->io.NumPorts1 = io->win[0].len; | ||
176 | 173 | ||
177 | return pcmcia_request_io(p_dev, &p_dev->io); | 174 | return pcmcia_request_io(p_dev); |
178 | } | 175 | } |
179 | pcmcia_disable_device(p_dev); | 176 | pcmcia_disable_device(p_dev); |
180 | return -ENODEV; | 177 | return -ENODEV; |
@@ -192,7 +189,7 @@ static int sl811_cs_config(struct pcmcia_device *link) | |||
192 | goto failed; | 189 | goto failed; |
193 | 190 | ||
194 | /* require an IRQ and two registers */ | 191 | /* require an IRQ and two registers */ |
195 | if (!link->io.NumPorts1 || link->io.NumPorts1 < 2) | 192 | if (resource_size(link->resource[0]) < 2) |
196 | goto failed; | 193 | goto failed; |
197 | 194 | ||
198 | if (!link->irq) | 195 | if (!link->irq) |
@@ -207,11 +204,10 @@ static int sl811_cs_config(struct pcmcia_device *link) | |||
207 | if (link->conf.Vpp) | 204 | if (link->conf.Vpp) |
208 | printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); | 205 | printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); |
209 | printk(", irq %d", link->irq); | 206 | printk(", irq %d", link->irq); |
210 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 207 | printk(", io %pR", link->resource[0]); |
211 | link->io.BasePort1+link->io.NumPorts1-1); | ||
212 | printk("\n"); | 208 | printk("\n"); |
213 | 209 | ||
214 | if (sl811_hc_init(parent, link->io.BasePort1, link->irq) | 210 | if (sl811_hc_init(parent, link->resource[0]->start, link->irq) |
215 | < 0) { | 211 | < 0) { |
216 | failed: | 212 | failed: |
217 | printk(KERN_WARNING "sl811_cs_config failed\n"); | 213 | printk(KERN_WARNING "sl811_cs_config failed\n"); |
@@ -246,7 +242,7 @@ MODULE_DEVICE_TABLE(pcmcia, sl811_ids); | |||
246 | static struct pcmcia_driver sl811_cs_driver = { | 242 | static struct pcmcia_driver sl811_cs_driver = { |
247 | .owner = THIS_MODULE, | 243 | .owner = THIS_MODULE, |
248 | .drv = { | 244 | .drv = { |
249 | .name = (char *)driver_name, | 245 | .name = "sl811_cs", |
250 | }, | 246 | }, |
251 | .probe = sl811_cs_probe, | 247 | .probe = sl811_cs_probe, |
252 | .remove = sl811_cs_detach, | 248 | .remove = sl811_cs_detach, |