/* Program the UDMA timing for this drive according to the current clock. Handles the dual clocks and also knows about the errata on the 0x10 revision. The UDMA errata is partly handled here and partly in start_dma.  */
static void it821x_program_udma(struct ata_port *ap, struct ata_device *adev, u16 timing)
/* Program the UDMA timing for this drive according to the current clock. Handles the dual clocks and also knows about the errata on the 0x10 revision. The UDMA errata is partly handled here and partly in start_dma.  */
static void it821x_program_udma(struct ata_port *ap, struct ata_device *adev, u16 timing)
{
	struct it821x_dev *itdev = ap->private_data;
	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
	int channel = ap->port_no;
	int unit = adev->devno;
	u8 conf;
	if (itdev->clock_mode == ATA_66)
		conf = timing >> 8;
	else
		conf = timing & 0xFF;
	if (itdev->timing10 == 0)
		pci_write_config_byte(pdev, 0x56 + 4 * channel + unit, conf);
	else {
		pci_write_config_byte(pdev, 0x56 + 4 * channel, conf);
		pci_write_config_byte(pdev, 0x56 + 4 * channel + 1, conf);
	}
}