Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cmd64x: fix handling of address setup timings

Account for the requirements of the DMA mode currently used.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Bartlomiej Zolnierkiewicz and committed by
David S. Miller
23d87405 f6d23c2e

+10 -7
+10 -7
drivers/ide/cmd64x.c
··· 88 88 pci_write_config_byte(dev, drwtim_regs[drive->dn], 89 89 (t.active << 4) | t.recover); 90 90 91 - if (mode >= XFER_SW_DMA_0) 92 - return; 93 - 94 91 /* 95 92 * The primary channel has individual address setup timing registers 96 93 * for each drive and the hardware selects the slowest timing itself. ··· 97 100 if (hwif->channel) { 98 101 ide_drive_t *pair = ide_get_pair_dev(drive); 99 102 100 - ide_set_drivedata(drive, (void *)(unsigned long)t.setup); 103 + if (pair) { 104 + struct ide_timing tp; 101 105 102 - if (pair) 103 - t.setup = max_t(u8, t.setup, 104 - (unsigned long)ide_get_drivedata(pair)); 106 + ide_timing_compute(pair, pair->pio_mode, &tp, T, 0); 107 + ide_timing_merge(&t, &tp, &t, IDE_TIMING_SETUP); 108 + if (pair->dma_mode) { 109 + ide_timing_compute(pair, pair->dma_mode, 110 + &tp, T, 0); 111 + ide_timing_merge(&tp, &t, &t, IDE_TIMING_SETUP); 112 + } 113 + } 105 114 } 106 115 107 116 if (t.setup > 5) /* shouldn't actually happen... */