diff options
Diffstat (limited to 'drivers/ide/pci/siimage.c')
-rw-r--r-- | drivers/ide/pci/siimage.c | 76 |
1 files changed, 35 insertions, 41 deletions
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index faf5c3d6ab72..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); |
@@ -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 |
@@ -756,41 +764,6 @@ static u8 __devinit sil_cable_detect(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 | /** | ||
760 | * init_hwif_siimage - set up hwif structs | ||
761 | * @hwif: interface to set up | ||
762 | * | ||
763 | * We do the basic set up of the interface structure. The SIIMAGE | ||
764 | * requires several custom handlers so we override the default | ||
765 | * ide DMA handlers appropriately | ||
766 | */ | ||
767 | |||
768 | static void __devinit init_hwif_siimage(ide_hwif_t *hwif) | ||
769 | { | ||
770 | u8 sata = is_sata(hwif); | ||
771 | |||
772 | if (sata) { | ||
773 | static int first = 1; | ||
774 | |||
775 | if (first) { | ||
776 | printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n"); | ||
777 | first = 0; | ||
778 | } | ||
779 | } | ||
780 | |||
781 | if (hwif->dma_base == 0) | ||
782 | return; | ||
783 | |||
784 | if (sata) | ||
785 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; | ||
786 | |||
787 | if (hwif->mmio) { | ||
788 | hwif->ide_dma_test_irq = &siimage_mmio_ide_dma_test_irq; | ||
789 | } else { | ||
790 | hwif->ide_dma_test_irq = & siimage_io_ide_dma_test_irq; | ||
791 | } | ||
792 | } | ||
793 | |||
794 | static const struct ide_port_ops sil_pata_port_ops = { | 767 | static const struct ide_port_ops sil_pata_port_ops = { |
795 | .set_pio_mode = sil_set_pio_mode, | 768 | .set_pio_mode = sil_set_pio_mode, |
796 | .set_dma_mode = sil_set_dma_mode, | 769 | .set_dma_mode = sil_set_dma_mode, |
@@ -809,13 +782,17 @@ static const struct ide_port_ops sil_sata_port_ops = { | |||
809 | .cable_detect = sil_cable_detect, | 782 | .cable_detect = sil_cable_detect, |
810 | }; | 783 | }; |
811 | 784 | ||
785 | static struct ide_dma_ops sil_dma_ops = { | ||
786 | .dma_test_irq = siimage_dma_test_irq, | ||
787 | }; | ||
788 | |||
812 | #define DECLARE_SII_DEV(name_str, p_ops) \ | 789 | #define DECLARE_SII_DEV(name_str, p_ops) \ |
813 | { \ | 790 | { \ |
814 | .name = name_str, \ | 791 | .name = name_str, \ |
815 | .init_chipset = init_chipset_siimage, \ | 792 | .init_chipset = init_chipset_siimage, \ |
816 | .init_iops = init_iops_siimage, \ | 793 | .init_iops = init_iops_siimage, \ |
817 | .init_hwif = init_hwif_siimage, \ | ||
818 | .port_ops = p_ops, \ | 794 | .port_ops = p_ops, \ |
795 | .dma_ops = &sil_dma_ops, \ | ||
819 | .pio_mask = ATA_PIO4, \ | 796 | .pio_mask = ATA_PIO4, \ |
820 | .mwdma_mask = ATA_MWDMA2, \ | 797 | .mwdma_mask = ATA_MWDMA2, \ |
821 | .udma_mask = ATA_UDMA6, \ | 798 | .udma_mask = ATA_UDMA6, \ |
@@ -838,7 +815,24 @@ static const struct ide_port_info siimage_chipsets[] __devinitdata = { | |||
838 | 815 | ||
839 | 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) |
840 | { | 817 | { |
841 | 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); | ||
842 | } | 836 | } |
843 | 837 | ||
844 | static const struct pci_device_id siimage_pci_tbl[] = { | 838 | static const struct pci_device_id siimage_pci_tbl[] = { |