aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorLaurent Riffard <laurent.riffard@free.fr>2007-09-02 15:01:32 -0400
committerJeff Garzik <jeff@garzik.org>2007-09-10 21:50:24 -0400
commit08ebd43d6b9b63de681b8f255c0fabae8033527c (patch)
treebe2669523b6f147c801d89cac26c709349163a68 /drivers/ata
parent897ee77bfba12b83752027427a41009961458ee6 (diff)
Fix broken pata_via cable detection
via_do_set_mode overwrites 80-wire cable detection bits. Let's preserve them. Signed-off-by: Laurent Riffard <laurent.riffard@free.fr> Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/pata_via.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index ea18e33f50ef..1b0acafad1a6 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -243,7 +243,6 @@ static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, int mo
243 int ut; 243 int ut;
244 int offset = 3 - (2*ap->port_no) - adev->devno; 244 int offset = 3 - (2*ap->port_no) - adev->devno;
245 245
246
247 /* Calculate the timing values we require */ 246 /* Calculate the timing values we require */
248 ata_timing_compute(adev, mode, &t, T, UT); 247 ata_timing_compute(adev, mode, &t, T, UT);
249 248
@@ -290,9 +289,17 @@ static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, int mo
290 ut = t.udma ? (0xe0 | (FIT(t.udma, 2, 9) - 2)) : 0x07; 289 ut = t.udma ? (0xe0 | (FIT(t.udma, 2, 9) - 2)) : 0x07;
291 break; 290 break;
292 } 291 }
292
293 /* Set UDMA unless device is not UDMA capable */ 293 /* Set UDMA unless device is not UDMA capable */
294 if (udma_type) 294 if (udma_type) {
295 pci_write_config_byte(pdev, 0x50 + offset, ut); 295 u8 cable80_status;
296
297 /* Get 80-wire cable detection bit */
298 pci_read_config_byte(pdev, 0x50 + offset, &cable80_status);
299 cable80_status &= 0x10;
300
301 pci_write_config_byte(pdev, 0x50 + offset, ut | cable80_status);
302 }
296} 303}
297 304
298static void via_set_piomode(struct ata_port *ap, struct ata_device *adev) 305static void via_set_piomode(struct ata_port *ap, struct ata_device *adev)