diff options
Diffstat (limited to 'drivers/ata/pata_it821x.c')
-rw-r--r-- | drivers/ata/pata_it821x.c | 109 |
1 files changed, 32 insertions, 77 deletions
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index 257951d03dbb..e10816931b2f 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -395,11 +395,11 @@ static void it821x_passthru_dev_select(struct ata_port *ap, | |||
395 | it821x_program(ap, adev, itdev->pio[adev->devno]); | 395 | it821x_program(ap, adev, itdev->pio[adev->devno]); |
396 | itdev->last_device = device; | 396 | itdev->last_device = device; |
397 | } | 397 | } |
398 | ata_std_dev_select(ap, device); | 398 | ata_sff_dev_select(ap, device); |
399 | } | 399 | } |
400 | 400 | ||
401 | /** | 401 | /** |
402 | * it821x_smart_qc_issue_prot - wrap qc issue prot | 402 | * it821x_smart_qc_issue - wrap qc issue prot |
403 | * @qc: command | 403 | * @qc: command |
404 | * | 404 | * |
405 | * Wrap the command issue sequence for the IT821x. We need to | 405 | * Wrap the command issue sequence for the IT821x. We need to |
@@ -407,7 +407,7 @@ static void it821x_passthru_dev_select(struct ata_port *ap, | |||
407 | * usual happenings kick off | 407 | * usual happenings kick off |
408 | */ | 408 | */ |
409 | 409 | ||
410 | static unsigned int it821x_smart_qc_issue_prot(struct ata_queued_cmd *qc) | 410 | static unsigned int it821x_smart_qc_issue(struct ata_queued_cmd *qc) |
411 | { | 411 | { |
412 | switch(qc->tf.command) | 412 | switch(qc->tf.command) |
413 | { | 413 | { |
@@ -427,14 +427,14 @@ static unsigned int it821x_smart_qc_issue_prot(struct ata_queued_cmd *qc) | |||
427 | case ATA_CMD_ID_ATA: | 427 | case ATA_CMD_ID_ATA: |
428 | /* Arguably should just no-op this one */ | 428 | /* Arguably should just no-op this one */ |
429 | case ATA_CMD_SET_FEATURES: | 429 | case ATA_CMD_SET_FEATURES: |
430 | return ata_qc_issue_prot(qc); | 430 | return ata_sff_qc_issue(qc); |
431 | } | 431 | } |
432 | printk(KERN_DEBUG "it821x: can't process command 0x%02X\n", qc->tf.command); | 432 | printk(KERN_DEBUG "it821x: can't process command 0x%02X\n", qc->tf.command); |
433 | return AC_ERR_DEV; | 433 | return AC_ERR_DEV; |
434 | } | 434 | } |
435 | 435 | ||
436 | /** | 436 | /** |
437 | * it821x_passthru_qc_issue_prot - wrap qc issue prot | 437 | * it821x_passthru_qc_issue - wrap qc issue prot |
438 | * @qc: command | 438 | * @qc: command |
439 | * | 439 | * |
440 | * Wrap the command issue sequence for the IT821x. We need to | 440 | * Wrap the command issue sequence for the IT821x. We need to |
@@ -442,10 +442,10 @@ static unsigned int it821x_smart_qc_issue_prot(struct ata_queued_cmd *qc) | |||
442 | * usual happenings kick off | 442 | * usual happenings kick off |
443 | */ | 443 | */ |
444 | 444 | ||
445 | static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc) | 445 | static unsigned int it821x_passthru_qc_issue(struct ata_queued_cmd *qc) |
446 | { | 446 | { |
447 | it821x_passthru_dev_select(qc->ap, qc->dev->devno); | 447 | it821x_passthru_dev_select(qc->ap, qc->dev->devno); |
448 | return ata_qc_issue_prot(qc); | 448 | return ata_sff_qc_issue(qc); |
449 | } | 449 | } |
450 | 450 | ||
451 | /** | 451 | /** |
@@ -632,89 +632,34 @@ static int it821x_port_start(struct ata_port *ap) | |||
632 | } | 632 | } |
633 | 633 | ||
634 | static struct scsi_host_template it821x_sht = { | 634 | static struct scsi_host_template it821x_sht = { |
635 | .module = THIS_MODULE, | 635 | ATA_BMDMA_SHT(DRV_NAME), |
636 | .name = DRV_NAME, | ||
637 | .ioctl = ata_scsi_ioctl, | ||
638 | .queuecommand = ata_scsi_queuecmd, | ||
639 | .can_queue = ATA_DEF_QUEUE, | ||
640 | .this_id = ATA_SHT_THIS_ID, | ||
641 | .sg_tablesize = LIBATA_MAX_PRD, | ||
642 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | ||
643 | .emulated = ATA_SHT_EMULATED, | ||
644 | .use_clustering = ATA_SHT_USE_CLUSTERING, | ||
645 | .proc_name = DRV_NAME, | ||
646 | .dma_boundary = ATA_DMA_BOUNDARY, | ||
647 | .slave_configure = ata_scsi_slave_config, | ||
648 | .slave_destroy = ata_scsi_slave_destroy, | ||
649 | .bios_param = ata_std_bios_param, | ||
650 | }; | 636 | }; |
651 | 637 | ||
652 | static struct ata_port_operations it821x_smart_port_ops = { | 638 | static struct ata_port_operations it821x_smart_port_ops = { |
653 | .set_mode = it821x_smart_set_mode, | 639 | .inherits = &ata_bmdma_port_ops, |
654 | .tf_load = ata_tf_load, | ||
655 | .tf_read = ata_tf_read, | ||
656 | .mode_filter = ata_pci_default_filter, | ||
657 | 640 | ||
658 | .check_status = ata_check_status, | ||
659 | .check_atapi_dma= it821x_check_atapi_dma, | 641 | .check_atapi_dma= it821x_check_atapi_dma, |
660 | .exec_command = ata_exec_command, | 642 | .qc_issue = it821x_smart_qc_issue, |
661 | .dev_select = ata_std_dev_select, | ||
662 | .dev_config = it821x_dev_config, | ||
663 | 643 | ||
664 | .freeze = ata_bmdma_freeze, | ||
665 | .thaw = ata_bmdma_thaw, | ||
666 | .error_handler = ata_bmdma_error_handler, | ||
667 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
668 | .cable_detect = it821x_ident_hack, | 644 | .cable_detect = it821x_ident_hack, |
669 | 645 | .set_mode = it821x_smart_set_mode, | |
670 | .bmdma_setup = ata_bmdma_setup, | 646 | .dev_config = it821x_dev_config, |
671 | .bmdma_start = ata_bmdma_start, | ||
672 | .bmdma_stop = ata_bmdma_stop, | ||
673 | .bmdma_status = ata_bmdma_status, | ||
674 | |||
675 | .qc_prep = ata_qc_prep, | ||
676 | .qc_issue = it821x_smart_qc_issue_prot, | ||
677 | |||
678 | .data_xfer = ata_data_xfer, | ||
679 | |||
680 | .irq_handler = ata_interrupt, | ||
681 | .irq_clear = ata_bmdma_irq_clear, | ||
682 | .irq_on = ata_irq_on, | ||
683 | 647 | ||
684 | .port_start = it821x_port_start, | 648 | .port_start = it821x_port_start, |
685 | }; | 649 | }; |
686 | 650 | ||
687 | static struct ata_port_operations it821x_passthru_port_ops = { | 651 | static struct ata_port_operations it821x_passthru_port_ops = { |
688 | .set_piomode = it821x_passthru_set_piomode, | 652 | .inherits = &ata_bmdma_port_ops, |
689 | .set_dmamode = it821x_passthru_set_dmamode, | ||
690 | .mode_filter = ata_pci_default_filter, | ||
691 | 653 | ||
692 | .tf_load = ata_tf_load, | ||
693 | .tf_read = ata_tf_read, | ||
694 | .check_status = ata_check_status, | ||
695 | .exec_command = ata_exec_command, | ||
696 | .check_atapi_dma= it821x_check_atapi_dma, | 654 | .check_atapi_dma= it821x_check_atapi_dma, |
697 | .dev_select = it821x_passthru_dev_select, | 655 | .sff_dev_select = it821x_passthru_dev_select, |
698 | |||
699 | .freeze = ata_bmdma_freeze, | ||
700 | .thaw = ata_bmdma_thaw, | ||
701 | .error_handler = ata_bmdma_error_handler, | ||
702 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
703 | .cable_detect = ata_cable_unknown, | ||
704 | |||
705 | .bmdma_setup = ata_bmdma_setup, | ||
706 | .bmdma_start = it821x_passthru_bmdma_start, | 656 | .bmdma_start = it821x_passthru_bmdma_start, |
707 | .bmdma_stop = it821x_passthru_bmdma_stop, | 657 | .bmdma_stop = it821x_passthru_bmdma_stop, |
708 | .bmdma_status = ata_bmdma_status, | 658 | .qc_issue = it821x_passthru_qc_issue, |
709 | |||
710 | .qc_prep = ata_qc_prep, | ||
711 | .qc_issue = it821x_passthru_qc_issue_prot, | ||
712 | |||
713 | .data_xfer = ata_data_xfer, | ||
714 | 659 | ||
715 | .irq_clear = ata_bmdma_irq_clear, | 660 | .cable_detect = ata_cable_unknown, |
716 | .irq_handler = ata_interrupt, | 661 | .set_piomode = it821x_passthru_set_piomode, |
717 | .irq_on = ata_irq_on, | 662 | .set_dmamode = it821x_passthru_set_dmamode, |
718 | 663 | ||
719 | .port_start = it821x_port_start, | 664 | .port_start = it821x_port_start, |
720 | }; | 665 | }; |
@@ -742,14 +687,12 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
742 | u8 conf; | 687 | u8 conf; |
743 | 688 | ||
744 | static const struct ata_port_info info_smart = { | 689 | static const struct ata_port_info info_smart = { |
745 | .sht = &it821x_sht, | ||
746 | .flags = ATA_FLAG_SLAVE_POSS, | 690 | .flags = ATA_FLAG_SLAVE_POSS, |
747 | .pio_mask = 0x1f, | 691 | .pio_mask = 0x1f, |
748 | .mwdma_mask = 0x07, | 692 | .mwdma_mask = 0x07, |
749 | .port_ops = &it821x_smart_port_ops | 693 | .port_ops = &it821x_smart_port_ops |
750 | }; | 694 | }; |
751 | static const struct ata_port_info info_passthru = { | 695 | static const struct ata_port_info info_passthru = { |
752 | .sht = &it821x_sht, | ||
753 | .flags = ATA_FLAG_SLAVE_POSS, | 696 | .flags = ATA_FLAG_SLAVE_POSS, |
754 | .pio_mask = 0x1f, | 697 | .pio_mask = 0x1f, |
755 | .mwdma_mask = 0x07, | 698 | .mwdma_mask = 0x07, |
@@ -759,6 +702,11 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
759 | 702 | ||
760 | const struct ata_port_info *ppi[] = { NULL, NULL }; | 703 | const struct ata_port_info *ppi[] = { NULL, NULL }; |
761 | static char *mode[2] = { "pass through", "smart" }; | 704 | static char *mode[2] = { "pass through", "smart" }; |
705 | int rc; | ||
706 | |||
707 | rc = pcim_enable_device(pdev); | ||
708 | if (rc) | ||
709 | return rc; | ||
762 | 710 | ||
763 | /* Force the card into bypass mode if so requested */ | 711 | /* Force the card into bypass mode if so requested */ |
764 | if (it8212_noraid) { | 712 | if (it8212_noraid) { |
@@ -774,16 +722,23 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
774 | else | 722 | else |
775 | ppi[0] = &info_smart; | 723 | ppi[0] = &info_smart; |
776 | 724 | ||
777 | return ata_pci_init_one(pdev, ppi); | 725 | return ata_pci_sff_init_one(pdev, ppi, &it821x_sht, NULL); |
778 | } | 726 | } |
779 | 727 | ||
780 | #ifdef CONFIG_PM | 728 | #ifdef CONFIG_PM |
781 | static int it821x_reinit_one(struct pci_dev *pdev) | 729 | static int it821x_reinit_one(struct pci_dev *pdev) |
782 | { | 730 | { |
731 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
732 | int rc; | ||
733 | |||
734 | rc = ata_pci_device_do_resume(pdev); | ||
735 | if (rc) | ||
736 | return rc; | ||
783 | /* Resume - turn raid back off if need be */ | 737 | /* Resume - turn raid back off if need be */ |
784 | if (it8212_noraid) | 738 | if (it8212_noraid) |
785 | it821x_disable_raid(pdev); | 739 | it821x_disable_raid(pdev); |
786 | return ata_pci_device_resume(pdev); | 740 | ata_host_resume(host); |
741 | return rc; | ||
787 | } | 742 | } |
788 | #endif | 743 | #endif |
789 | 744 | ||