diff options
Diffstat (limited to 'drivers/ide/pci/hpt366.c')
-rw-r--r-- | drivers/ide/pci/hpt366.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index d33a3f9c12b7..7429a55c164e 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c | |||
@@ -626,7 +626,8 @@ static int check_in_drive_list(ide_drive_t *drive, const char **list) | |||
626 | static u8 hpt3xx_udma_filter(ide_drive_t *drive) | 626 | static u8 hpt3xx_udma_filter(ide_drive_t *drive) |
627 | { | 627 | { |
628 | ide_hwif_t *hwif = HWIF(drive); | 628 | ide_hwif_t *hwif = HWIF(drive); |
629 | struct hpt_info *info = pci_get_drvdata(hwif->pci_dev); | 629 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
630 | struct hpt_info *info = pci_get_drvdata(dev); | ||
630 | u8 mask = hwif->ultra_mask; | 631 | u8 mask = hwif->ultra_mask; |
631 | 632 | ||
632 | switch (info->chip_type) { | 633 | switch (info->chip_type) { |
@@ -665,7 +666,8 @@ static u8 hpt3xx_udma_filter(ide_drive_t *drive) | |||
665 | static u8 hpt3xx_mdma_filter(ide_drive_t *drive) | 666 | static u8 hpt3xx_mdma_filter(ide_drive_t *drive) |
666 | { | 667 | { |
667 | ide_hwif_t *hwif = HWIF(drive); | 668 | ide_hwif_t *hwif = HWIF(drive); |
668 | struct hpt_info *info = pci_get_drvdata(hwif->pci_dev); | 669 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
670 | struct hpt_info *info = pci_get_drvdata(dev); | ||
669 | 671 | ||
670 | switch (info->chip_type) { | 672 | switch (info->chip_type) { |
671 | case HPT372 : | 673 | case HPT372 : |
@@ -699,7 +701,7 @@ static u32 get_speed_setting(u8 speed, struct hpt_info *info) | |||
699 | 701 | ||
700 | static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed) | 702 | static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed) |
701 | { | 703 | { |
702 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 704 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
703 | struct hpt_info *info = pci_get_drvdata(dev); | 705 | struct hpt_info *info = pci_get_drvdata(dev); |
704 | struct hpt_timings *t = info->timings; | 706 | struct hpt_timings *t = info->timings; |
705 | u8 itr_addr = 0x40 + (drive->dn * 4); | 707 | u8 itr_addr = 0x40 + (drive->dn * 4); |
@@ -742,7 +744,7 @@ static void hpt3xx_quirkproc(ide_drive_t *drive) | |||
742 | static void hpt3xx_maskproc(ide_drive_t *drive, int mask) | 744 | static void hpt3xx_maskproc(ide_drive_t *drive, int mask) |
743 | { | 745 | { |
744 | ide_hwif_t *hwif = HWIF(drive); | 746 | ide_hwif_t *hwif = HWIF(drive); |
745 | struct pci_dev *dev = hwif->pci_dev; | 747 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
746 | struct hpt_info *info = pci_get_drvdata(dev); | 748 | struct hpt_info *info = pci_get_drvdata(dev); |
747 | 749 | ||
748 | if (drive->quirk_list) { | 750 | if (drive->quirk_list) { |
@@ -774,7 +776,7 @@ static void hpt3xx_maskproc(ide_drive_t *drive, int mask) | |||
774 | */ | 776 | */ |
775 | static void hpt366_dma_lost_irq(ide_drive_t *drive) | 777 | static void hpt366_dma_lost_irq(ide_drive_t *drive) |
776 | { | 778 | { |
777 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 779 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
778 | u8 mcr1 = 0, mcr3 = 0, scr1 = 0; | 780 | u8 mcr1 = 0, mcr3 = 0, scr1 = 0; |
779 | 781 | ||
780 | pci_read_config_byte(dev, 0x50, &mcr1); | 782 | pci_read_config_byte(dev, 0x50, &mcr1); |
@@ -790,18 +792,20 @@ static void hpt366_dma_lost_irq(ide_drive_t *drive) | |||
790 | static void hpt370_clear_engine(ide_drive_t *drive) | 792 | static void hpt370_clear_engine(ide_drive_t *drive) |
791 | { | 793 | { |
792 | ide_hwif_t *hwif = HWIF(drive); | 794 | ide_hwif_t *hwif = HWIF(drive); |
795 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
793 | 796 | ||
794 | pci_write_config_byte(hwif->pci_dev, hwif->select_data, 0x37); | 797 | pci_write_config_byte(dev, hwif->select_data, 0x37); |
795 | udelay(10); | 798 | udelay(10); |
796 | } | 799 | } |
797 | 800 | ||
798 | static void hpt370_irq_timeout(ide_drive_t *drive) | 801 | static void hpt370_irq_timeout(ide_drive_t *drive) |
799 | { | 802 | { |
800 | ide_hwif_t *hwif = HWIF(drive); | 803 | ide_hwif_t *hwif = HWIF(drive); |
804 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
801 | u16 bfifo = 0; | 805 | u16 bfifo = 0; |
802 | u8 dma_cmd; | 806 | u8 dma_cmd; |
803 | 807 | ||
804 | pci_read_config_word(hwif->pci_dev, hwif->select_data + 2, &bfifo); | 808 | pci_read_config_word(dev, hwif->select_data + 2, &bfifo); |
805 | printk(KERN_DEBUG "%s: %d bytes in FIFO\n", drive->name, bfifo & 0x1ff); | 809 | printk(KERN_DEBUG "%s: %d bytes in FIFO\n", drive->name, bfifo & 0x1ff); |
806 | 810 | ||
807 | /* get DMA command mode */ | 811 | /* get DMA command mode */ |
@@ -844,10 +848,11 @@ static void hpt370_dma_timeout(ide_drive_t *drive) | |||
844 | static int hpt374_ide_dma_test_irq(ide_drive_t *drive) | 848 | static int hpt374_ide_dma_test_irq(ide_drive_t *drive) |
845 | { | 849 | { |
846 | ide_hwif_t *hwif = HWIF(drive); | 850 | ide_hwif_t *hwif = HWIF(drive); |
851 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
847 | u16 bfifo = 0; | 852 | u16 bfifo = 0; |
848 | u8 dma_stat; | 853 | u8 dma_stat; |
849 | 854 | ||
850 | pci_read_config_word(hwif->pci_dev, hwif->select_data + 2, &bfifo); | 855 | pci_read_config_word(dev, hwif->select_data + 2, &bfifo); |
851 | if (bfifo & 0x1FF) { | 856 | if (bfifo & 0x1FF) { |
852 | // printk("%s: %d bytes in FIFO\n", drive->name, bfifo); | 857 | // printk("%s: %d bytes in FIFO\n", drive->name, bfifo); |
853 | return 0; | 858 | return 0; |
@@ -867,7 +872,7 @@ static int hpt374_ide_dma_test_irq(ide_drive_t *drive) | |||
867 | static int hpt374_ide_dma_end(ide_drive_t *drive) | 872 | static int hpt374_ide_dma_end(ide_drive_t *drive) |
868 | { | 873 | { |
869 | ide_hwif_t *hwif = HWIF(drive); | 874 | ide_hwif_t *hwif = HWIF(drive); |
870 | struct pci_dev *dev = hwif->pci_dev; | 875 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
871 | u8 mcr = 0, mcr_addr = hwif->select_data; | 876 | u8 mcr = 0, mcr_addr = hwif->select_data; |
872 | u8 bwsr = 0, mask = hwif->channel ? 0x02 : 0x01; | 877 | u8 bwsr = 0, mask = hwif->channel ? 0x02 : 0x01; |
873 | 878 | ||
@@ -942,7 +947,7 @@ static void hpt3xxn_rw_disk(ide_drive_t *drive, struct request *rq) | |||
942 | static int hpt3xx_busproc(ide_drive_t *drive, int state) | 947 | static int hpt3xx_busproc(ide_drive_t *drive, int state) |
943 | { | 948 | { |
944 | ide_hwif_t *hwif = HWIF(drive); | 949 | ide_hwif_t *hwif = HWIF(drive); |
945 | struct pci_dev *dev = hwif->pci_dev; | 950 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
946 | u8 mcr_addr = hwif->select_data + 2; | 951 | u8 mcr_addr = hwif->select_data + 2; |
947 | u8 resetmask = hwif->channel ? 0x80 : 0x40; | 952 | u8 resetmask = hwif->channel ? 0x80 : 0x40; |
948 | u8 bsr2 = 0; | 953 | u8 bsr2 = 0; |
@@ -1278,7 +1283,7 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha | |||
1278 | 1283 | ||
1279 | static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) | 1284 | static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) |
1280 | { | 1285 | { |
1281 | struct pci_dev *dev = hwif->pci_dev; | 1286 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
1282 | struct hpt_info *info = pci_get_drvdata(dev); | 1287 | struct hpt_info *info = pci_get_drvdata(dev); |
1283 | int serialize = HPT_SERIALIZE_IO; | 1288 | int serialize = HPT_SERIALIZE_IO; |
1284 | u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02; | 1289 | u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02; |
@@ -1393,7 +1398,7 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) | |||
1393 | 1398 | ||
1394 | static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase) | 1399 | static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase) |
1395 | { | 1400 | { |
1396 | struct pci_dev *dev = hwif->pci_dev; | 1401 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
1397 | u8 masterdma = 0, slavedma = 0; | 1402 | u8 masterdma = 0, slavedma = 0; |
1398 | u8 dma_new = 0, dma_old = 0; | 1403 | u8 dma_new = 0, dma_old = 0; |
1399 | unsigned long flags; | 1404 | unsigned long flags; |