aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/kernel/ecard.c19
-rw-r--r--drivers/ata/pata_icside.c35
-rw-r--r--drivers/ide/arm/icside.c32
-rw-r--r--drivers/ide/arm/rapide.c5
-rw-r--r--drivers/net/arm/ether1.c6
-rw-r--r--drivers/net/arm/ether3.c6
-rw-r--r--drivers/net/arm/etherh.c13
-rw-r--r--drivers/scsi/arm/arxescsi.c12
-rw-r--r--drivers/scsi/arm/cumana_2.c12
-rw-r--r--drivers/scsi/arm/eesox.c12
-rw-r--r--drivers/scsi/arm/powertec.c12
-rw-r--r--drivers/serial/8250_acorn.c3
-rw-r--r--include/asm-arm/ecard.h4
13 files changed, 53 insertions, 118 deletions
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index 65f1398723a4..f56d48c451ea 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -41,11 +41,11 @@
41#include <linux/init.h> 41#include <linux/init.h>
42#include <linux/mutex.h> 42#include <linux/mutex.h>
43#include <linux/kthread.h> 43#include <linux/kthread.h>
44#include <linux/io.h>
44 45
45#include <asm/dma.h> 46#include <asm/dma.h>
46#include <asm/ecard.h> 47#include <asm/ecard.h>
47#include <asm/hardware.h> 48#include <asm/hardware.h>
48#include <asm/io.h>
49#include <asm/irq.h> 49#include <asm/irq.h>
50#include <asm/mmu_context.h> 50#include <asm/mmu_context.h>
51#include <asm/mach/irq.h> 51#include <asm/mach/irq.h>
@@ -966,6 +966,23 @@ void ecard_setirq(struct expansion_card *ec, const struct expansion_card_ops *op
966} 966}
967EXPORT_SYMBOL(ecard_setirq); 967EXPORT_SYMBOL(ecard_setirq);
968 968
969void __iomem *ecardm_iomap(struct expansion_card *ec, unsigned int res,
970 unsigned long offset, unsigned long maxsize)
971{
972 unsigned long start = ecard_resource_start(ec, res);
973 unsigned long end = ecard_resource_end(ec, res);
974
975 if (offset > (end - start))
976 return NULL;
977
978 start += offset;
979 if (maxsize && end - start > maxsize)
980 end = start + maxsize;
981
982 return devm_ioremap(&ec->dev, start, end - start);
983}
984EXPORT_SYMBOL(ecardm_iomap);
985
969/* 986/*
970 * Probe for an expansion card. 987 * Probe for an expansion card.
971 * 988 *
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c
index d7621a39ed09..d323e75b05d5 100644
--- a/drivers/ata/pata_icside.c
+++ b/drivers/ata/pata_icside.c
@@ -425,8 +425,7 @@ pata_icside_register_v5(struct ata_probe_ent *ae, struct expansion_card *ec)
425 struct pata_icside_state *state = ae->private_data; 425 struct pata_icside_state *state = ae->private_data;
426 void __iomem *base; 426 void __iomem *base;
427 427
428 base = ioremap(ecard_resource_start(ec, ECARD_RES_MEMC), 428 base = ecardm_iomap(info->ec, ECARD_RES_MEMC, 0, 0);
429 ecard_resource_len(ec, ECARD_RES_MEMC));
430 if (!base) 429 if (!base)
431 return -ENOMEM; 430 return -ENOMEM;
432 431
@@ -453,24 +452,17 @@ pata_icside_register_v6(struct ata_probe_ent *ae, struct expansion_card *ec)
453 struct pata_icside_state *state = ae->private_data; 452 struct pata_icside_state *state = ae->private_data;
454 void __iomem *ioc_base, *easi_base; 453 void __iomem *ioc_base, *easi_base;
455 unsigned int sel = 0; 454 unsigned int sel = 0;
456 int ret;
457 455
458 ioc_base = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), 456 ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
459 ecard_resource_len(ec, ECARD_RES_IOCFAST)); 457 if (!ioc_base)
460 if (!ioc_base) { 458 return -ENOMEM;
461 ret = -ENOMEM;
462 goto out;
463 }
464 459
465 easi_base = ioc_base; 460 easi_base = ioc_base;
466 461
467 if (ecard_resource_flags(ec, ECARD_RES_EASI)) { 462 if (ecard_resource_flags(ec, ECARD_RES_EASI)) {
468 easi_base = ioremap(ecard_resource_start(ec, ECARD_RES_EASI), 463 easi_base = ecardm_iomap(ec, ECARD_RES_EASI, 0, 0);
469 ecard_resource_len(ec, ECARD_RES_EASI)); 464 if (!easi_base)
470 if (!easi_base) { 465 return -ENOMEM;
471 ret = -ENOMEM;
472 goto unmap_slot;
473 }
474 466
475 /* 467 /*
476 * Enable access to the EASI region. 468 * Enable access to the EASI region.
@@ -507,10 +499,6 @@ pata_icside_register_v6(struct ata_probe_ent *ae, struct expansion_card *ec)
507 499
508 return icside_dma_init(ae, ec); 500 return icside_dma_init(ae, ec);
509 501
510 unmap_slot:
511 iounmap(ioc_base);
512 out:
513 return ret;
514} 502}
515 503
516static int __devinit 504static int __devinit
@@ -534,8 +522,7 @@ pata_icside_probe(struct expansion_card *ec, const struct ecard_id *id)
534 state->type = ICS_TYPE_NOTYPE; 522 state->type = ICS_TYPE_NOTYPE;
535 state->dma = NO_DMA; 523 state->dma = NO_DMA;
536 524
537 idmem = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), 525 idmem = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
538 ecard_resource_len(ec, ECARD_RES_IOCFAST));
539 if (idmem) { 526 if (idmem) {
540 unsigned int type; 527 unsigned int type;
541 528
@@ -543,7 +530,7 @@ pata_icside_probe(struct expansion_card *ec, const struct ecard_id *id)
543 type |= (readb(idmem + ICS_IDENT_OFFSET + 4) & 1) << 1; 530 type |= (readb(idmem + ICS_IDENT_OFFSET + 4) & 1) << 1;
544 type |= (readb(idmem + ICS_IDENT_OFFSET + 8) & 1) << 2; 531 type |= (readb(idmem + ICS_IDENT_OFFSET + 8) & 1) << 2;
545 type |= (readb(idmem + ICS_IDENT_OFFSET + 12) & 1) << 3; 532 type |= (readb(idmem + ICS_IDENT_OFFSET + 12) & 1) << 3;
546 iounmap(idmem); 533 ecardm_iounmap(ec, idmem);
547 534
548 state->type = type; 535 state->type = type;
549 } 536 }
@@ -638,10 +625,6 @@ static void __devexit pata_icside_remove(struct expansion_card *ec)
638 */ 625 */
639 if (state->dma != NO_DMA) 626 if (state->dma != NO_DMA)
640 free_dma(state->dma); 627 free_dma(state->dma);
641 if (state->ioc_base)
642 iounmap(state->ioc_base);
643 if (state->ioc_base != state->irq_port)
644 iounmap(state->irq_port);
645 628
646 kfree(state); 629 kfree(state);
647 ecard_release_resources(ec); 630 ecard_release_resources(ec);
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index 69c949ea93e3..66f826252aee 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -565,8 +565,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
565 ide_hwif_t *hwif; 565 ide_hwif_t *hwif;
566 void __iomem *base; 566 void __iomem *base;
567 567
568 base = ioremap(ecard_resource_start(ec, ECARD_RES_MEMC), 568 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
569 ecard_resource_len(ec, ECARD_RES_MEMC));
570 if (!base) 569 if (!base)
571 return -ENOMEM; 570 return -ENOMEM;
572 571
@@ -583,10 +582,8 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
583 icside_irqdisable_arcin_v5(ec, 0); 582 icside_irqdisable_arcin_v5(ec, 0);
584 583
585 hwif = icside_setup(base, &icside_cardinfo_v5, ec); 584 hwif = icside_setup(base, &icside_cardinfo_v5, ec);
586 if (!hwif) { 585 if (!hwif)
587 iounmap(base);
588 return -ENODEV; 586 return -ENODEV;
589 }
590 587
591 state->hwif[0] = hwif; 588 state->hwif[0] = hwif;
592 589
@@ -605,8 +602,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
605 unsigned int sel = 0; 602 unsigned int sel = 0;
606 int ret; 603 int ret;
607 604
608 ioc_base = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), 605 ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
609 ecard_resource_len(ec, ECARD_RES_IOCFAST));
610 if (!ioc_base) { 606 if (!ioc_base) {
611 ret = -ENOMEM; 607 ret = -ENOMEM;
612 goto out; 608 goto out;
@@ -615,11 +611,10 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
615 easi_base = ioc_base; 611 easi_base = ioc_base;
616 612
617 if (ecard_resource_flags(ec, ECARD_RES_EASI)) { 613 if (ecard_resource_flags(ec, ECARD_RES_EASI)) {
618 easi_base = ioremap(ecard_resource_start(ec, ECARD_RES_EASI), 614 easi_base = ecardm_iomap(ec, ECARD_RES_EASI, 0, 0);
619 ecard_resource_len(ec, ECARD_RES_EASI));
620 if (!easi_base) { 615 if (!easi_base) {
621 ret = -ENOMEM; 616 ret = -ENOMEM;
622 goto unmap_slot; 617 goto out;
623 } 618 }
624 619
625 /* 620 /*
@@ -648,7 +643,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
648 643
649 if (!hwif || !mate) { 644 if (!hwif || !mate) {
650 ret = -ENODEV; 645 ret = -ENODEV;
651 goto unmap_port; 646 goto out;
652 } 647 }
653 648
654 state->hwif[0] = hwif; 649 state->hwif[0] = hwif;
@@ -685,11 +680,6 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
685 680
686 return 0; 681 return 0;
687 682
688 unmap_port:
689 if (easi_base != ioc_base)
690 iounmap(easi_base);
691 unmap_slot:
692 iounmap(ioc_base);
693 out: 683 out:
694 return ret; 684 return ret;
695} 685}
@@ -715,8 +705,7 @@ icside_probe(struct expansion_card *ec, const struct ecard_id *id)
715 state->type = ICS_TYPE_NOTYPE; 705 state->type = ICS_TYPE_NOTYPE;
716 state->dev = &ec->dev; 706 state->dev = &ec->dev;
717 707
718 idmem = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), 708 idmem = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
719 ecard_resource_len(ec, ECARD_RES_IOCFAST));
720 if (idmem) { 709 if (idmem) {
721 unsigned int type; 710 unsigned int type;
722 711
@@ -724,7 +713,7 @@ icside_probe(struct expansion_card *ec, const struct ecard_id *id)
724 type |= (readb(idmem + ICS_IDENT_OFFSET + 4) & 1) << 1; 713 type |= (readb(idmem + ICS_IDENT_OFFSET + 4) & 1) << 1;
725 type |= (readb(idmem + ICS_IDENT_OFFSET + 8) & 1) << 2; 714 type |= (readb(idmem + ICS_IDENT_OFFSET + 8) & 1) << 2;
726 type |= (readb(idmem + ICS_IDENT_OFFSET + 12) & 1) << 3; 715 type |= (readb(idmem + ICS_IDENT_OFFSET + 12) & 1) << 3;
727 iounmap(idmem); 716 ecardm_iounmap(ec, idmem);
728 717
729 state->type = type; 718 state->type = type;
730 } 719 }
@@ -793,11 +782,6 @@ static void __devexit icside_remove(struct expansion_card *ec)
793 782
794 ecard_set_drvdata(ec, NULL); 783 ecard_set_drvdata(ec, NULL);
795 784
796 if (state->ioc_base)
797 iounmap(state->ioc_base);
798 if (state->ioc_base != state->irq_port)
799 iounmap(state->irq_port);
800
801 kfree(state); 785 kfree(state);
802 ecard_release_resources(ec); 786 ecard_release_resources(ec);
803} 787}
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c
index 890ea3fac3c6..83811af11610 100644
--- a/drivers/ide/arm/rapide.c
+++ b/drivers/ide/arm/rapide.c
@@ -63,8 +63,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
63 if (ret) 63 if (ret)
64 goto out; 64 goto out;
65 65
66 base = ioremap(ecard_resource_start(ec, ECARD_RES_MEMC), 66 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
67 ecard_resource_len(ec, ECARD_RES_MEMC));
68 if (!base) { 67 if (!base) {
69 ret = -ENOMEM; 68 ret = -ENOMEM;
70 goto release; 69 goto release;
@@ -81,7 +80,6 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
81 goto out; 80 goto out;
82 } 81 }
83 82
84 iounmap(base);
85 release: 83 release:
86 ecard_release_resources(ec); 84 ecard_release_resources(ec);
87 out: 85 out:
@@ -96,7 +94,6 @@ static void __devexit rapide_remove(struct expansion_card *ec)
96 94
97 /* there must be a better way */ 95 /* there must be a better way */
98 ide_unregister(hwif - ide_hwifs); 96 ide_unregister(hwif - ide_hwifs);
99 iounmap(hwif->hwif_data);
100 ecard_release_resources(ec); 97 ecard_release_resources(ec);
101} 98}
102 99
diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index f075cebe84ad..f21148e7b579 100644
--- a/drivers/net/arm/ether1.c
+++ b/drivers/net/arm/ether1.c
@@ -1014,8 +1014,7 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
1014 SET_NETDEV_DEV(dev, &ec->dev); 1014 SET_NETDEV_DEV(dev, &ec->dev);
1015 1015
1016 dev->irq = ec->irq; 1016 dev->irq = ec->irq;
1017 priv(dev)->base = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), 1017 priv(dev)->base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
1018 ecard_resource_len(ec, ECARD_RES_IOCFAST));
1019 if (!priv(dev)->base) { 1018 if (!priv(dev)->base) {
1020 ret = -ENOMEM; 1019 ret = -ENOMEM;
1021 goto free; 1020 goto free;
@@ -1056,8 +1055,6 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
1056 return 0; 1055 return 0;
1057 1056
1058 free: 1057 free:
1059 if (priv(dev)->base)
1060 iounmap(priv(dev)->base);
1061 free_netdev(dev); 1058 free_netdev(dev);
1062 release: 1059 release:
1063 ecard_release_resources(ec); 1060 ecard_release_resources(ec);
@@ -1072,7 +1069,6 @@ static void __devexit ether1_remove(struct expansion_card *ec)
1072 ecard_set_drvdata(ec, NULL); 1069 ecard_set_drvdata(ec, NULL);
1073 1070
1074 unregister_netdev(dev); 1071 unregister_netdev(dev);
1075 iounmap(priv(dev)->base);
1076 free_netdev(dev); 1072 free_netdev(dev);
1077 ecard_release_resources(ec); 1073 ecard_release_resources(ec);
1078} 1074}
diff --git a/drivers/net/arm/ether3.c b/drivers/net/arm/ether3.c
index 32da2eb9bcee..da713500654d 100644
--- a/drivers/net/arm/ether3.c
+++ b/drivers/net/arm/ether3.c
@@ -793,8 +793,7 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
793 SET_MODULE_OWNER(dev); 793 SET_MODULE_OWNER(dev);
794 SET_NETDEV_DEV(dev, &ec->dev); 794 SET_NETDEV_DEV(dev, &ec->dev);
795 795
796 priv(dev)->base = ioremap(ecard_resource_start(ec, ECARD_RES_MEMC), 796 priv(dev)->base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
797 ecard_resource_len(ec, ECARD_RES_MEMC));
798 if (!priv(dev)->base) { 797 if (!priv(dev)->base) {
799 ret = -ENOMEM; 798 ret = -ENOMEM;
800 goto free; 799 goto free;
@@ -869,8 +868,6 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
869 return 0; 868 return 0;
870 869
871 free: 870 free:
872 if (priv(dev)->base)
873 iounmap(priv(dev)->base);
874 free_netdev(dev); 871 free_netdev(dev);
875 release: 872 release:
876 ecard_release_resources(ec); 873 ecard_release_resources(ec);
@@ -885,7 +882,6 @@ static void __devexit ether3_remove(struct expansion_card *ec)
885 ecard_set_drvdata(ec, NULL); 882 ecard_set_drvdata(ec, NULL);
886 883
887 unregister_netdev(dev); 884 unregister_netdev(dev);
888 iounmap(priv(dev)->base);
889 free_netdev(dev); 885 free_netdev(dev);
890 ecard_release_resources(ec); 886 ecard_release_resources(ec);
891} 887}
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c
index 387f1e3a4e84..769ba69451f4 100644
--- a/drivers/net/arm/etherh.c
+++ b/drivers/net/arm/etherh.c
@@ -686,7 +686,7 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
686 eh->supported = data->supported; 686 eh->supported = data->supported;
687 eh->ctrl = 0; 687 eh->ctrl = 0;
688 eh->id = ec->cid.product; 688 eh->id = ec->cid.product;
689 eh->memc = ioremap(ecard_resource_start(ec, ECARD_RES_MEMC), PAGE_SIZE); 689 eh->memc = ecardm_iomap(ec, ECARD_RES_MEMC, 0, PAGE_SIZE);
690 if (!eh->memc) { 690 if (!eh->memc) {
691 ret = -ENOMEM; 691 ret = -ENOMEM;
692 goto free; 692 goto free;
@@ -694,7 +694,7 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
694 694
695 eh->ctrl_port = eh->memc; 695 eh->ctrl_port = eh->memc;
696 if (data->ctrl_ioc) { 696 if (data->ctrl_ioc) {
697 eh->ioc_fast = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), PAGE_SIZE); 697 eh->ioc_fast = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, PAGE_SIZE);
698 if (!eh->ioc_fast) { 698 if (!eh->ioc_fast) {
699 ret = -ENOMEM; 699 ret = -ENOMEM;
700 goto free; 700 goto free;
@@ -758,10 +758,6 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
758 return 0; 758 return 0;
759 759
760 free: 760 free:
761 if (eh->ioc_fast)
762 iounmap(eh->ioc_fast);
763 if (eh->memc)
764 iounmap(eh->memc);
765 free_netdev(dev); 761 free_netdev(dev);
766 release: 762 release:
767 ecard_release_resources(ec); 763 ecard_release_resources(ec);
@@ -772,16 +768,11 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
772static void __devexit etherh_remove(struct expansion_card *ec) 768static void __devexit etherh_remove(struct expansion_card *ec)
773{ 769{
774 struct net_device *dev = ecard_get_drvdata(ec); 770 struct net_device *dev = ecard_get_drvdata(ec);
775 struct etherh_priv *eh = etherh_priv(dev);
776 771
777 ecard_set_drvdata(ec, NULL); 772 ecard_set_drvdata(ec, NULL);
778 773
779 unregister_netdev(dev); 774 unregister_netdev(dev);
780 775
781 if (eh->ioc_fast)
782 iounmap(eh->ioc_fast);
783 iounmap(eh->memc);
784
785 free_netdev(dev); 776 free_netdev(dev);
786 777
787 ecard_release_resources(ec); 778 ecard_release_resources(ec);
diff --git a/drivers/scsi/arm/arxescsi.c b/drivers/scsi/arm/arxescsi.c
index 7e132c5bacf8..2836fe248df9 100644
--- a/drivers/scsi/arm/arxescsi.c
+++ b/drivers/scsi/arm/arxescsi.c
@@ -281,7 +281,6 @@ arxescsi_probe(struct expansion_card *ec, const struct ecard_id *id)
281{ 281{
282 struct Scsi_Host *host; 282 struct Scsi_Host *host;
283 struct arxescsi_info *info; 283 struct arxescsi_info *info;
284 unsigned long resbase, reslen;
285 void __iomem *base; 284 void __iomem *base;
286 int ret; 285 int ret;
287 286
@@ -289,9 +288,7 @@ arxescsi_probe(struct expansion_card *ec, const struct ecard_id *id)
289 if (ret) 288 if (ret)
290 goto out; 289 goto out;
291 290
292 resbase = ecard_resource_start(ec, ECARD_RES_MEMC); 291 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
293 reslen = ecard_resource_len(ec, ECARD_RES_MEMC);
294 base = ioremap(resbase, reslen);
295 if (!base) { 292 if (!base) {
296 ret = -ENOMEM; 293 ret = -ENOMEM;
297 goto out_region; 294 goto out_region;
@@ -300,7 +297,7 @@ arxescsi_probe(struct expansion_card *ec, const struct ecard_id *id)
300 host = scsi_host_alloc(&arxescsi_template, sizeof(struct arxescsi_info)); 297 host = scsi_host_alloc(&arxescsi_template, sizeof(struct arxescsi_info));
301 if (!host) { 298 if (!host) {
302 ret = -ENOMEM; 299 ret = -ENOMEM;
303 goto out_unmap; 300 goto out_region;
304 } 301 }
305 302
306 info = (struct arxescsi_info *)host->hostdata; 303 info = (struct arxescsi_info *)host->hostdata;
@@ -337,8 +334,6 @@ arxescsi_probe(struct expansion_card *ec, const struct ecard_id *id)
337 fas216_release(host); 334 fas216_release(host);
338 out_unregister: 335 out_unregister:
339 scsi_host_put(host); 336 scsi_host_put(host);
340 out_unmap:
341 iounmap(base);
342 out_region: 337 out_region:
343 ecard_release_resources(ec); 338 ecard_release_resources(ec);
344 out: 339 out:
@@ -348,13 +343,10 @@ arxescsi_probe(struct expansion_card *ec, const struct ecard_id *id)
348static void __devexit arxescsi_remove(struct expansion_card *ec) 343static void __devexit arxescsi_remove(struct expansion_card *ec)
349{ 344{
350 struct Scsi_Host *host = ecard_get_drvdata(ec); 345 struct Scsi_Host *host = ecard_get_drvdata(ec);
351 struct arxescsi_info *info = (struct arxescsi_info *)host->hostdata;
352 346
353 ecard_set_drvdata(ec, NULL); 347 ecard_set_drvdata(ec, NULL);
354 fas216_remove(host); 348 fas216_remove(host);
355 349
356 iounmap(info->base);
357
358 fas216_release(host); 350 fas216_release(host);
359 scsi_host_put(host); 351 scsi_host_put(host);
360 ecard_release_resources(ec); 352 ecard_release_resources(ec);
diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c
index f51aa3446bc7..68a64123af8f 100644
--- a/drivers/scsi/arm/cumana_2.c
+++ b/drivers/scsi/arm/cumana_2.c
@@ -401,7 +401,6 @@ cumanascsi2_probe(struct expansion_card *ec, const struct ecard_id *id)
401{ 401{
402 struct Scsi_Host *host; 402 struct Scsi_Host *host;
403 struct cumanascsi2_info *info; 403 struct cumanascsi2_info *info;
404 unsigned long resbase, reslen;
405 void __iomem *base; 404 void __iomem *base;
406 int ret; 405 int ret;
407 406
@@ -409,9 +408,7 @@ cumanascsi2_probe(struct expansion_card *ec, const struct ecard_id *id)
409 if (ret) 408 if (ret)
410 goto out; 409 goto out;
411 410
412 resbase = ecard_resource_start(ec, ECARD_RES_MEMC); 411 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
413 reslen = ecard_resource_len(ec, ECARD_RES_MEMC);
414 base = ioremap(resbase, reslen);
415 if (!base) { 412 if (!base) {
416 ret = -ENOMEM; 413 ret = -ENOMEM;
417 goto out_region; 414 goto out_region;
@@ -421,7 +418,7 @@ cumanascsi2_probe(struct expansion_card *ec, const struct ecard_id *id)
421 sizeof(struct cumanascsi2_info)); 418 sizeof(struct cumanascsi2_info));
422 if (!host) { 419 if (!host) {
423 ret = -ENOMEM; 420 ret = -ENOMEM;
424 goto out_unmap; 421 goto out_region;
425 } 422 }
426 423
427 ecard_set_drvdata(ec, host); 424 ecard_set_drvdata(ec, host);
@@ -490,9 +487,6 @@ cumanascsi2_probe(struct expansion_card *ec, const struct ecard_id *id)
490 out_free: 487 out_free:
491 scsi_host_put(host); 488 scsi_host_put(host);
492 489
493 out_unmap:
494 iounmap(base);
495
496 out_region: 490 out_region:
497 ecard_release_resources(ec); 491 ecard_release_resources(ec);
498 492
@@ -512,8 +506,6 @@ static void __devexit cumanascsi2_remove(struct expansion_card *ec)
512 free_dma(info->info.scsi.dma); 506 free_dma(info->info.scsi.dma);
513 free_irq(ec->irq, info); 507 free_irq(ec->irq, info);
514 508
515 iounmap(info->base);
516
517 fas216_release(host); 509 fas216_release(host);
518 scsi_host_put(host); 510 scsi_host_put(host);
519 ecard_release_resources(ec); 511 ecard_release_resources(ec);
diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c
index cc5d513aa99a..bb2477b3fb0b 100644
--- a/drivers/scsi/arm/eesox.c
+++ b/drivers/scsi/arm/eesox.c
@@ -519,7 +519,6 @@ eesoxscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
519{ 519{
520 struct Scsi_Host *host; 520 struct Scsi_Host *host;
521 struct eesoxscsi_info *info; 521 struct eesoxscsi_info *info;
522 unsigned long resbase, reslen;
523 void __iomem *base; 522 void __iomem *base;
524 int ret; 523 int ret;
525 524
@@ -527,9 +526,7 @@ eesoxscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
527 if (ret) 526 if (ret)
528 goto out; 527 goto out;
529 528
530 resbase = ecard_resource_start(ec, ECARD_RES_IOCFAST); 529 base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
531 reslen = ecard_resource_len(ec, ECARD_RES_IOCFAST);
532 base = ioremap(resbase, reslen);
533 if (!base) { 530 if (!base) {
534 ret = -ENOMEM; 531 ret = -ENOMEM;
535 goto out_region; 532 goto out_region;
@@ -539,7 +536,7 @@ eesoxscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
539 sizeof(struct eesoxscsi_info)); 536 sizeof(struct eesoxscsi_info));
540 if (!host) { 537 if (!host) {
541 ret = -ENOMEM; 538 ret = -ENOMEM;
542 goto out_unmap; 539 goto out_region;
543 } 540 }
544 541
545 ecard_set_drvdata(ec, host); 542 ecard_set_drvdata(ec, host);
@@ -612,9 +609,6 @@ eesoxscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
612 device_remove_file(&ec->dev, &dev_attr_bus_term); 609 device_remove_file(&ec->dev, &dev_attr_bus_term);
613 scsi_host_put(host); 610 scsi_host_put(host);
614 611
615 out_unmap:
616 iounmap(base);
617
618 out_region: 612 out_region:
619 ecard_release_resources(ec); 613 ecard_release_resources(ec);
620 614
@@ -636,8 +630,6 @@ static void __devexit eesoxscsi_remove(struct expansion_card *ec)
636 630
637 device_remove_file(&ec->dev, &dev_attr_bus_term); 631 device_remove_file(&ec->dev, &dev_attr_bus_term);
638 632
639 iounmap(info->base);
640
641 fas216_release(host); 633 fas216_release(host);
642 scsi_host_put(host); 634 scsi_host_put(host);
643 ecard_release_resources(ec); 635 ecard_release_resources(ec);
diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c
index 3cbd525b58c5..d9a546d1917c 100644
--- a/drivers/scsi/arm/powertec.c
+++ b/drivers/scsi/arm/powertec.c
@@ -313,7 +313,6 @@ powertecscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
313{ 313{
314 struct Scsi_Host *host; 314 struct Scsi_Host *host;
315 struct powertec_info *info; 315 struct powertec_info *info;
316 unsigned long resbase, reslen;
317 void __iomem *base; 316 void __iomem *base;
318 int ret; 317 int ret;
319 318
@@ -321,9 +320,7 @@ powertecscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
321 if (ret) 320 if (ret)
322 goto out; 321 goto out;
323 322
324 resbase = ecard_resource_start(ec, ECARD_RES_IOCFAST); 323 base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
325 reslen = ecard_resource_len(ec, ECARD_RES_IOCFAST);
326 base = ioremap(resbase, reslen);
327 if (!base) { 324 if (!base) {
328 ret = -ENOMEM; 325 ret = -ENOMEM;
329 goto out_region; 326 goto out_region;
@@ -333,7 +330,7 @@ powertecscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
333 sizeof (struct powertec_info)); 330 sizeof (struct powertec_info));
334 if (!host) { 331 if (!host) {
335 ret = -ENOMEM; 332 ret = -ENOMEM;
336 goto out_unmap; 333 goto out_region;
337 } 334 }
338 335
339 ecard_set_drvdata(ec, host); 336 ecard_set_drvdata(ec, host);
@@ -404,9 +401,6 @@ powertecscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
404 device_remove_file(&ec->dev, &dev_attr_bus_term); 401 device_remove_file(&ec->dev, &dev_attr_bus_term);
405 scsi_host_put(host); 402 scsi_host_put(host);
406 403
407 out_unmap:
408 iounmap(base);
409
410 out_region: 404 out_region:
411 ecard_release_resources(ec); 405 ecard_release_resources(ec);
412 406
@@ -428,8 +422,6 @@ static void __devexit powertecscsi_remove(struct expansion_card *ec)
428 free_dma(info->info.scsi.dma); 422 free_dma(info->info.scsi.dma);
429 free_irq(ec->irq, info); 423 free_irq(ec->irq, info);
430 424
431 iounmap(info->base);
432
433 fas216_release(host); 425 fas216_release(host);
434 scsi_host_put(host); 426 scsi_host_put(host);
435 ecard_release_resources(ec); 427 ecard_release_resources(ec);
diff --git a/drivers/serial/8250_acorn.c b/drivers/serial/8250_acorn.c
index 562ba745a044..b0ce8c56f1a4 100644
--- a/drivers/serial/8250_acorn.c
+++ b/drivers/serial/8250_acorn.c
@@ -54,7 +54,7 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id)
54 info->num_ports = type->num_ports; 54 info->num_ports = type->num_ports;
55 55
56 bus_addr = ecard_resource_start(ec, type->type); 56 bus_addr = ecard_resource_start(ec, type->type);
57 info->vaddr = ioremap(bus_addr, ecard_resource_len(ec, type->type)); 57 info->vaddr = ecardm_iomap(ec, type->type, 0, 0);
58 if (!info->vaddr) { 58 if (!info->vaddr) {
59 kfree(info); 59 kfree(info);
60 return -ENOMEM; 60 return -ENOMEM;
@@ -91,7 +91,6 @@ static void __devexit serial_card_remove(struct expansion_card *ec)
91 if (info->ports[i] > 0) 91 if (info->ports[i] > 0)
92 serial8250_unregister_port(info->ports[i]); 92 serial8250_unregister_port(info->ports[i]);
93 93
94 iounmap(info->vaddr);
95 kfree(info); 94 kfree(info);
96} 95}
97 96
diff --git a/include/asm-arm/ecard.h b/include/asm-arm/ecard.h
index 8f1000eac91f..684fe0645239 100644
--- a/include/asm-arm/ecard.h
+++ b/include/asm-arm/ecard.h
@@ -226,6 +226,10 @@ ecard_address(struct expansion_card *ec, card_type_t type, card_speed_t speed)
226extern int ecard_request_resources(struct expansion_card *ec); 226extern int ecard_request_resources(struct expansion_card *ec);
227extern void ecard_release_resources(struct expansion_card *ec); 227extern void ecard_release_resources(struct expansion_card *ec);
228 228
229void __iomem *ecardm_iomap(struct expansion_card *ec, unsigned int res,
230 unsigned long offset, unsigned long maxsize);
231#define ecardm_iounmap(__ec, __addr) devm_iounmap(&(__ec)->dev, __addr)
232
229extern struct bus_type ecard_bus_type; 233extern struct bus_type ecard_bus_type;
230 234
231#define ECARD_DEV(_d) container_of((_d), struct expansion_card, dev) 235#define ECARD_DEV(_d) container_of((_d), struct expansion_card, dev)