diff options
Diffstat (limited to 'drivers/ide/mips/au1xxx-ide.c')
-rw-r--r-- | drivers/ide/mips/au1xxx-ide.c | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index 48d57cae63c6..11b7f61aae40 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c | |||
@@ -519,6 +519,23 @@ static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif) | |||
519 | *ata_regs = ahwif->regbase + (14 << IDE_REG_SHIFT); | 519 | *ata_regs = ahwif->regbase + (14 << IDE_REG_SHIFT); |
520 | } | 520 | } |
521 | 521 | ||
522 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA | ||
523 | static const struct ide_tp_ops au1xxx_tp_ops = { | ||
524 | .exec_command = ide_exec_command, | ||
525 | .read_status = ide_read_status, | ||
526 | .read_altstatus = ide_read_altstatus, | ||
527 | .read_sff_dma_status = ide_read_sff_dma_status, | ||
528 | |||
529 | .set_irq = ide_set_irq, | ||
530 | |||
531 | .tf_load = ide_tf_load, | ||
532 | .tf_read = ide_tf_read, | ||
533 | |||
534 | .input_data = au1xxx_input_data, | ||
535 | .output_data = au1xxx_output_data, | ||
536 | }; | ||
537 | #endif | ||
538 | |||
522 | static const struct ide_port_ops au1xxx_port_ops = { | 539 | static const struct ide_port_ops au1xxx_port_ops = { |
523 | .set_pio_mode = au1xxx_set_pio_mode, | 540 | .set_pio_mode = au1xxx_set_pio_mode, |
524 | .set_dma_mode = auide_set_dma_mode, | 541 | .set_dma_mode = auide_set_dma_mode, |
@@ -526,6 +543,9 @@ static const struct ide_port_ops au1xxx_port_ops = { | |||
526 | 543 | ||
527 | static const struct ide_port_info au1xxx_port_info = { | 544 | static const struct ide_port_info au1xxx_port_info = { |
528 | .init_dma = auide_ddma_init, | 545 | .init_dma = auide_ddma_init, |
546 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA | ||
547 | .tp_ops = &au1xxx_tp_ops, | ||
548 | #endif | ||
529 | .port_ops = &au1xxx_port_ops, | 549 | .port_ops = &au1xxx_port_ops, |
530 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | 550 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA |
531 | .dma_ops = &au1xxx_dma_ops, | 551 | .dma_ops = &au1xxx_dma_ops, |
@@ -543,11 +563,10 @@ static int au_ide_probe(struct device *dev) | |||
543 | { | 563 | { |
544 | struct platform_device *pdev = to_platform_device(dev); | 564 | struct platform_device *pdev = to_platform_device(dev); |
545 | _auide_hwif *ahwif = &auide_hwif; | 565 | _auide_hwif *ahwif = &auide_hwif; |
546 | ide_hwif_t *hwif; | ||
547 | struct resource *res; | 566 | struct resource *res; |
567 | struct ide_host *host; | ||
548 | int ret = 0; | 568 | int ret = 0; |
549 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 569 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
550 | hw_regs_t hw; | ||
551 | 570 | ||
552 | #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) | 571 | #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) |
553 | char *mode = "MWDMA2"; | 572 | char *mode = "MWDMA2"; |
@@ -584,36 +603,19 @@ static int au_ide_probe(struct device *dev) | |||
584 | goto out; | 603 | goto out; |
585 | } | 604 | } |
586 | 605 | ||
587 | hwif = ide_find_port(); | ||
588 | if (hwif == NULL) { | ||
589 | ret = -ENOENT; | ||
590 | goto out; | ||
591 | } | ||
592 | |||
593 | memset(&hw, 0, sizeof(hw)); | 606 | memset(&hw, 0, sizeof(hw)); |
594 | auide_setup_ports(&hw, ahwif); | 607 | auide_setup_ports(&hw, ahwif); |
595 | hw.irq = ahwif->irq; | 608 | hw.irq = ahwif->irq; |
596 | hw.dev = dev; | 609 | hw.dev = dev; |
597 | hw.chipset = ide_au1xxx; | 610 | hw.chipset = ide_au1xxx; |
598 | 611 | ||
599 | ide_init_port_hw(hwif, &hw); | 612 | ret = ide_host_add(&au1xxx_port_info, hws, &host); |
600 | 613 | if (ret) | |
601 | /* If the user has selected DDMA assisted copies, | 614 | goto out; |
602 | then set up a few local I/O function entry points | ||
603 | */ | ||
604 | |||
605 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA | ||
606 | hwif->input_data = au1xxx_input_data; | ||
607 | hwif->output_data = au1xxx_output_data; | ||
608 | #endif | ||
609 | |||
610 | auide_hwif.hwif = hwif; | ||
611 | |||
612 | idx[0] = hwif->index; | ||
613 | 615 | ||
614 | ide_device_add(idx, &au1xxx_port_info); | 616 | auide_hwif.hwif = host->ports[0]; |
615 | 617 | ||
616 | dev_set_drvdata(dev, hwif); | 618 | dev_set_drvdata(dev, host); |
617 | 619 | ||
618 | printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode ); | 620 | printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode ); |
619 | 621 | ||
@@ -625,10 +627,10 @@ static int au_ide_remove(struct device *dev) | |||
625 | { | 627 | { |
626 | struct platform_device *pdev = to_platform_device(dev); | 628 | struct platform_device *pdev = to_platform_device(dev); |
627 | struct resource *res; | 629 | struct resource *res; |
628 | ide_hwif_t *hwif = dev_get_drvdata(dev); | 630 | struct ide_host *host = dev_get_drvdata(dev); |
629 | _auide_hwif *ahwif = &auide_hwif; | 631 | _auide_hwif *ahwif = &auide_hwif; |
630 | 632 | ||
631 | ide_unregister(hwif); | 633 | ide_host_remove(host); |
632 | 634 | ||
633 | iounmap((void *)ahwif->regbase); | 635 | iounmap((void *)ahwif->regbase); |
634 | 636 | ||