diff options
Diffstat (limited to 'drivers/ide/arm/icside.c')
-rw-r--r-- | drivers/ide/arm/icside.c | 71 |
1 files changed, 31 insertions, 40 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 52f58c885783..f575e8341aec 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
@@ -72,7 +72,7 @@ struct icside_state { | |||
72 | void __iomem *ioc_base; | 72 | void __iomem *ioc_base; |
73 | unsigned int sel; | 73 | unsigned int sel; |
74 | unsigned int type; | 74 | unsigned int type; |
75 | ide_hwif_t *hwif[2]; | 75 | struct ide_host *host; |
76 | }; | 76 | }; |
77 | 77 | ||
78 | #define ICS_TYPE_A3IN 0 | 78 | #define ICS_TYPE_A3IN 0 |
@@ -375,12 +375,14 @@ static int icside_dma_test_irq(ide_drive_t *drive) | |||
375 | 375 | ||
376 | static void icside_dma_timeout(ide_drive_t *drive) | 376 | static void icside_dma_timeout(ide_drive_t *drive) |
377 | { | 377 | { |
378 | ide_hwif_t *hwif = drive->hwif; | ||
379 | |||
378 | printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name); | 380 | printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name); |
379 | 381 | ||
380 | if (icside_dma_test_irq(drive)) | 382 | if (icside_dma_test_irq(drive)) |
381 | return; | 383 | return; |
382 | 384 | ||
383 | ide_dump_status(drive, "DMA timeout", ide_read_status(drive)); | 385 | ide_dump_status(drive, "DMA timeout", hwif->tp_ops->read_status(hwif)); |
384 | 386 | ||
385 | icside_dma_end(drive); | 387 | icside_dma_end(drive); |
386 | } | 388 | } |
@@ -440,10 +442,10 @@ static void icside_setup_ports(hw_regs_t *hw, void __iomem *base, | |||
440 | static int __init | 442 | static int __init |
441 | icside_register_v5(struct icside_state *state, struct expansion_card *ec) | 443 | icside_register_v5(struct icside_state *state, struct expansion_card *ec) |
442 | { | 444 | { |
443 | ide_hwif_t *hwif; | ||
444 | void __iomem *base; | 445 | void __iomem *base; |
445 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 446 | struct ide_host *host; |
446 | hw_regs_t hw; | 447 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
448 | int ret; | ||
447 | 449 | ||
448 | base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); | 450 | base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); |
449 | if (!base) | 451 | if (!base) |
@@ -463,22 +465,23 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) | |||
463 | 465 | ||
464 | icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec); | 466 | icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec); |
465 | 467 | ||
466 | hwif = ide_find_port(); | 468 | host = ide_host_alloc(NULL, hws); |
467 | if (!hwif) | 469 | if (host == NULL) |
468 | return -ENODEV; | 470 | return -ENODEV; |
469 | 471 | ||
470 | ide_init_port_hw(hwif, &hw); | 472 | state->host = host; |
471 | default_hwif_mmiops(hwif); | ||
472 | |||
473 | state->hwif[0] = hwif; | ||
474 | 473 | ||
475 | ecard_set_drvdata(ec, state); | 474 | ecard_set_drvdata(ec, state); |
476 | 475 | ||
477 | idx[0] = hwif->index; | 476 | ret = ide_host_register(host, NULL, hws); |
478 | 477 | if (ret) | |
479 | ide_device_add(idx, NULL); | 478 | goto err_free; |
480 | 479 | ||
481 | return 0; | 480 | return 0; |
481 | err_free: | ||
482 | ide_host_free(host); | ||
483 | ecard_set_drvdata(ec, NULL); | ||
484 | return ret; | ||
482 | } | 485 | } |
483 | 486 | ||
484 | static const struct ide_port_info icside_v6_port_info __initdata = { | 487 | static const struct ide_port_info icside_v6_port_info __initdata = { |
@@ -493,13 +496,12 @@ static const struct ide_port_info icside_v6_port_info __initdata = { | |||
493 | static int __init | 496 | static int __init |
494 | icside_register_v6(struct icside_state *state, struct expansion_card *ec) | 497 | icside_register_v6(struct icside_state *state, struct expansion_card *ec) |
495 | { | 498 | { |
496 | ide_hwif_t *hwif, *mate; | ||
497 | void __iomem *ioc_base, *easi_base; | 499 | void __iomem *ioc_base, *easi_base; |
500 | struct ide_host *host; | ||
498 | unsigned int sel = 0; | 501 | unsigned int sel = 0; |
499 | int ret; | 502 | int ret; |
500 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 503 | hw_regs_t hw[2], *hws[] = { &hw[0], NULL, NULL, NULL }; |
501 | struct ide_port_info d = icside_v6_port_info; | 504 | struct ide_port_info d = icside_v6_port_info; |
502 | hw_regs_t hw[2]; | ||
503 | 505 | ||
504 | ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); | 506 | ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); |
505 | if (!ioc_base) { | 507 | if (!ioc_base) { |
@@ -538,28 +540,11 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
538 | icside_setup_ports(&hw[0], easi_base, &icside_cardinfo_v6_1, ec); | 540 | icside_setup_ports(&hw[0], easi_base, &icside_cardinfo_v6_1, ec); |
539 | icside_setup_ports(&hw[1], easi_base, &icside_cardinfo_v6_2, ec); | 541 | icside_setup_ports(&hw[1], easi_base, &icside_cardinfo_v6_2, ec); |
540 | 542 | ||
541 | /* | 543 | host = ide_host_alloc(&d, hws); |
542 | * Find and register the interfaces. | 544 | if (host == NULL) |
543 | */ | ||
544 | hwif = ide_find_port(); | ||
545 | if (hwif == NULL) | ||
546 | return -ENODEV; | 545 | return -ENODEV; |
547 | 546 | ||
548 | ide_init_port_hw(hwif, &hw[0]); | 547 | state->host = host; |
549 | default_hwif_mmiops(hwif); | ||
550 | |||
551 | idx[0] = hwif->index; | ||
552 | |||
553 | mate = ide_find_port(); | ||
554 | if (mate) { | ||
555 | ide_init_port_hw(mate, &hw[1]); | ||
556 | default_hwif_mmiops(mate); | ||
557 | |||
558 | idx[1] = mate->index; | ||
559 | } | ||
560 | |||
561 | state->hwif[0] = hwif; | ||
562 | state->hwif[1] = mate; | ||
563 | 548 | ||
564 | ecard_set_drvdata(ec, state); | 549 | ecard_set_drvdata(ec, state); |
565 | 550 | ||
@@ -569,11 +554,17 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
569 | d.dma_ops = NULL; | 554 | d.dma_ops = NULL; |
570 | } | 555 | } |
571 | 556 | ||
572 | ide_device_add(idx, &d); | 557 | ret = ide_host_register(host, NULL, hws); |
558 | if (ret) | ||
559 | goto err_free; | ||
573 | 560 | ||
574 | return 0; | 561 | return 0; |
575 | 562 | err_free: | |
576 | out: | 563 | ide_host_free(host); |
564 | if (d.dma_ops) | ||
565 | free_dma(ec->dma); | ||
566 | ecard_set_drvdata(ec, NULL); | ||
567 | out: | ||
577 | return ret; | 568 | return ret; |
578 | } | 569 | } |
579 | 570 | ||