aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorAkira Iguchi <akira2.iguchi@toshiba.co.jp>2007-07-16 23:10:17 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-20 07:16:24 -0400
commitdcd0344775c1c0bf8ff3b9541863beea5088a7c9 (patch)
treed9d00cc6106aa9818c1349c1bb4ccd5660414a61 /drivers/ata
parent028a2596336b19a7e3713cfa9fe04d0d32e95876 (diff)
pata_scc.c: small fixes (Workaround for errata A308)
This patch fixes some issues of the previous patch: - Use mode_filter() hook to limit ATAPI UDMA mode - "data loss" warning message - handling of udma_mask Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp> Signed-off-by: Akira Iguchi <akira2.iguchi@toshiba.co.jp> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/pata_scc.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index c55667e0eb65..c0ffbed3e75d 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -238,12 +238,6 @@ static void scc_set_dmamode (struct ata_port *ap, struct ata_device *adev)
238 else 238 else
239 offset = 0; /* 100MHz */ 239 offset = 0; /* 100MHz */
240 240
241 /* errata A308 workaround: limit ATAPI UDMA mode to UDMA4 */
242 if (adev->class == ATA_DEV_ATAPI && speed > XFER_UDMA_4) {
243 printk(KERN_INFO "%s: limit ATAPI UDMA to UDMA4\n", DRV_NAME);
244 speed = XFER_UDMA_4;
245 }
246
247 if (speed >= XFER_UDMA_0) 241 if (speed >= XFER_UDMA_0)
248 idx = speed - XFER_UDMA_0; 242 idx = speed - XFER_UDMA_0;
249 else 243 else
@@ -264,6 +258,17 @@ static void scc_set_dmamode (struct ata_port *ap, struct ata_device *adev)
264 JCTSStbl[offset][idx] << 16 | JCENVTtbl[offset][idx]); 258 JCTSStbl[offset][idx] << 16 | JCENVTtbl[offset][idx]);
265} 259}
266 260
261unsigned long scc_mode_filter(struct ata_device *adev, unsigned long mask)
262{
263 /* errata A308 workaround: limit ATAPI UDMA mode to UDMA4 */
264 if (adev->class == ATA_DEV_ATAPI &&
265 (mask & (0xE0 << ATA_SHIFT_UDMA))) {
266 printk(KERN_INFO "%s: limit ATAPI UDMA to UDMA4\n", DRV_NAME);
267 mask &= ~(0xE0 << ATA_SHIFT_UDMA);
268 }
269 return ata_pci_default_filter(adev, mask);
270}
271
267/** 272/**
268 * scc_tf_load - send taskfile registers to host controller 273 * scc_tf_load - send taskfile registers to host controller
269 * @ap: Port to which output is sent 274 * @ap: Port to which output is sent
@@ -741,7 +746,7 @@ static u8 scc_bmdma_status (struct ata_port *ap)
741 return host_stat; 746 return host_stat;
742 747
743 /* errata A252,A308 workaround: Step4 */ 748 /* errata A252,A308 workaround: Step4 */
744 if (ata_altstatus(ap) & ATA_ERR && int_status & INTSTS_INTRQ) 749 if ((ata_altstatus(ap) & ATA_ERR) && (int_status & INTSTS_INTRQ))
745 return (host_stat | ATA_DMA_INTR); 750 return (host_stat | ATA_DMA_INTR);
746 751
747 /* errata A308 workaround Step5 */ 752 /* errata A308 workaround Step5 */
@@ -752,11 +757,11 @@ static u8 scc_bmdma_status (struct ata_port *ap)
752 if ((qc->tf.protocol == ATA_PROT_DMA && 757 if ((qc->tf.protocol == ATA_PROT_DMA &&
753 qc->dev->xfer_mode > XFER_UDMA_4)) { 758 qc->dev->xfer_mode > XFER_UDMA_4)) {
754 if (!(int_status & INTSTS_ACTEINT)) { 759 if (!(int_status & INTSTS_ACTEINT)) {
755 printk(KERN_WARNING "ata%u: data lost occurred. (ACTEINT==0, retry:%d)\n", 760 printk(KERN_WARNING "ata%u: operation failed (transfer data loss)\n",
756 ap->print_id, retry); 761 ap->print_id);
757 host_stat |= ATA_DMA_ERR; 762 host_stat |= ATA_DMA_ERR;
758 if (retry++) 763 if (retry++)
759 ap->udma_mask >>= 1; 764 ap->udma_mask &= ~(1 << qc->dev->xfer_mode);
760 } else 765 } else
761 retry = 0; 766 retry = 0;
762 } 767 }
@@ -1016,7 +1021,7 @@ static const struct ata_port_operations scc_pata_ops = {
1016 .port_disable = ata_port_disable, 1021 .port_disable = ata_port_disable,
1017 .set_piomode = scc_set_piomode, 1022 .set_piomode = scc_set_piomode,
1018 .set_dmamode = scc_set_dmamode, 1023 .set_dmamode = scc_set_dmamode,
1019 .mode_filter = ata_pci_default_filter, 1024 .mode_filter = scc_mode_filter,
1020 1025
1021 .tf_load = scc_tf_load, 1026 .tf_load = scc_tf_load,
1022 .tf_read = scc_tf_read, 1027 .tf_read = scc_tf_read,