diff options
Diffstat (limited to 'drivers/ide/siimage.c')
-rw-r--r-- | drivers/ide/siimage.c | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/drivers/ide/siimage.c b/drivers/ide/siimage.c index bd82d228608c..d95df528562f 100644 --- a/drivers/ide/siimage.c +++ b/drivers/ide/siimage.c | |||
@@ -32,7 +32,6 @@ | |||
32 | * smarter code in libata. | 32 | * smarter code in libata. |
33 | * | 33 | * |
34 | * TODO: | 34 | * TODO: |
35 | * - IORDY fixes | ||
36 | * - VDMA support | 35 | * - VDMA support |
37 | */ | 36 | */ |
38 | 37 | ||
@@ -234,8 +233,7 @@ static u8 sil_sata_udma_filter(ide_drive_t *drive) | |||
234 | * @pio: PIO mode number | 233 | * @pio: PIO mode number |
235 | * | 234 | * |
236 | * Load the timing settings for this device mode into the | 235 | * Load the timing settings for this device mode into the |
237 | * controller. If we are in PIO mode 3 or 4 turn on IORDY | 236 | * controller. |
238 | * monitoring (bit 9). The TF timing is bits 31:16 | ||
239 | */ | 237 | */ |
240 | 238 | ||
241 | static void sil_set_pio_mode(ide_drive_t *drive, u8 pio) | 239 | static void sil_set_pio_mode(ide_drive_t *drive, u8 pio) |
@@ -276,13 +274,16 @@ static void sil_set_pio_mode(ide_drive_t *drive, u8 pio) | |||
276 | /* now set up IORDY */ | 274 | /* now set up IORDY */ |
277 | speedp = sil_ioread16(dev, tfaddr - 2); | 275 | speedp = sil_ioread16(dev, tfaddr - 2); |
278 | speedp &= ~0x200; | 276 | speedp &= ~0x200; |
279 | if (pio > 2) | ||
280 | speedp |= 0x200; | ||
281 | sil_iowrite16(dev, speedp, tfaddr - 2); | ||
282 | 277 | ||
283 | mode = sil_ioread8(dev, base + addr_mask); | 278 | mode = sil_ioread8(dev, base + addr_mask); |
284 | mode &= ~(unit ? 0x30 : 0x03); | 279 | mode &= ~(unit ? 0x30 : 0x03); |
285 | mode |= unit ? 0x10 : 0x01; | 280 | |
281 | if (ide_pio_need_iordy(drive, pio)) { | ||
282 | speedp |= 0x200; | ||
283 | mode |= unit ? 0x10 : 0x01; | ||
284 | } | ||
285 | |||
286 | sil_iowrite16(dev, speedp, tfaddr - 2); | ||
286 | sil_iowrite8(dev, mode, base + addr_mask); | 287 | sil_iowrite8(dev, mode, base + addr_mask); |
287 | } | 288 | } |
288 | 289 | ||
@@ -337,24 +338,14 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
337 | sil_iowrite16(dev, ultra, ua); | 338 | sil_iowrite16(dev, ultra, ua); |
338 | } | 339 | } |
339 | 340 | ||
340 | /* returns 1 if dma irq issued, 0 otherwise */ | 341 | static int sil_test_irq(ide_hwif_t *hwif) |
341 | static int siimage_io_dma_test_irq(ide_drive_t *drive) | ||
342 | { | 342 | { |
343 | ide_hwif_t *hwif = drive->hwif; | ||
344 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 343 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
345 | u8 dma_altstat = 0; | ||
346 | unsigned long addr = siimage_selreg(hwif, 1); | 344 | unsigned long addr = siimage_selreg(hwif, 1); |
345 | u8 val = sil_ioread8(dev, addr); | ||
347 | 346 | ||
348 | /* return 1 if INTR asserted */ | 347 | /* Return 1 if INTRQ asserted */ |
349 | if (inb(hwif->dma_base + ATA_DMA_STATUS) & 4) | 348 | return (val & 8) ? 1 : 0; |
350 | return 1; | ||
351 | |||
352 | /* return 1 if Device INTR asserted */ | ||
353 | pci_read_config_byte(dev, addr, &dma_altstat); | ||
354 | if (dma_altstat & 8) | ||
355 | return 0; /* return 1; */ | ||
356 | |||
357 | return 0; | ||
358 | } | 349 | } |
359 | 350 | ||
360 | /** | 351 | /** |
@@ -368,7 +359,6 @@ static int siimage_io_dma_test_irq(ide_drive_t *drive) | |||
368 | static int siimage_mmio_dma_test_irq(ide_drive_t *drive) | 359 | static int siimage_mmio_dma_test_irq(ide_drive_t *drive) |
369 | { | 360 | { |
370 | ide_hwif_t *hwif = drive->hwif; | 361 | ide_hwif_t *hwif = drive->hwif; |
371 | unsigned long addr = siimage_selreg(hwif, 0x1); | ||
372 | void __iomem *sata_error_addr | 362 | void __iomem *sata_error_addr |
373 | = (void __iomem *)hwif->sata_scr[SATA_ERROR_OFFSET]; | 363 | = (void __iomem *)hwif->sata_scr[SATA_ERROR_OFFSET]; |
374 | 364 | ||
@@ -397,10 +387,6 @@ static int siimage_mmio_dma_test_irq(ide_drive_t *drive) | |||
397 | if (readb((void __iomem *)(hwif->dma_base + ATA_DMA_STATUS)) & 4) | 387 | if (readb((void __iomem *)(hwif->dma_base + ATA_DMA_STATUS)) & 4) |
398 | return 1; | 388 | return 1; |
399 | 389 | ||
400 | /* return 1 if Device INTR asserted */ | ||
401 | if (readb((void __iomem *)addr) & 8) | ||
402 | return 0; /* return 1; */ | ||
403 | |||
404 | return 0; | 390 | return 0; |
405 | } | 391 | } |
406 | 392 | ||
@@ -409,7 +395,7 @@ static int siimage_dma_test_irq(ide_drive_t *drive) | |||
409 | if (drive->hwif->host_flags & IDE_HFLAG_MMIO) | 395 | if (drive->hwif->host_flags & IDE_HFLAG_MMIO) |
410 | return siimage_mmio_dma_test_irq(drive); | 396 | return siimage_mmio_dma_test_irq(drive); |
411 | else | 397 | else |
412 | return siimage_io_dma_test_irq(drive); | 398 | return ide_dma_test_irq(drive); |
413 | } | 399 | } |
414 | 400 | ||
415 | /** | 401 | /** |
@@ -694,6 +680,7 @@ static const struct ide_port_ops sil_pata_port_ops = { | |||
694 | .set_pio_mode = sil_set_pio_mode, | 680 | .set_pio_mode = sil_set_pio_mode, |
695 | .set_dma_mode = sil_set_dma_mode, | 681 | .set_dma_mode = sil_set_dma_mode, |
696 | .quirkproc = sil_quirkproc, | 682 | .quirkproc = sil_quirkproc, |
683 | .test_irq = sil_test_irq, | ||
697 | .udma_filter = sil_pata_udma_filter, | 684 | .udma_filter = sil_pata_udma_filter, |
698 | .cable_detect = sil_cable_detect, | 685 | .cable_detect = sil_cable_detect, |
699 | }; | 686 | }; |
@@ -704,6 +691,7 @@ static const struct ide_port_ops sil_sata_port_ops = { | |||
704 | .reset_poll = sil_sata_reset_poll, | 691 | .reset_poll = sil_sata_reset_poll, |
705 | .pre_reset = sil_sata_pre_reset, | 692 | .pre_reset = sil_sata_pre_reset, |
706 | .quirkproc = sil_quirkproc, | 693 | .quirkproc = sil_quirkproc, |
694 | .test_irq = sil_test_irq, | ||
707 | .udma_filter = sil_sata_udma_filter, | 695 | .udma_filter = sil_sata_udma_filter, |
708 | .cable_detect = sil_cable_detect, | 696 | .cable_detect = sil_cable_detect, |
709 | }; | 697 | }; |