aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_ali.c
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2009-01-05 09:13:53 -0500
committerJeff Garzik <jgarzik@redhat.com>2009-01-08 16:09:29 -0500
commitfc80902fdf4219a81eccca4a06259c4b56812ba5 (patch)
treeda9f5a9a5cc41d323516933714f89c60d2d71d94 /drivers/ata/pata_ali.c
parent1b2c357c301b76118973763e886d9f70a7f50f7e (diff)
pata_ali: Fix and workaround for FIFO DMA bug
In very obscure cases this can cause problems. We need to help the hardware out a bit to avoid DMA problems on a reset. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/pata_ali.c')
-rw-r--r--drivers/ata/pata_ali.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index d2ea2db61e52..a4f9e39442c6 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -35,7 +35,7 @@
35#include <linux/dmi.h> 35#include <linux/dmi.h>
36 36
37#define DRV_NAME "pata_ali" 37#define DRV_NAME "pata_ali"
38#define DRV_VERSION "0.7.7" 38#define DRV_VERSION "0.7.8"
39 39
40static int ali_atapi_dma = 0; 40static int ali_atapi_dma = 0;
41module_param_named(atapi_dma, ali_atapi_dma, int, 0644); 41module_param_named(atapi_dma, ali_atapi_dma, int, 0644);
@@ -341,6 +341,23 @@ static int ali_check_atapi_dma(struct ata_queued_cmd *qc)
341 return 0; 341 return 0;
342} 342}
343 343
344static void ali_c2_c3_postreset(struct ata_link *link, unsigned int *classes)
345{
346 u8 r;
347 int port_bit = 4 << link->ap->port_no;
348
349 /* If our bridge is an ALI 1533 then do the extra work */
350 if (isa_bridge) {
351 /* Tristate and re-enable the bus signals */
352 pci_read_config_byte(isa_bridge, 0x58, &r);
353 r &= ~port_bit;
354 pci_write_config_byte(isa_bridge, 0x58, r);
355 r |= port_bit;
356 pci_write_config_byte(isa_bridge, 0x58, r);
357 }
358 ata_sff_postreset(link, classes);
359}
360
344static struct scsi_host_template ali_sht = { 361static struct scsi_host_template ali_sht = {
345 ATA_BMDMA_SHT(DRV_NAME), 362 ATA_BMDMA_SHT(DRV_NAME),
346}; 363};
@@ -381,6 +398,17 @@ static struct ata_port_operations ali_c2_port_ops = {
381 .check_atapi_dma = ali_check_atapi_dma, 398 .check_atapi_dma = ali_check_atapi_dma,
382 .cable_detect = ali_c2_cable_detect, 399 .cable_detect = ali_c2_cable_detect,
383 .dev_config = ali_lock_sectors, 400 .dev_config = ali_lock_sectors,
401 .postreset = ali_c2_c3_postreset,
402};
403
404/*
405 * Port operations for DMA capable ALi with cable detect
406 */
407static struct ata_port_operations ali_c4_port_ops = {
408 .inherits = &ali_dma_base_ops,
409 .check_atapi_dma = ali_check_atapi_dma,
410 .cable_detect = ali_c2_cable_detect,
411 .dev_config = ali_lock_sectors,
384}; 412};
385 413
386/* 414/*
@@ -504,7 +532,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
504 .pio_mask = 0x1f, 532 .pio_mask = 0x1f,
505 .mwdma_mask = 0x07, 533 .mwdma_mask = 0x07,
506 .udma_mask = ATA_UDMA5, 534 .udma_mask = ATA_UDMA5,
507 .port_ops = &ali_c2_port_ops 535 .port_ops = &ali_c4_port_ops
508 }; 536 };
509 /* Revision 0xC5 is UDMA133 with LBA48 DMA */ 537 /* Revision 0xC5 is UDMA133 with LBA48 DMA */
510 static const struct ata_port_info info_c5 = { 538 static const struct ata_port_info info_c5 = {