diff options
Diffstat (limited to 'drivers/ide/pci/siimage.c')
| -rw-r--r-- | drivers/ide/pci/siimage.c | 114 |
1 files changed, 58 insertions, 56 deletions
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index c9ecab8aeb61..1fffea3211bd 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
| @@ -301,7 +301,7 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
| 301 | } | 301 | } |
| 302 | 302 | ||
| 303 | /* returns 1 if dma irq issued, 0 otherwise */ | 303 | /* returns 1 if dma irq issued, 0 otherwise */ |
| 304 | static int siimage_io_ide_dma_test_irq (ide_drive_t *drive) | 304 | static int siimage_io_dma_test_irq(ide_drive_t *drive) |
| 305 | { | 305 | { |
| 306 | ide_hwif_t *hwif = HWIF(drive); | 306 | ide_hwif_t *hwif = HWIF(drive); |
| 307 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 307 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
| @@ -320,14 +320,14 @@ static int siimage_io_ide_dma_test_irq (ide_drive_t *drive) | |||
| 320 | } | 320 | } |
| 321 | 321 | ||
| 322 | /** | 322 | /** |
| 323 | * siimage_mmio_ide_dma_test_irq - check we caused an IRQ | 323 | * siimage_mmio_dma_test_irq - check we caused an IRQ |
| 324 | * @drive: drive we are testing | 324 | * @drive: drive we are testing |
| 325 | * | 325 | * |
| 326 | * Check if we caused an IDE DMA interrupt. We may also have caused | 326 | * Check if we caused an IDE DMA interrupt. We may also have caused |
| 327 | * SATA status interrupts, if so we clean them up and continue. | 327 | * SATA status interrupts, if so we clean them up and continue. |
| 328 | */ | 328 | */ |
| 329 | 329 | ||
| 330 | static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) | 330 | static int siimage_mmio_dma_test_irq(ide_drive_t *drive) |
| 331 | { | 331 | { |
| 332 | ide_hwif_t *hwif = HWIF(drive); | 332 | ide_hwif_t *hwif = HWIF(drive); |
| 333 | unsigned long addr = siimage_selreg(hwif, 0x1); | 333 | unsigned long addr = siimage_selreg(hwif, 0x1); |
| @@ -347,7 +347,7 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) | |||
| 347 | printk(KERN_WARNING "%s: sata_error = 0x%08x, " | 347 | printk(KERN_WARNING "%s: sata_error = 0x%08x, " |
| 348 | "watchdog = %d, %s\n", | 348 | "watchdog = %d, %s\n", |
| 349 | drive->name, sata_error, watchdog, | 349 | drive->name, sata_error, watchdog, |
| 350 | __FUNCTION__); | 350 | __func__); |
| 351 | 351 | ||
| 352 | } else { | 352 | } else { |
| 353 | watchdog = (ext_stat & 0x8000) ? 1 : 0; | 353 | watchdog = (ext_stat & 0x8000) ? 1 : 0; |
| @@ -369,6 +369,14 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) | |||
| 369 | return 0; | 369 | return 0; |
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | static int siimage_dma_test_irq(ide_drive_t *drive) | ||
| 373 | { | ||
| 374 | if (drive->hwif->mmio) | ||
| 375 | return siimage_mmio_dma_test_irq(drive); | ||
| 376 | else | ||
| 377 | return siimage_io_dma_test_irq(drive); | ||
| 378 | } | ||
| 379 | |||
| 372 | /** | 380 | /** |
| 373 | * sil_sata_reset_poll - wait for SATA reset | 381 | * sil_sata_reset_poll - wait for SATA reset |
| 374 | * @drive: drive we are resetting | 382 | * @drive: drive we are resetting |
| @@ -735,14 +743,14 @@ static void __devinit init_iops_siimage(ide_hwif_t *hwif) | |||
| 735 | } | 743 | } |
| 736 | 744 | ||
| 737 | /** | 745 | /** |
| 738 | * ata66_siimage - check for 80 pin cable | 746 | * sil_cable_detect - cable detection |
| 739 | * @hwif: interface to check | 747 | * @hwif: interface to check |
| 740 | * | 748 | * |
| 741 | * Check for the presence of an ATA66 capable cable on the | 749 | * Check for the presence of an ATA66 capable cable on the |
| 742 | * interface. | 750 | * interface. |
| 743 | */ | 751 | */ |
| 744 | 752 | ||
| 745 | static u8 __devinit ata66_siimage(ide_hwif_t *hwif) | 753 | static u8 __devinit sil_cable_detect(ide_hwif_t *hwif) |
| 746 | { | 754 | { |
| 747 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 755 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
| 748 | unsigned long addr = siimage_selreg(hwif, 0); | 756 | unsigned long addr = siimage_selreg(hwif, 0); |
| @@ -756,67 +764,44 @@ static u8 __devinit ata66_siimage(ide_hwif_t *hwif) | |||
| 756 | return (ata66 & 0x01) ? ATA_CBL_PATA80 : ATA_CBL_PATA40; | 764 | return (ata66 & 0x01) ? ATA_CBL_PATA80 : ATA_CBL_PATA40; |
| 757 | } | 765 | } |
| 758 | 766 | ||
| 759 | /** | 767 | static const struct ide_port_ops sil_pata_port_ops = { |
| 760 | * init_hwif_siimage - set up hwif structs | 768 | .set_pio_mode = sil_set_pio_mode, |
| 761 | * @hwif: interface to set up | 769 | .set_dma_mode = sil_set_dma_mode, |
| 762 | * | 770 | .quirkproc = sil_quirkproc, |
| 763 | * We do the basic set up of the interface structure. The SIIMAGE | 771 | .udma_filter = sil_pata_udma_filter, |
| 764 | * requires several custom handlers so we override the default | 772 | .cable_detect = sil_cable_detect, |
| 765 | * ide DMA handlers appropriately | 773 | }; |
| 766 | */ | ||
| 767 | |||
| 768 | static void __devinit init_hwif_siimage(ide_hwif_t *hwif) | ||
| 769 | { | ||
| 770 | u8 sata = is_sata(hwif); | ||
| 771 | |||
| 772 | hwif->set_pio_mode = &sil_set_pio_mode; | ||
| 773 | hwif->set_dma_mode = &sil_set_dma_mode; | ||
| 774 | hwif->quirkproc = &sil_quirkproc; | ||
| 775 | |||
| 776 | if (sata) { | ||
| 777 | static int first = 1; | ||
| 778 | |||
| 779 | hwif->reset_poll = &sil_sata_reset_poll; | ||
| 780 | hwif->pre_reset = &sil_sata_pre_reset; | ||
| 781 | hwif->udma_filter = &sil_sata_udma_filter; | ||
| 782 | |||
| 783 | if (first) { | ||
| 784 | printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n"); | ||
| 785 | first = 0; | ||
| 786 | } | ||
| 787 | } else | ||
| 788 | hwif->udma_filter = &sil_pata_udma_filter; | ||
| 789 | |||
| 790 | hwif->cable_detect = ata66_siimage; | ||
| 791 | |||
| 792 | if (hwif->dma_base == 0) | ||
| 793 | return; | ||
| 794 | 774 | ||
| 795 | if (sata) | 775 | static const struct ide_port_ops sil_sata_port_ops = { |
| 796 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; | 776 | .set_pio_mode = sil_set_pio_mode, |
| 777 | .set_dma_mode = sil_set_dma_mode, | ||
| 778 | .reset_poll = sil_sata_reset_poll, | ||
| 779 | .pre_reset = sil_sata_pre_reset, | ||
| 780 | .quirkproc = sil_quirkproc, | ||
| 781 | .udma_filter = sil_sata_udma_filter, | ||
| 782 | .cable_detect = sil_cable_detect, | ||
| 783 | }; | ||
| 797 | 784 | ||
| 798 | if (hwif->mmio) { | 785 | static struct ide_dma_ops sil_dma_ops = { |
| 799 | hwif->ide_dma_test_irq = &siimage_mmio_ide_dma_test_irq; | 786 | .dma_test_irq = siimage_dma_test_irq, |
| 800 | } else { | 787 | }; |
| 801 | hwif->ide_dma_test_irq = & siimage_io_ide_dma_test_irq; | ||
| 802 | } | ||
| 803 | } | ||
| 804 | 788 | ||
| 805 | #define DECLARE_SII_DEV(name_str) \ | 789 | #define DECLARE_SII_DEV(name_str, p_ops) \ |
| 806 | { \ | 790 | { \ |
| 807 | .name = name_str, \ | 791 | .name = name_str, \ |
| 808 | .init_chipset = init_chipset_siimage, \ | 792 | .init_chipset = init_chipset_siimage, \ |
| 809 | .init_iops = init_iops_siimage, \ | 793 | .init_iops = init_iops_siimage, \ |
| 810 | .init_hwif = init_hwif_siimage, \ | 794 | .port_ops = p_ops, \ |
| 795 | .dma_ops = &sil_dma_ops, \ | ||
| 811 | .pio_mask = ATA_PIO4, \ | 796 | .pio_mask = ATA_PIO4, \ |
| 812 | .mwdma_mask = ATA_MWDMA2, \ | 797 | .mwdma_mask = ATA_MWDMA2, \ |
| 813 | .udma_mask = ATA_UDMA6, \ | 798 | .udma_mask = ATA_UDMA6, \ |
| 814 | } | 799 | } |
| 815 | 800 | ||
| 816 | static const struct ide_port_info siimage_chipsets[] __devinitdata = { | 801 | static const struct ide_port_info siimage_chipsets[] __devinitdata = { |
| 817 | /* 0 */ DECLARE_SII_DEV("SiI680"), | 802 | /* 0 */ DECLARE_SII_DEV("SiI680", &sil_pata_port_ops), |
| 818 | /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"), | 803 | /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA", &sil_sata_port_ops), |
| 819 | /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA") | 804 | /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA", &sil_sata_port_ops) |
| 820 | }; | 805 | }; |
| 821 | 806 | ||
| 822 | /** | 807 | /** |
| @@ -830,7 +815,24 @@ static const struct ide_port_info siimage_chipsets[] __devinitdata = { | |||
| 830 | 815 | ||
| 831 | static int __devinit siimage_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 816 | static int __devinit siimage_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
| 832 | { | 817 | { |
| 833 | return ide_setup_pci_device(dev, &siimage_chipsets[id->driver_data]); | 818 | struct ide_port_info d; |
| 819 | u8 idx = id->driver_data; | ||
| 820 | |||
| 821 | d = siimage_chipsets[idx]; | ||
| 822 | |||
| 823 | if (idx) { | ||
| 824 | static int first = 1; | ||
| 825 | |||
| 826 | if (first) { | ||
| 827 | printk(KERN_INFO "siimage: For full SATA support you " | ||
| 828 | "should use the libata sata_sil module.\n"); | ||
| 829 | first = 0; | ||
| 830 | } | ||
| 831 | |||
| 832 | d.host_flags |= IDE_HFLAG_NO_ATAPI_DMA; | ||
| 833 | } | ||
| 834 | |||
| 835 | return ide_setup_pci_device(dev, &d); | ||
| 834 | } | 836 | } |
| 835 | 837 | ||
| 836 | static const struct pci_device_id siimage_pci_tbl[] = { | 838 | static const struct pci_device_id siimage_pci_tbl[] = { |
