Skip to content

Commit

Permalink
Fix broken pata_via cable detection
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Laurent Riffard authored and Jeff Garzik committed Sep 11, 2007
1 parent 897ee77 commit 08ebd43
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions drivers/ata/pata_via.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, int mo
int ut;
int offset = 3 - (2*ap->port_no) - adev->devno;


/* Calculate the timing values we require */
ata_timing_compute(adev, mode, &t, T, UT);

Expand Down Expand Up @@ -290,9 +289,17 @@ static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, int mo
ut = t.udma ? (0xe0 | (FIT(t.udma, 2, 9) - 2)) : 0x07;
break;
}

/* Set UDMA unless device is not UDMA capable */
if (udma_type)
pci_write_config_byte(pdev, 0x50 + offset, ut);
if (udma_type) {
u8 cable80_status;

/* Get 80-wire cable detection bit */
pci_read_config_byte(pdev, 0x50 + offset, &cable80_status);
cable80_status &= 0x10;

pci_write_config_byte(pdev, 0x50 + offset, ut | cable80_status);
}
}

static void via_set_piomode(struct ata_port *ap, struct ata_device *adev)
Expand Down

0 comments on commit 08ebd43

Please sign in to comment.