/* Return the cable type attached to this port  */
static int hpt3x2n_cable_detect(struct ata_port *ap)
/* Return the cable type attached to this port  */
static int hpt3x2n_cable_detect(struct ata_port *ap)
{
	u8 scr2, ata66;
	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
	pci_read_config_byte(pdev, 0x5B, &scr2);
	pci_write_config_byte(pdev, 0x5B, scr2 & ~0x01);
	udelay(10);
	pci_read_config_byte(pdev, 0x5A, &ata66);
	pci_write_config_byte(pdev, 0x5B, scr2);
	if (ata66 & (2 >> ap->port_no))
		return ATA_CBL_PATA40;
	else
		return ATA_CBL_PATA80;
}