Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08ebd43d authored by Laurent Riffard's avatar Laurent Riffard Committed by Jeff Garzik
Browse files

Fix broken pata_via cable detection



via_do_set_mode overwrites 80-wire cable detection bits. Let's
preserve them.

Signed-off-by: default avatarLaurent Riffard <laurent.riffard@free.fr>
Acked-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 897ee77b
Loading
Loading
Loading
Loading
+10 −3
Original line number Original line Diff line number Diff line
@@ -243,7 +243,6 @@ static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, int mo
	int ut;
	int ut;
	int offset = 3 - (2*ap->port_no) - adev->devno;
	int offset = 3 - (2*ap->port_no) - adev->devno;



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


@@ -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;
			ut = t.udma ? (0xe0 | (FIT(t.udma, 2, 9) - 2)) : 0x07;
			break;
			break;
	}
	}

	/* Set UDMA unless device is not UDMA capable */
	/* Set UDMA unless device is not UDMA capable */
	if (udma_type)
	if (udma_type) {
		pci_write_config_byte(pdev, 0x50 + offset, ut);
		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)
static void via_set_piomode(struct ata_port *ap, struct ata_device *adev)