diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/pata_icside.c | 184 | ||||
-rw-r--r-- | drivers/ide/arm/icside.c | 41 | ||||
-rw-r--r-- | drivers/ide/arm/rapide.c | 5 | ||||
-rw-r--r-- | drivers/net/arm/ether1.c | 6 | ||||
-rw-r--r-- | drivers/net/arm/ether3.c | 6 | ||||
-rw-r--r-- | drivers/net/arm/etherh.c | 17 | ||||
-rw-r--r-- | drivers/scsi/arm/arxescsi.c | 12 | ||||
-rw-r--r-- | drivers/scsi/arm/cumana_2.c | 16 | ||||
-rw-r--r-- | drivers/scsi/arm/eesox.c | 16 | ||||
-rw-r--r-- | drivers/scsi/arm/powertec.c | 16 | ||||
-rw-r--r-- | drivers/serial/8250_acorn.c | 3 | ||||
-rw-r--r-- | drivers/serial/Kconfig | 17 | ||||
-rw-r--r-- | drivers/serial/Makefile | 1 | ||||
-rw-r--r-- | drivers/serial/serial_ks8695.c | 657 | ||||
-rw-r--r-- | drivers/usb/gadget/Kconfig | 2 |
15 files changed, 804 insertions, 195 deletions
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c index dbc8ee2adcf0..c791a46df461 100644 --- a/drivers/ata/pata_icside.c +++ b/drivers/ata/pata_icside.c | |||
@@ -60,6 +60,18 @@ struct pata_icside_state { | |||
60 | struct scatterlist sg[PATA_ICSIDE_MAX_SG]; | 60 | struct scatterlist sg[PATA_ICSIDE_MAX_SG]; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | struct pata_icside_info { | ||
64 | struct pata_icside_state *state; | ||
65 | struct expansion_card *ec; | ||
66 | void __iomem *base; | ||
67 | void __iomem *irqaddr; | ||
68 | unsigned int irqmask; | ||
69 | const expansioncard_ops_t *irqops; | ||
70 | unsigned int mwdma_mask; | ||
71 | unsigned int nr_ports; | ||
72 | const struct portinfo *port[2]; | ||
73 | }; | ||
74 | |||
63 | #define ICS_TYPE_A3IN 0 | 75 | #define ICS_TYPE_A3IN 0 |
64 | #define ICS_TYPE_A3USER 1 | 76 | #define ICS_TYPE_A3USER 1 |
65 | #define ICS_TYPE_V6 3 | 77 | #define ICS_TYPE_V6 3 |
@@ -269,9 +281,10 @@ static u8 pata_icside_bmdma_status(struct ata_port *ap) | |||
269 | return readb(irq_port) & 1 ? ATA_DMA_INTR : 0; | 281 | return readb(irq_port) & 1 ? ATA_DMA_INTR : 0; |
270 | } | 282 | } |
271 | 283 | ||
272 | static int icside_dma_init(struct ata_probe_ent *ae, struct expansion_card *ec) | 284 | static int icside_dma_init(struct pata_icside_info *info) |
273 | { | 285 | { |
274 | struct pata_icside_state *state = ae->private_data; | 286 | struct pata_icside_state *state = info->state; |
287 | struct expansion_card *ec = info->ec; | ||
275 | int i; | 288 | int i; |
276 | 289 | ||
277 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 290 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
@@ -281,7 +294,7 @@ static int icside_dma_init(struct ata_probe_ent *ae, struct expansion_card *ec) | |||
281 | 294 | ||
282 | if (ec->dma != NO_DMA && !request_dma(ec->dma, DRV_NAME)) { | 295 | if (ec->dma != NO_DMA && !request_dma(ec->dma, DRV_NAME)) { |
283 | state->dma = ec->dma; | 296 | state->dma = ec->dma; |
284 | ae->mwdma_mask = 0x07; /* MW0..2 */ | 297 | info->mwdma_mask = 0x07; /* MW0..2 */ |
285 | } | 298 | } |
286 | 299 | ||
287 | return 0; | 300 | return 0; |
@@ -371,6 +384,8 @@ static struct ata_port_operations pata_icside_port_ops = { | |||
371 | .check_status = ata_check_status, | 384 | .check_status = ata_check_status, |
372 | .dev_select = ata_std_dev_select, | 385 | .dev_select = ata_std_dev_select, |
373 | 386 | ||
387 | .cable_detect = ata_cable_40wire, | ||
388 | |||
374 | .bmdma_setup = pata_icside_bmdma_setup, | 389 | .bmdma_setup = pata_icside_bmdma_setup, |
375 | .bmdma_start = pata_icside_bmdma_start, | 390 | .bmdma_start = pata_icside_bmdma_start, |
376 | 391 | ||
@@ -385,7 +400,6 @@ static struct ata_port_operations pata_icside_port_ops = { | |||
385 | .error_handler = ata_bmdma_error_handler, | 400 | .error_handler = ata_bmdma_error_handler, |
386 | .post_internal_cmd = pata_icside_bmdma_stop, | 401 | .post_internal_cmd = pata_icside_bmdma_stop, |
387 | 402 | ||
388 | .irq_handler = ata_interrupt, | ||
389 | .irq_clear = ata_dummy_noret, | 403 | .irq_clear = ata_dummy_noret, |
390 | .irq_on = ata_irq_on, | 404 | .irq_on = ata_irq_on, |
391 | .irq_ack = pata_icside_irq_ack, | 405 | .irq_ack = pata_icside_irq_ack, |
@@ -396,11 +410,10 @@ static struct ata_port_operations pata_icside_port_ops = { | |||
396 | .bmdma_status = pata_icside_bmdma_status, | 410 | .bmdma_status = pata_icside_bmdma_status, |
397 | }; | 411 | }; |
398 | 412 | ||
399 | static void | 413 | static void __devinit |
400 | pata_icside_add_port(struct ata_probe_ent *ae, void __iomem *base, | 414 | pata_icside_setup_ioaddr(struct ata_ioports *ioaddr, void __iomem *base, |
401 | const struct portinfo *info) | 415 | const struct portinfo *info) |
402 | { | 416 | { |
403 | struct ata_ioports *ioaddr = &ae->port[ae->n_ports++]; | ||
404 | void __iomem *cmd = base + info->dataoffset; | 417 | void __iomem *cmd = base + info->dataoffset; |
405 | 418 | ||
406 | ioaddr->cmd_addr = cmd; | 419 | ioaddr->cmd_addr = cmd; |
@@ -419,58 +432,44 @@ pata_icside_add_port(struct ata_probe_ent *ae, void __iomem *base, | |||
419 | ioaddr->altstatus_addr = ioaddr->ctl_addr; | 432 | ioaddr->altstatus_addr = ioaddr->ctl_addr; |
420 | } | 433 | } |
421 | 434 | ||
422 | static int __init | 435 | static int __devinit pata_icside_register_v5(struct pata_icside_info *info) |
423 | pata_icside_register_v5(struct ata_probe_ent *ae, struct expansion_card *ec) | ||
424 | { | 436 | { |
425 | struct pata_icside_state *state = ae->private_data; | 437 | struct pata_icside_state *state = info->state; |
426 | void __iomem *base; | 438 | void __iomem *base; |
427 | 439 | ||
428 | base = ioremap(ecard_resource_start(ec, ECARD_RES_MEMC), | 440 | base = ecardm_iomap(info->ec, ECARD_RES_MEMC, 0, 0); |
429 | ecard_resource_len(ec, ECARD_RES_MEMC)); | ||
430 | if (!base) | 441 | if (!base) |
431 | return -ENOMEM; | 442 | return -ENOMEM; |
432 | 443 | ||
433 | state->irq_port = base; | 444 | state->irq_port = base; |
434 | 445 | ||
435 | ec->irqaddr = base + ICS_ARCIN_V5_INTRSTAT; | 446 | info->base = base; |
436 | ec->irqmask = 1; | 447 | info->irqaddr = base + ICS_ARCIN_V5_INTRSTAT; |
437 | ec->irq_data = state; | 448 | info->irqmask = 1; |
438 | ec->ops = &pata_icside_ops_arcin_v5; | 449 | info->irqops = &pata_icside_ops_arcin_v5; |
439 | 450 | info->nr_ports = 1; | |
440 | /* | 451 | info->port[0] = &pata_icside_portinfo_v5; |
441 | * Be on the safe side - disable interrupts | ||
442 | */ | ||
443 | ec->ops->irqdisable(ec, ec->irq); | ||
444 | |||
445 | pata_icside_add_port(ae, base, &pata_icside_portinfo_v5); | ||
446 | 452 | ||
447 | return 0; | 453 | return 0; |
448 | } | 454 | } |
449 | 455 | ||
450 | static int __init | 456 | static int __devinit pata_icside_register_v6(struct pata_icside_info *info) |
451 | pata_icside_register_v6(struct ata_probe_ent *ae, struct expansion_card *ec) | ||
452 | { | 457 | { |
453 | struct pata_icside_state *state = ae->private_data; | 458 | struct pata_icside_state *state = info->state; |
459 | struct expansion_card *ec = info->ec; | ||
454 | void __iomem *ioc_base, *easi_base; | 460 | void __iomem *ioc_base, *easi_base; |
455 | unsigned int sel = 0; | 461 | unsigned int sel = 0; |
456 | int ret; | ||
457 | 462 | ||
458 | ioc_base = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), | 463 | ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); |
459 | ecard_resource_len(ec, ECARD_RES_IOCFAST)); | 464 | if (!ioc_base) |
460 | if (!ioc_base) { | 465 | return -ENOMEM; |
461 | ret = -ENOMEM; | ||
462 | goto out; | ||
463 | } | ||
464 | 466 | ||
465 | easi_base = ioc_base; | 467 | easi_base = ioc_base; |
466 | 468 | ||
467 | if (ecard_resource_flags(ec, ECARD_RES_EASI)) { | 469 | if (ecard_resource_flags(ec, ECARD_RES_EASI)) { |
468 | easi_base = ioremap(ecard_resource_start(ec, ECARD_RES_EASI), | 470 | easi_base = ecardm_iomap(ec, ECARD_RES_EASI, 0, 0); |
469 | ecard_resource_len(ec, ECARD_RES_EASI)); | 471 | if (!easi_base) |
470 | if (!easi_base) { | 472 | return -ENOMEM; |
471 | ret = -ENOMEM; | ||
472 | goto unmap_slot; | ||
473 | } | ||
474 | 473 | ||
475 | /* | 474 | /* |
476 | * Enable access to the EASI region. | 475 | * Enable access to the EASI region. |
@@ -480,45 +479,72 @@ pata_icside_register_v6(struct ata_probe_ent *ae, struct expansion_card *ec) | |||
480 | 479 | ||
481 | writeb(sel, ioc_base); | 480 | writeb(sel, ioc_base); |
482 | 481 | ||
483 | ec->irq_data = state; | ||
484 | ec->ops = &pata_icside_ops_arcin_v6; | ||
485 | |||
486 | state->irq_port = easi_base; | 482 | state->irq_port = easi_base; |
487 | state->ioc_base = ioc_base; | 483 | state->ioc_base = ioc_base; |
488 | state->port[0].port_sel = sel; | 484 | state->port[0].port_sel = sel; |
489 | state->port[1].port_sel = sel | 1; | 485 | state->port[1].port_sel = sel | 1; |
490 | 486 | ||
491 | /* | 487 | /* |
492 | * Be on the safe side - disable interrupts | ||
493 | */ | ||
494 | ec->ops->irqdisable(ec, ec->irq); | ||
495 | |||
496 | /* | ||
497 | * Find and register the interfaces. | ||
498 | */ | ||
499 | pata_icside_add_port(ae, easi_base, &pata_icside_portinfo_v6_1); | ||
500 | pata_icside_add_port(ae, easi_base, &pata_icside_portinfo_v6_2); | ||
501 | |||
502 | /* | ||
503 | * FIXME: work around libata's aversion to calling port_disable. | 488 | * FIXME: work around libata's aversion to calling port_disable. |
504 | * This permanently disables interrupts on port 0 - bad luck if | 489 | * This permanently disables interrupts on port 0 - bad luck if |
505 | * you have a drive on that port. | 490 | * you have a drive on that port. |
506 | */ | 491 | */ |
507 | state->port[0].disabled = 1; | 492 | state->port[0].disabled = 1; |
508 | 493 | ||
509 | return icside_dma_init(ae, ec); | 494 | info->base = easi_base; |
495 | info->irqops = &pata_icside_ops_arcin_v6; | ||
496 | info->nr_ports = 2; | ||
497 | info->port[0] = &pata_icside_portinfo_v6_1; | ||
498 | info->port[1] = &pata_icside_portinfo_v6_2; | ||
510 | 499 | ||
511 | unmap_slot: | 500 | return icside_dma_init(info); |
512 | iounmap(ioc_base); | 501 | } |
513 | out: | 502 | |
514 | return ret; | 503 | static int __devinit pata_icside_add_ports(struct pata_icside_info *info) |
504 | { | ||
505 | struct expansion_card *ec = info->ec; | ||
506 | struct ata_host *host; | ||
507 | int i; | ||
508 | |||
509 | if (info->irqaddr) { | ||
510 | ec->irqaddr = info->irqaddr; | ||
511 | ec->irqmask = info->irqmask; | ||
512 | } | ||
513 | if (info->irqops) | ||
514 | ecard_setirq(ec, info->irqops, info->state); | ||
515 | |||
516 | /* | ||
517 | * Be on the safe side - disable interrupts | ||
518 | */ | ||
519 | ec->ops->irqdisable(ec, ec->irq); | ||
520 | |||
521 | host = ata_host_alloc(&ec->dev, info->nr_ports); | ||
522 | if (!host) | ||
523 | return -ENOMEM; | ||
524 | |||
525 | host->private_data = info->state; | ||
526 | host->flags = ATA_HOST_SIMPLEX; | ||
527 | |||
528 | for (i = 0; i < info->nr_ports; i++) { | ||
529 | struct ata_port *ap = host->ports[i]; | ||
530 | |||
531 | ap->pio_mask = 0x1f; | ||
532 | ap->mwdma_mask = info->mwdma_mask; | ||
533 | ap->flags |= ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST; | ||
534 | ap->ops = &pata_icside_port_ops; | ||
535 | |||
536 | pata_icside_setup_ioaddr(&ap->ioaddr, info->base, info->port[i]); | ||
537 | } | ||
538 | |||
539 | return ata_host_activate(host, ec->irq, ata_interrupt, 0, | ||
540 | &pata_icside_sht); | ||
515 | } | 541 | } |
516 | 542 | ||
517 | static int __devinit | 543 | static int __devinit |
518 | pata_icside_probe(struct expansion_card *ec, const struct ecard_id *id) | 544 | pata_icside_probe(struct expansion_card *ec, const struct ecard_id *id) |
519 | { | 545 | { |
520 | struct pata_icside_state *state; | 546 | struct pata_icside_state *state; |
521 | struct ata_probe_ent ae; | 547 | struct pata_icside_info info; |
522 | void __iomem *idmem; | 548 | void __iomem *idmem; |
523 | int ret; | 549 | int ret; |
524 | 550 | ||
@@ -526,7 +552,7 @@ pata_icside_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
526 | if (ret) | 552 | if (ret) |
527 | goto out; | 553 | goto out; |
528 | 554 | ||
529 | state = kzalloc(sizeof(struct pata_icside_state), GFP_KERNEL); | 555 | state = devm_kzalloc(&ec->dev, sizeof(*state), GFP_KERNEL); |
530 | if (!state) { | 556 | if (!state) { |
531 | ret = -ENOMEM; | 557 | ret = -ENOMEM; |
532 | goto release; | 558 | goto release; |
@@ -535,8 +561,7 @@ pata_icside_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
535 | state->type = ICS_TYPE_NOTYPE; | 561 | state->type = ICS_TYPE_NOTYPE; |
536 | state->dma = NO_DMA; | 562 | state->dma = NO_DMA; |
537 | 563 | ||
538 | idmem = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), | 564 | idmem = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); |
539 | ecard_resource_len(ec, ECARD_RES_IOCFAST)); | ||
540 | if (idmem) { | 565 | if (idmem) { |
541 | unsigned int type; | 566 | unsigned int type; |
542 | 567 | ||
@@ -544,21 +569,14 @@ pata_icside_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
544 | type |= (readb(idmem + ICS_IDENT_OFFSET + 4) & 1) << 1; | 569 | type |= (readb(idmem + ICS_IDENT_OFFSET + 4) & 1) << 1; |
545 | type |= (readb(idmem + ICS_IDENT_OFFSET + 8) & 1) << 2; | 570 | type |= (readb(idmem + ICS_IDENT_OFFSET + 8) & 1) << 2; |
546 | type |= (readb(idmem + ICS_IDENT_OFFSET + 12) & 1) << 3; | 571 | type |= (readb(idmem + ICS_IDENT_OFFSET + 12) & 1) << 3; |
547 | iounmap(idmem); | 572 | ecardm_iounmap(ec, idmem); |
548 | 573 | ||
549 | state->type = type; | 574 | state->type = type; |
550 | } | 575 | } |
551 | 576 | ||
552 | memset(&ae, 0, sizeof(ae)); | 577 | memset(&info, 0, sizeof(info)); |
553 | INIT_LIST_HEAD(&ae.node); | 578 | info.state = state; |
554 | ae.dev = &ec->dev; | 579 | info.ec = ec; |
555 | ae.port_ops = &pata_icside_port_ops; | ||
556 | ae.sht = &pata_icside_sht; | ||
557 | ae.pio_mask = 0x1f; | ||
558 | ae.irq = ec->irq; | ||
559 | ae.port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST; | ||
560 | ae._host_flags = ATA_HOST_SIMPLEX; | ||
561 | ae.private_data = state; | ||
562 | 580 | ||
563 | switch (state->type) { | 581 | switch (state->type) { |
564 | case ICS_TYPE_A3IN: | 582 | case ICS_TYPE_A3IN: |
@@ -572,11 +590,11 @@ pata_icside_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
572 | break; | 590 | break; |
573 | 591 | ||
574 | case ICS_TYPE_V5: | 592 | case ICS_TYPE_V5: |
575 | ret = pata_icside_register_v5(&ae, ec); | 593 | ret = pata_icside_register_v5(&info); |
576 | break; | 594 | break; |
577 | 595 | ||
578 | case ICS_TYPE_V6: | 596 | case ICS_TYPE_V6: |
579 | ret = pata_icside_register_v6(&ae, ec); | 597 | ret = pata_icside_register_v6(&info); |
580 | break; | 598 | break; |
581 | 599 | ||
582 | default: | 600 | default: |
@@ -586,12 +604,11 @@ pata_icside_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
586 | } | 604 | } |
587 | 605 | ||
588 | if (ret == 0) | 606 | if (ret == 0) |
589 | ret = ata_device_add(&ae) == 0 ? -ENODEV : 0; | 607 | ret = pata_icside_add_ports(&info); |
590 | 608 | ||
591 | if (ret == 0) | 609 | if (ret == 0) |
592 | goto out; | 610 | goto out; |
593 | 611 | ||
594 | kfree(state); | ||
595 | release: | 612 | release: |
596 | ecard_release_resources(ec); | 613 | ecard_release_resources(ec); |
597 | out: | 614 | out: |
@@ -609,8 +626,7 @@ static void pata_icside_shutdown(struct expansion_card *ec) | |||
609 | * this register via that region. | 626 | * this register via that region. |
610 | */ | 627 | */ |
611 | local_irq_save(flags); | 628 | local_irq_save(flags); |
612 | if (ec->ops) | 629 | ec->ops->irqdisable(ec, ec->irq); |
613 | ec->ops->irqdisable(ec, ec->irq); | ||
614 | local_irq_restore(flags); | 630 | local_irq_restore(flags); |
615 | 631 | ||
616 | /* | 632 | /* |
@@ -638,17 +654,9 @@ static void __devexit pata_icside_remove(struct expansion_card *ec) | |||
638 | * don't NULL out the drvdata - devres/libata wants it | 654 | * don't NULL out the drvdata - devres/libata wants it |
639 | * to free the ata_host structure. | 655 | * to free the ata_host structure. |
640 | */ | 656 | */ |
641 | ec->ops = NULL; | ||
642 | ec->irq_data = NULL; | ||
643 | |||
644 | if (state->dma != NO_DMA) | 657 | if (state->dma != NO_DMA) |
645 | free_dma(state->dma); | 658 | free_dma(state->dma); |
646 | if (state->ioc_base) | ||
647 | iounmap(state->ioc_base); | ||
648 | if (state->ioc_base != state->irq_port) | ||
649 | iounmap(state->irq_port); | ||
650 | 659 | ||
651 | kfree(state); | ||
652 | ecard_release_resources(ec); | 660 | ecard_release_resources(ec); |
653 | } | 661 | } |
654 | 662 | ||
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 1fe0457243db..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 | ||
@@ -574,8 +573,8 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) | |||
574 | 573 | ||
575 | ec->irqaddr = base + ICS_ARCIN_V5_INTRSTAT; | 574 | ec->irqaddr = base + ICS_ARCIN_V5_INTRSTAT; |
576 | ec->irqmask = 1; | 575 | ec->irqmask = 1; |
577 | ec->irq_data = state; | 576 | |
578 | ec->ops = &icside_ops_arcin_v5; | 577 | ecard_setirq(ec, &icside_ops_arcin_v5, state); |
579 | 578 | ||
580 | /* | 579 | /* |
581 | * Be on the safe side - disable interrupts | 580 | * Be on the safe side - disable interrupts |
@@ -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 | /* |
@@ -630,8 +625,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
630 | 625 | ||
631 | writeb(sel, ioc_base); | 626 | writeb(sel, ioc_base); |
632 | 627 | ||
633 | ec->irq_data = state; | 628 | ecard_setirq(ec, &icside_ops_arcin_v6, state); |
634 | ec->ops = &icside_ops_arcin_v6; | ||
635 | 629 | ||
636 | state->irq_port = easi_base; | 630 | state->irq_port = easi_base; |
637 | state->ioc_base = ioc_base; | 631 | state->ioc_base = ioc_base; |
@@ -649,7 +643,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
649 | 643 | ||
650 | if (!hwif || !mate) { | 644 | if (!hwif || !mate) { |
651 | ret = -ENODEV; | 645 | ret = -ENODEV; |
652 | goto unmap_port; | 646 | goto out; |
653 | } | 647 | } |
654 | 648 | ||
655 | state->hwif[0] = hwif; | 649 | state->hwif[0] = hwif; |
@@ -686,11 +680,6 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
686 | 680 | ||
687 | return 0; | 681 | return 0; |
688 | 682 | ||
689 | unmap_port: | ||
690 | if (easi_base != ioc_base) | ||
691 | iounmap(easi_base); | ||
692 | unmap_slot: | ||
693 | iounmap(ioc_base); | ||
694 | out: | 683 | out: |
695 | return ret; | 684 | return ret; |
696 | } | 685 | } |
@@ -716,8 +705,7 @@ icside_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
716 | state->type = ICS_TYPE_NOTYPE; | 705 | state->type = ICS_TYPE_NOTYPE; |
717 | state->dev = &ec->dev; | 706 | state->dev = &ec->dev; |
718 | 707 | ||
719 | idmem = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), | 708 | idmem = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); |
720 | ecard_resource_len(ec, ECARD_RES_IOCFAST)); | ||
721 | if (idmem) { | 709 | if (idmem) { |
722 | unsigned int type; | 710 | unsigned int type; |
723 | 711 | ||
@@ -725,7 +713,7 @@ icside_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
725 | type |= (readb(idmem + ICS_IDENT_OFFSET + 4) & 1) << 1; | 713 | type |= (readb(idmem + ICS_IDENT_OFFSET + 4) & 1) << 1; |
726 | type |= (readb(idmem + ICS_IDENT_OFFSET + 8) & 1) << 2; | 714 | type |= (readb(idmem + ICS_IDENT_OFFSET + 8) & 1) << 2; |
727 | type |= (readb(idmem + ICS_IDENT_OFFSET + 12) & 1) << 3; | 715 | type |= (readb(idmem + ICS_IDENT_OFFSET + 12) & 1) << 3; |
728 | iounmap(idmem); | 716 | ecardm_iounmap(ec, idmem); |
729 | 717 | ||
730 | state->type = type; | 718 | state->type = type; |
731 | } | 719 | } |
@@ -793,13 +781,6 @@ static void __devexit icside_remove(struct expansion_card *ec) | |||
793 | } | 781 | } |
794 | 782 | ||
795 | ecard_set_drvdata(ec, NULL); | 783 | ecard_set_drvdata(ec, NULL); |
796 | ec->ops = NULL; | ||
797 | ec->irq_data = NULL; | ||
798 | |||
799 | if (state->ioc_base) | ||
800 | iounmap(state->ioc_base); | ||
801 | if (state->ioc_base != state->irq_port) | ||
802 | iounmap(state->irq_port); | ||
803 | 784 | ||
804 | kfree(state); | 785 | kfree(state); |
805 | ecard_release_resources(ec); | 786 | ecard_release_resources(ec); |
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 61f574aa3a99..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; |
@@ -710,8 +710,7 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
710 | * IRQ and control port handling - only for non-NIC slot cards. | 710 | * IRQ and control port handling - only for non-NIC slot cards. |
711 | */ | 711 | */ |
712 | if (ec->slot_no != 8) { | 712 | if (ec->slot_no != 8) { |
713 | ec->ops = ðerh_ops; | 713 | ecard_setirq(ec, ðerh_ops, eh); |
714 | ec->irq_data = eh; | ||
715 | } else { | 714 | } else { |
716 | /* | 715 | /* |
717 | * If we're in the NIC slot, make sure the IRQ is enabled | 716 | * If we're in the NIC slot, make sure the IRQ is enabled |
@@ -759,10 +758,6 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
759 | return 0; | 758 | return 0; |
760 | 759 | ||
761 | free: | 760 | free: |
762 | if (eh->ioc_fast) | ||
763 | iounmap(eh->ioc_fast); | ||
764 | if (eh->memc) | ||
765 | iounmap(eh->memc); | ||
766 | free_netdev(dev); | 761 | free_netdev(dev); |
767 | release: | 762 | release: |
768 | ecard_release_resources(ec); | 763 | ecard_release_resources(ec); |
@@ -773,16 +768,10 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
773 | static void __devexit etherh_remove(struct expansion_card *ec) | 768 | static void __devexit etherh_remove(struct expansion_card *ec) |
774 | { | 769 | { |
775 | struct net_device *dev = ecard_get_drvdata(ec); | 770 | struct net_device *dev = ecard_get_drvdata(ec); |
776 | struct etherh_priv *eh = etherh_priv(dev); | ||
777 | 771 | ||
778 | ecard_set_drvdata(ec, NULL); | 772 | ecard_set_drvdata(ec, NULL); |
779 | 773 | ||
780 | unregister_netdev(dev); | 774 | unregister_netdev(dev); |
781 | ec->ops = NULL; | ||
782 | |||
783 | if (eh->ioc_fast) | ||
784 | iounmap(eh->ioc_fast); | ||
785 | iounmap(eh->memc); | ||
786 | 775 | ||
787 | free_netdev(dev); | 776 | free_netdev(dev); |
788 | 777 | ||
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) | |||
348 | static void __devexit arxescsi_remove(struct expansion_card *ec) | 343 | static 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 82add77ad131..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); |
@@ -450,8 +447,8 @@ cumanascsi2_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
450 | 447 | ||
451 | ec->irqaddr = info->base + CUMANASCSI2_STATUS; | 448 | ec->irqaddr = info->base + CUMANASCSI2_STATUS; |
452 | ec->irqmask = STATUS_INT; | 449 | ec->irqmask = STATUS_INT; |
453 | ec->irq_data = info; | 450 | |
454 | ec->ops = &cumanascsi_2_ops; | 451 | ecard_setirq(ec, &cumanascsi_2_ops, info); |
455 | 452 | ||
456 | ret = fas216_init(host); | 453 | ret = fas216_init(host); |
457 | if (ret) | 454 | if (ret) |
@@ -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 ed06a8c19ad6..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); |
@@ -569,8 +566,8 @@ eesoxscsi_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
569 | 566 | ||
570 | ec->irqaddr = base + EESOX_DMASTAT; | 567 | ec->irqaddr = base + EESOX_DMASTAT; |
571 | ec->irqmask = EESOX_STAT_INTR; | 568 | ec->irqmask = EESOX_STAT_INTR; |
572 | ec->irq_data = info; | 569 | |
573 | ec->ops = &eesoxscsi_ops; | 570 | ecard_setirq(ec, &eesoxscsi_ops, info); |
574 | 571 | ||
575 | device_create_file(&ec->dev, &dev_attr_bus_term); | 572 | device_create_file(&ec->dev, &dev_attr_bus_term); |
576 | 573 | ||
@@ -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 159047a34997..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); |
@@ -361,8 +358,8 @@ powertecscsi_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
361 | 358 | ||
362 | ec->irqaddr = base + POWERTEC_INTR_STATUS; | 359 | ec->irqaddr = base + POWERTEC_INTR_STATUS; |
363 | ec->irqmask = POWERTEC_INTR_BIT; | 360 | ec->irqmask = POWERTEC_INTR_BIT; |
364 | ec->irq_data = info; | 361 | |
365 | ec->ops = &powertecscsi_ops; | 362 | ecard_setirq(ec, &powertecscsi_ops, info); |
366 | 363 | ||
367 | device_create_file(&ec->dev, &dev_attr_bus_term); | 364 | device_create_file(&ec->dev, &dev_attr_bus_term); |
368 | 365 | ||
@@ -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/drivers/serial/Kconfig b/drivers/serial/Kconfig index a6f5bfbb777b..315ea9916456 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -359,6 +359,23 @@ config SERIAL_ATMEL_TTYAT | |||
359 | 359 | ||
360 | Say Y if you have an external 8250/16C550 UART. If unsure, say N. | 360 | Say Y if you have an external 8250/16C550 UART. If unsure, say N. |
361 | 361 | ||
362 | config SERIAL_KS8695 | ||
363 | bool "Micrel KS8695 (Centaur) serial port support" | ||
364 | depends on ARCH_KS8695 | ||
365 | select SERIAL_CORE | ||
366 | help | ||
367 | This selects the Micrel Centaur KS8695 UART. Say Y here. | ||
368 | |||
369 | config SERIAL_KS8695_CONSOLE | ||
370 | bool "Support for console on KS8695 (Centaur) serial port" | ||
371 | depends on SERIAL_KS8695=y | ||
372 | select SERIAL_CORE_CONSOLE | ||
373 | help | ||
374 | Say Y here if you wish to use a KS8695 (Centaur) UART as the | ||
375 | system console (the system console is the device which | ||
376 | receives all kernel messages and warnings and which allows | ||
377 | logins in single user mode). | ||
378 | |||
362 | config SERIAL_CLPS711X | 379 | config SERIAL_CLPS711X |
363 | tristate "CLPS711X serial port support" | 380 | tristate "CLPS711X serial port support" |
364 | depends on ARM && ARCH_CLPS711X | 381 | depends on ARM && ARCH_CLPS711X |
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index 4959bcb8d1ef..08ad0d978183 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile | |||
@@ -61,3 +61,4 @@ obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o | |||
61 | obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o | 61 | obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o |
62 | obj-$(CONFIG_SERIAL_NETX) += netx-serial.o | 62 | obj-$(CONFIG_SERIAL_NETX) += netx-serial.o |
63 | obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o | 63 | obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o |
64 | obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o | ||
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c new file mode 100644 index 000000000000..c5346d677315 --- /dev/null +++ b/drivers/serial/serial_ks8695.c | |||
@@ -0,0 +1,657 @@ | |||
1 | /* | ||
2 | * drivers/serial/serial_ks8695.c | ||
3 | * | ||
4 | * Driver for KS8695 serial ports | ||
5 | * | ||
6 | * Based on drivers/serial/serial_amba.c, by Kam Lee. | ||
7 | * | ||
8 | * Copyright 2002-2005 Micrel Inc. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | */ | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/tty.h> | ||
18 | #include <linux/ioport.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/serial.h> | ||
21 | #include <linux/console.h> | ||
22 | #include <linux/sysrq.h> | ||
23 | #include <linux/device.h> | ||
24 | |||
25 | #include <asm/io.h> | ||
26 | #include <asm/irq.h> | ||
27 | #include <asm/mach/irq.h> | ||
28 | |||
29 | #include <asm/arch/regs-uart.h> | ||
30 | #include <asm/arch/regs-irq.h> | ||
31 | |||
32 | #if defined(CONFIG_SERIAL_KS8695_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | ||
33 | #define SUPPORT_SYSRQ | ||
34 | #endif | ||
35 | |||
36 | #include <linux/serial_core.h> | ||
37 | |||
38 | |||
39 | #define SERIAL_KS8695_MAJOR 204 | ||
40 | #define SERIAL_KS8695_MINOR 16 | ||
41 | #define SERIAL_KS8695_DEVNAME "ttyAM" | ||
42 | |||
43 | #define SERIAL_KS8695_NR 1 | ||
44 | |||
45 | /* | ||
46 | * Access macros for the KS8695 UART | ||
47 | */ | ||
48 | #define UART_GET_CHAR(p) (__raw_readl((p)->membase + KS8695_URRB) & 0xFF) | ||
49 | #define UART_PUT_CHAR(p, c) __raw_writel((c), (p)->membase + KS8695_URTH) | ||
50 | #define UART_GET_FCR(p) __raw_readl((p)->membase + KS8695_URFC) | ||
51 | #define UART_PUT_FCR(p, c) __raw_writel((c), (p)->membase + KS8695_URFC) | ||
52 | #define UART_GET_MSR(p) __raw_readl((p)->membase + KS8695_URMS) | ||
53 | #define UART_GET_LSR(p) __raw_readl((p)->membase + KS8695_URLS) | ||
54 | #define UART_GET_LCR(p) __raw_readl((p)->membase + KS8695_URLC) | ||
55 | #define UART_PUT_LCR(p, c) __raw_writel((c), (p)->membase + KS8695_URLC) | ||
56 | #define UART_GET_MCR(p) __raw_readl((p)->membase + KS8695_URMC) | ||
57 | #define UART_PUT_MCR(p, c) __raw_writel((c), (p)->membase + KS8695_URMC) | ||
58 | #define UART_GET_BRDR(p) __raw_readl((p)->membase + KS8695_URBD) | ||
59 | #define UART_PUT_BRDR(p, c) __raw_writel((c), (p)->membase + KS8695_URBD) | ||
60 | |||
61 | #define KS8695_CLR_TX_INT() __raw_writel(1 << KS8695_IRQ_UART_TX, KS8695_IRQ_VA + KS8695_INTST) | ||
62 | |||
63 | #define UART_DUMMY_LSR_RX 0x100 | ||
64 | #define UART_PORT_SIZE (KS8695_USR - KS8695_URRB + 4) | ||
65 | |||
66 | #define tx_enabled(port) ((port)->unused[0]) | ||
67 | #define rx_enabled(port) ((port)->unused[1]) | ||
68 | |||
69 | |||
70 | #ifdef SUPPORT_SYSRQ | ||
71 | static struct console ks8695_console; | ||
72 | #endif | ||
73 | |||
74 | static void ks8695uart_stop_tx(struct uart_port *port) | ||
75 | { | ||
76 | if (tx_enabled(port)) { | ||
77 | disable_irq(KS8695_IRQ_UART_TX); | ||
78 | tx_enabled(port) = 0; | ||
79 | } | ||
80 | } | ||
81 | |||
82 | static void ks8695uart_start_tx(struct uart_port *port) | ||
83 | { | ||
84 | if (!tx_enabled(port)) { | ||
85 | enable_irq(KS8695_IRQ_UART_TX); | ||
86 | tx_enabled(port) = 1; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | static void ks8695uart_stop_rx(struct uart_port *port) | ||
91 | { | ||
92 | if (rx_enabled(port)) { | ||
93 | disable_irq(KS8695_IRQ_UART_RX); | ||
94 | rx_enabled(port) = 0; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | static void ks8695uart_enable_ms(struct uart_port *port) | ||
99 | { | ||
100 | enable_irq(KS8695_IRQ_UART_MODEM_STATUS); | ||
101 | } | ||
102 | |||
103 | static void ks8695uart_disable_ms(struct uart_port *port) | ||
104 | { | ||
105 | disable_irq(KS8695_IRQ_UART_MODEM_STATUS); | ||
106 | } | ||
107 | |||
108 | static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id) | ||
109 | { | ||
110 | struct uart_port *port = dev_id; | ||
111 | struct tty_struct *tty = port->info->tty; | ||
112 | unsigned int status, ch, lsr, flg, max_count = 256; | ||
113 | |||
114 | status = UART_GET_LSR(port); /* clears pending LSR interrupts */ | ||
115 | while ((status & URLS_URDR) && max_count--) { | ||
116 | ch = UART_GET_CHAR(port); | ||
117 | flg = TTY_NORMAL; | ||
118 | |||
119 | port->icount.rx++; | ||
120 | |||
121 | /* | ||
122 | * Note that the error handling code is | ||
123 | * out of the main execution path | ||
124 | */ | ||
125 | lsr = UART_GET_LSR(port) | UART_DUMMY_LSR_RX; | ||
126 | if (unlikely(lsr & (URLS_URBI | URLS_URPE | URLS_URFE | URLS_URROE))) { | ||
127 | if (lsr & URLS_URBI) { | ||
128 | lsr &= ~(URLS_URFE | URLS_URPE); | ||
129 | port->icount.brk++; | ||
130 | if (uart_handle_break(port)) | ||
131 | goto ignore_char; | ||
132 | } | ||
133 | if (lsr & URLS_URPE) | ||
134 | port->icount.parity++; | ||
135 | if (lsr & URLS_URFE) | ||
136 | port->icount.frame++; | ||
137 | if (lsr & URLS_URROE) | ||
138 | port->icount.overrun++; | ||
139 | |||
140 | lsr &= port->read_status_mask; | ||
141 | |||
142 | if (lsr & URLS_URBI) | ||
143 | flg = TTY_BREAK; | ||
144 | else if (lsr & URLS_URPE) | ||
145 | flg = TTY_PARITY; | ||
146 | else if (lsr & URLS_URFE) | ||
147 | flg = TTY_FRAME; | ||
148 | } | ||
149 | |||
150 | if (uart_handle_sysrq_char(port, ch)) | ||
151 | goto ignore_char; | ||
152 | |||
153 | uart_insert_char(port, lsr, URLS_URROE, ch, flg); | ||
154 | |||
155 | ignore_char: | ||
156 | status = UART_GET_LSR(port); | ||
157 | } | ||
158 | tty_flip_buffer_push(tty); | ||
159 | |||
160 | return IRQ_HANDLED; | ||
161 | } | ||
162 | |||
163 | |||
164 | static irqreturn_t ks8695uart_tx_chars(int irq, void *dev_id) | ||
165 | { | ||
166 | struct uart_port *port = dev_id; | ||
167 | struct circ_buf *xmit = &port->info->xmit; | ||
168 | unsigned int count; | ||
169 | |||
170 | if (port->x_char) { | ||
171 | KS8695_CLR_TX_INT(); | ||
172 | UART_PUT_CHAR(port, port->x_char); | ||
173 | port->icount.tx++; | ||
174 | port->x_char = 0; | ||
175 | return IRQ_HANDLED; | ||
176 | } | ||
177 | |||
178 | if (uart_tx_stopped(port) || uart_circ_empty(xmit)) { | ||
179 | ks8695uart_stop_tx(port); | ||
180 | return IRQ_HANDLED; | ||
181 | } | ||
182 | |||
183 | count = 16; /* fifo size */ | ||
184 | while (!uart_circ_empty(xmit) && (count-- > 0)) { | ||
185 | KS8695_CLR_TX_INT(); | ||
186 | UART_PUT_CHAR(port, xmit->buf[xmit->tail]); | ||
187 | |||
188 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); | ||
189 | port->icount.tx++; | ||
190 | } | ||
191 | |||
192 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | ||
193 | uart_write_wakeup(port); | ||
194 | |||
195 | if (uart_circ_empty(xmit)) | ||
196 | ks8695uart_stop_tx(port); | ||
197 | |||
198 | return IRQ_HANDLED; | ||
199 | } | ||
200 | |||
201 | static irqreturn_t ks8695uart_modem_status(int irq, void *dev_id) | ||
202 | { | ||
203 | struct uart_port *port = dev_id; | ||
204 | unsigned int status; | ||
205 | |||
206 | /* | ||
207 | * clear modem interrupt by reading MSR | ||
208 | */ | ||
209 | status = UART_GET_MSR(port); | ||
210 | |||
211 | if (status & URMS_URDDCD) | ||
212 | uart_handle_dcd_change(port, status & URMS_URDDCD); | ||
213 | |||
214 | if (status & URMS_URDDST) | ||
215 | port->icount.dsr++; | ||
216 | |||
217 | if (status & URMS_URDCTS) | ||
218 | uart_handle_cts_change(port, status & URMS_URDCTS); | ||
219 | |||
220 | if (status & URMS_URTERI) | ||
221 | port->icount.rng++; | ||
222 | |||
223 | wake_up_interruptible(&port->info->delta_msr_wait); | ||
224 | |||
225 | return IRQ_HANDLED; | ||
226 | } | ||
227 | |||
228 | static unsigned int ks8695uart_tx_empty(struct uart_port *port) | ||
229 | { | ||
230 | return (UART_GET_LSR(port) & URLS_URTE) ? TIOCSER_TEMT : 0; | ||
231 | } | ||
232 | |||
233 | static unsigned int ks8695uart_get_mctrl(struct uart_port *port) | ||
234 | { | ||
235 | unsigned int result = 0; | ||
236 | unsigned int status; | ||
237 | |||
238 | status = UART_GET_MSR(port); | ||
239 | if (status & URMS_URDCD) | ||
240 | result |= TIOCM_CAR; | ||
241 | if (status & URMS_URDSR) | ||
242 | result |= TIOCM_DSR; | ||
243 | if (status & URMS_URCTS) | ||
244 | result |= TIOCM_CTS; | ||
245 | if (status & URMS_URRI) | ||
246 | result |= TIOCM_RI; | ||
247 | |||
248 | return result; | ||
249 | } | ||
250 | |||
251 | static void ks8695uart_set_mctrl(struct uart_port *port, u_int mctrl) | ||
252 | { | ||
253 | unsigned int mcr; | ||
254 | |||
255 | mcr = UART_GET_MCR(port); | ||
256 | if (mctrl & TIOCM_RTS) | ||
257 | mcr |= URMC_URRTS; | ||
258 | else | ||
259 | mcr &= ~URMC_URRTS; | ||
260 | |||
261 | if (mctrl & TIOCM_DTR) | ||
262 | mcr |= URMC_URDTR; | ||
263 | else | ||
264 | mcr &= ~URMC_URDTR; | ||
265 | |||
266 | UART_PUT_MCR(port, mcr); | ||
267 | } | ||
268 | |||
269 | static void ks8695uart_break_ctl(struct uart_port *port, int break_state) | ||
270 | { | ||
271 | unsigned int lcr; | ||
272 | |||
273 | lcr = UART_GET_LCR(port); | ||
274 | |||
275 | if (break_state == -1) | ||
276 | lcr |= URLC_URSBC; | ||
277 | else | ||
278 | lcr &= ~URLC_URSBC; | ||
279 | |||
280 | UART_PUT_LCR(port, lcr); | ||
281 | } | ||
282 | |||
283 | static int ks8695uart_startup(struct uart_port *port) | ||
284 | { | ||
285 | int retval; | ||
286 | |||
287 | set_irq_flags(KS8695_IRQ_UART_TX, IRQF_VALID | IRQF_NOAUTOEN); | ||
288 | tx_enabled(port) = 0; | ||
289 | rx_enabled(port) = 1; | ||
290 | |||
291 | /* | ||
292 | * Allocate the IRQ | ||
293 | */ | ||
294 | retval = request_irq(KS8695_IRQ_UART_TX, ks8695uart_tx_chars, IRQF_DISABLED, "UART TX", port); | ||
295 | if (retval) | ||
296 | goto err_tx; | ||
297 | |||
298 | retval = request_irq(KS8695_IRQ_UART_RX, ks8695uart_rx_chars, IRQF_DISABLED, "UART RX", port); | ||
299 | if (retval) | ||
300 | goto err_rx; | ||
301 | |||
302 | retval = request_irq(KS8695_IRQ_UART_LINE_STATUS, ks8695uart_rx_chars, IRQF_DISABLED, "UART LineStatus", port); | ||
303 | if (retval) | ||
304 | return err_ls; | ||
305 | |||
306 | retval = request_irq(KS8695_IRQ_UART_MODEM_STATUS, ks8695uart_modem_status, IRQF_DISABLED, "UART ModemStatus", port); | ||
307 | if (retval) | ||
308 | return err_ms; | ||
309 | |||
310 | return 0; | ||
311 | |||
312 | err_ms: | ||
313 | free_irq(KS8695_IRQ_UART_LINE_STATUS, port); | ||
314 | err_ls: | ||
315 | free_irq(KS8695_IRQ_UART_RX, port); | ||
316 | err_rx: | ||
317 | free_irq(KS8695_IRQ_UART_TX, port); | ||
318 | err_tx: | ||
319 | return retval; | ||
320 | } | ||
321 | |||
322 | static void ks8695uart_shutdown(struct uart_port *port) | ||
323 | { | ||
324 | /* | ||
325 | * Free the interrupt | ||
326 | */ | ||
327 | free_irq(KS8695_IRQ_UART_RX, port); | ||
328 | free_irq(KS8695_IRQ_UART_TX, port); | ||
329 | free_irq(KS8695_IRQ_UART_MODEM_STATUS, port); | ||
330 | free_irq(KS8695_IRQ_UART_LINE_STATUS, port); | ||
331 | |||
332 | /* disable break condition and fifos */ | ||
333 | UART_PUT_LCR(port, UART_GET_LCR(port) & ~URLC_URSBC); | ||
334 | UART_PUT_FCR(port, UART_GET_FCR(port) & ~URFC_URFE); | ||
335 | } | ||
336 | |||
337 | static void ks8695uart_set_termios(struct uart_port *port, struct ktermios *termios, struct ktermios *old) | ||
338 | { | ||
339 | unsigned int lcr, fcr = 0; | ||
340 | unsigned long flags; | ||
341 | unsigned int baud, quot; | ||
342 | |||
343 | /* | ||
344 | * Ask the core to calculate the divisor for us. | ||
345 | */ | ||
346 | baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); | ||
347 | quot = uart_get_divisor(port, baud); | ||
348 | |||
349 | switch (termios->c_cflag & CSIZE) { | ||
350 | case CS5: | ||
351 | lcr = URCL_5; | ||
352 | break; | ||
353 | case CS6: | ||
354 | lcr = URCL_6; | ||
355 | break; | ||
356 | case CS7: | ||
357 | lcr = URCL_7; | ||
358 | break; | ||
359 | default: | ||
360 | lcr = URCL_8; | ||
361 | break; | ||
362 | } | ||
363 | |||
364 | /* stop bits */ | ||
365 | if (termios->c_cflag & CSTOPB) | ||
366 | lcr |= URLC_URSB; | ||
367 | |||
368 | /* parity */ | ||
369 | if (termios->c_cflag & PARENB) { | ||
370 | if (termios->c_cflag & CMSPAR) { /* Mark or Space parity */ | ||
371 | if (termios->c_cflag & PARODD) | ||
372 | lcr |= URPE_MARK; | ||
373 | else | ||
374 | lcr |= URPE_SPACE; | ||
375 | } | ||
376 | else if (termios->c_cflag & PARODD) | ||
377 | lcr |= URPE_ODD; | ||
378 | else | ||
379 | lcr |= URPE_EVEN; | ||
380 | } | ||
381 | |||
382 | if (port->fifosize > 1) | ||
383 | fcr = URFC_URFRT_8 | URFC_URTFR | URFC_URRFR | URFC_URFE; | ||
384 | |||
385 | spin_lock_irqsave(&port->lock, flags); | ||
386 | |||
387 | /* | ||
388 | * Update the per-port timeout. | ||
389 | */ | ||
390 | uart_update_timeout(port, termios->c_cflag, baud); | ||
391 | |||
392 | port->read_status_mask = URLS_URROE; | ||
393 | if (termios->c_iflag & INPCK) | ||
394 | port->read_status_mask |= (URLS_URFE | URLS_URPE); | ||
395 | if (termios->c_iflag & (BRKINT | PARMRK)) | ||
396 | port->read_status_mask |= URLS_URBI; | ||
397 | |||
398 | /* | ||
399 | * Characters to ignore | ||
400 | */ | ||
401 | port->ignore_status_mask = 0; | ||
402 | if (termios->c_iflag & IGNPAR) | ||
403 | port->ignore_status_mask |= (URLS_URFE | URLS_URPE); | ||
404 | if (termios->c_iflag & IGNBRK) { | ||
405 | port->ignore_status_mask |= URLS_URBI; | ||
406 | /* | ||
407 | * If we're ignoring parity and break indicators, | ||
408 | * ignore overruns too (for real raw support). | ||
409 | */ | ||
410 | if (termios->c_iflag & IGNPAR) | ||
411 | port->ignore_status_mask |= URLS_URROE; | ||
412 | } | ||
413 | |||
414 | /* | ||
415 | * Ignore all characters if CREAD is not set. | ||
416 | */ | ||
417 | if ((termios->c_cflag & CREAD) == 0) | ||
418 | port->ignore_status_mask |= UART_DUMMY_LSR_RX; | ||
419 | |||
420 | /* first, disable everything */ | ||
421 | if (UART_ENABLE_MS(port, termios->c_cflag)) | ||
422 | ks8695uart_enable_ms(port); | ||
423 | else | ||
424 | ks8695uart_disable_ms(port); | ||
425 | |||
426 | /* Set baud rate */ | ||
427 | UART_PUT_BRDR(port, quot); | ||
428 | |||
429 | UART_PUT_LCR(port, lcr); | ||
430 | UART_PUT_FCR(port, fcr); | ||
431 | |||
432 | spin_unlock_irqrestore(&port->lock, flags); | ||
433 | } | ||
434 | |||
435 | static const char *ks8695uart_type(struct uart_port *port) | ||
436 | { | ||
437 | return port->type == PORT_KS8695 ? "KS8695" : NULL; | ||
438 | } | ||
439 | |||
440 | /* | ||
441 | * Release the memory region(s) being used by 'port' | ||
442 | */ | ||
443 | static void ks8695uart_release_port(struct uart_port *port) | ||
444 | { | ||
445 | release_mem_region(port->mapbase, UART_PORT_SIZE); | ||
446 | } | ||
447 | |||
448 | /* | ||
449 | * Request the memory region(s) being used by 'port' | ||
450 | */ | ||
451 | static int ks8695uart_request_port(struct uart_port *port) | ||
452 | { | ||
453 | return request_mem_region(port->mapbase, UART_PORT_SIZE, | ||
454 | "serial_ks8695") != NULL ? 0 : -EBUSY; | ||
455 | } | ||
456 | |||
457 | /* | ||
458 | * Configure/autoconfigure the port. | ||
459 | */ | ||
460 | static void ks8695uart_config_port(struct uart_port *port, int flags) | ||
461 | { | ||
462 | if (flags & UART_CONFIG_TYPE) { | ||
463 | port->type = PORT_KS8695; | ||
464 | ks8695uart_request_port(port); | ||
465 | } | ||
466 | } | ||
467 | |||
468 | /* | ||
469 | * verify the new serial_struct (for TIOCSSERIAL). | ||
470 | */ | ||
471 | static int ks8695uart_verify_port(struct uart_port *port, struct serial_struct *ser) | ||
472 | { | ||
473 | int ret = 0; | ||
474 | |||
475 | if (ser->type != PORT_UNKNOWN && ser->type != PORT_KS8695) | ||
476 | ret = -EINVAL; | ||
477 | if (ser->irq != port->irq) | ||
478 | ret = -EINVAL; | ||
479 | if (ser->baud_base < 9600) | ||
480 | ret = -EINVAL; | ||
481 | return ret; | ||
482 | } | ||
483 | |||
484 | static struct uart_ops ks8695uart_pops = { | ||
485 | .tx_empty = ks8695uart_tx_empty, | ||
486 | .set_mctrl = ks8695uart_set_mctrl, | ||
487 | .get_mctrl = ks8695uart_get_mctrl, | ||
488 | .stop_tx = ks8695uart_stop_tx, | ||
489 | .start_tx = ks8695uart_start_tx, | ||
490 | .stop_rx = ks8695uart_stop_rx, | ||
491 | .enable_ms = ks8695uart_enable_ms, | ||
492 | .break_ctl = ks8695uart_break_ctl, | ||
493 | .startup = ks8695uart_startup, | ||
494 | .shutdown = ks8695uart_shutdown, | ||
495 | .set_termios = ks8695uart_set_termios, | ||
496 | .type = ks8695uart_type, | ||
497 | .release_port = ks8695uart_release_port, | ||
498 | .request_port = ks8695uart_request_port, | ||
499 | .config_port = ks8695uart_config_port, | ||
500 | .verify_port = ks8695uart_verify_port, | ||
501 | }; | ||
502 | |||
503 | static struct uart_port ks8695uart_ports[SERIAL_KS8695_NR] = { | ||
504 | { | ||
505 | .membase = (void *) KS8695_UART_VA, | ||
506 | .mapbase = KS8695_UART_VA, | ||
507 | .iotype = SERIAL_IO_MEM, | ||
508 | .irq = KS8695_IRQ_UART_TX, | ||
509 | .uartclk = CLOCK_TICK_RATE * 16, | ||
510 | .fifosize = 16, | ||
511 | .ops = &ks8695uart_pops, | ||
512 | .flags = ASYNC_BOOT_AUTOCONF, | ||
513 | .line = 0, | ||
514 | } | ||
515 | }; | ||
516 | |||
517 | #ifdef CONFIG_SERIAL_KS8695_CONSOLE | ||
518 | static void ks8695_console_putchar(struct uart_port *port, int ch) | ||
519 | { | ||
520 | while (!(UART_GET_LSR(port) & URLS_URTHRE)) | ||
521 | barrier(); | ||
522 | |||
523 | UART_PUT_CHAR(port, ch); | ||
524 | } | ||
525 | |||
526 | static void ks8695_console_write(struct console *co, const char *s, u_int count) | ||
527 | { | ||
528 | struct uart_port *port = ks8695uart_ports + co->index; | ||
529 | |||
530 | uart_console_write(port, s, count, ks8695_console_putchar); | ||
531 | } | ||
532 | |||
533 | static void __init ks8695_console_get_options(struct uart_port *port, int *baud, int *parity, int *bits) | ||
534 | { | ||
535 | unsigned int lcr; | ||
536 | |||
537 | lcr = UART_GET_LCR(port); | ||
538 | |||
539 | switch (lcr & URLC_PARITY) { | ||
540 | case URPE_ODD: | ||
541 | *parity = 'o'; | ||
542 | break; | ||
543 | case URPE_EVEN: | ||
544 | *parity = 'e'; | ||
545 | break; | ||
546 | default: | ||
547 | *parity = 'n'; | ||
548 | } | ||
549 | |||
550 | switch (lcr & URLC_URCL) { | ||
551 | case URCL_5: | ||
552 | *bits = 5; | ||
553 | break; | ||
554 | case URCL_6: | ||
555 | *bits = 6; | ||
556 | break; | ||
557 | case URCL_7: | ||
558 | *bits = 7; | ||
559 | break; | ||
560 | default: | ||
561 | *bits = 8; | ||
562 | } | ||
563 | |||
564 | *baud = port->uartclk / (UART_GET_BRDR(port) & 0x0FFF); | ||
565 | *baud /= 16; | ||
566 | *baud &= 0xFFFFFFF0; | ||
567 | } | ||
568 | |||
569 | static int __init ks8695_console_setup(struct console *co, char *options) | ||
570 | { | ||
571 | struct uart_port *port; | ||
572 | int baud = 115200; | ||
573 | int bits = 8; | ||
574 | int parity = 'n'; | ||
575 | int flow = 'n'; | ||
576 | |||
577 | /* | ||
578 | * Check whether an invalid uart number has been specified, and | ||
579 | * if so, search for the first available port that does have | ||
580 | * console support. | ||
581 | */ | ||
582 | port = uart_get_console(ks8695uart_ports, SERIAL_KS8695_NR, co); | ||
583 | |||
584 | if (options) | ||
585 | uart_parse_options(options, &baud, &parity, &bits, &flow); | ||
586 | else | ||
587 | ks8695_console_get_options(port, &baud, &parity, &bits); | ||
588 | |||
589 | return uart_set_options(port, co, baud, parity, bits, flow); | ||
590 | } | ||
591 | |||
592 | extern struct uart_driver ks8695_reg; | ||
593 | |||
594 | static struct console ks8695_console = { | ||
595 | .name = SERIAL_KS8695_DEVNAME, | ||
596 | .write = ks8695_console_write, | ||
597 | .device = uart_console_device, | ||
598 | .setup = ks8695_console_setup, | ||
599 | .flags = CON_PRINTBUFFER, | ||
600 | .index = -1, | ||
601 | .data = &ks8695_reg, | ||
602 | }; | ||
603 | |||
604 | static int __init ks8695_console_init(void) | ||
605 | { | ||
606 | register_console(&ks8695_console); | ||
607 | return 0; | ||
608 | } | ||
609 | |||
610 | console_initcall(ks8695_console_init); | ||
611 | |||
612 | #define KS8695_CONSOLE &ks8695_console | ||
613 | #else | ||
614 | #define KS8695_CONSOLE NULL | ||
615 | #endif | ||
616 | |||
617 | static struct uart_driver ks8695_reg = { | ||
618 | .owner = THIS_MODULE, | ||
619 | .driver_name = "serial_ks8695", | ||
620 | .dev_name = SERIAL_KS8695_DEVNAME, | ||
621 | .major = SERIAL_KS8695_MAJOR, | ||
622 | .minor = SERIAL_KS8695_MINOR, | ||
623 | .nr = SERIAL_KS8695_NR, | ||
624 | .cons = KS8695_CONSOLE, | ||
625 | }; | ||
626 | |||
627 | static int __init ks8695uart_init(void) | ||
628 | { | ||
629 | int i, ret; | ||
630 | |||
631 | printk(KERN_INFO "Serial: Micrel KS8695 UART driver\n"); | ||
632 | |||
633 | ret = uart_register_driver(&ks8695_reg); | ||
634 | if (ret) | ||
635 | return ret; | ||
636 | |||
637 | for (i = 0; i < SERIAL_KS8695_NR; i++) | ||
638 | uart_add_one_port(&ks8695_reg, &ks8695uart_ports[0]); | ||
639 | |||
640 | return 0; | ||
641 | } | ||
642 | |||
643 | static void __exit ks8695uart_exit(void) | ||
644 | { | ||
645 | int i; | ||
646 | |||
647 | for (i = 0; i < SERIAL_KS8695_NR; i++) | ||
648 | uart_remove_one_port(&ks8695_reg, &ks8695uart_ports[0]); | ||
649 | uart_unregister_driver(&ks8695_reg); | ||
650 | } | ||
651 | |||
652 | module_init(ks8695uart_init); | ||
653 | module_exit(ks8695uart_exit); | ||
654 | |||
655 | MODULE_DESCRIPTION("KS8695 serial port driver"); | ||
656 | MODULE_AUTHOR("Micrel Inc."); | ||
657 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 8065f2b53701..f771a7cae9ec 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -210,7 +210,7 @@ config USB_OTG | |||
210 | 210 | ||
211 | config USB_GADGET_AT91 | 211 | config USB_GADGET_AT91 |
212 | boolean "AT91 USB Device Port" | 212 | boolean "AT91 USB Device Port" |
213 | depends on ARCH_AT91 | 213 | depends on ARCH_AT91 && !ARCH_AT91SAM9RL |
214 | select USB_GADGET_SELECTED | 214 | select USB_GADGET_SELECTED |
215 | help | 215 | help |
216 | Many Atmel AT91 processors (such as the AT91RM2000) have a | 216 | Many Atmel AT91 processors (such as the AT91RM2000) have a |