Skip to content

Commit 23d8740

Browse files
bzolnierdavem330
authored andcommitted
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>
1 parent f6d23c2 commit 23d8740

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

‎drivers/ide/cmd64x.c‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ static void cmd64x_program_timings(ide_drive_t *drive, u8 mode)
8888
pci_write_config_byte(dev, drwtim_regs[drive->dn],
8989
(t.active << 4) | t.recover);
9090

91-
if (mode >= XFER_SW_DMA_0)
92-
return;
93-
9491
/*
9592
* The primary channel has individual address setup timing registers
9693
* for each drive and the hardware selects the slowest timing itself.
@@ -100,11 +97,17 @@ static void cmd64x_program_timings(ide_drive_t *drive, u8 mode)
10097
if (hwif->channel) {
10198
ide_drive_t *pair = ide_get_pair_dev(drive);
10299

103-
ide_set_drivedata(drive, (void *)(unsigned long)t.setup);
100+
if (pair) {
101+
struct ide_timing tp;
104102

105-
if (pair)
106-
t.setup = max_t(u8, t.setup,
107-
(unsigned long)ide_get_drivedata(pair));
103+
ide_timing_compute(pair, pair->pio_mode, &tp, T, 0);
104+
ide_timing_merge(&t, &tp, &t, IDE_TIMING_SETUP);
105+
if (pair->dma_mode) {
106+
ide_timing_compute(pair, pair->dma_mode,
107+
&tp, T, 0);
108+
ide_timing_merge(&tp, &t, &t, IDE_TIMING_SETUP);
109+
}
110+
}
108111
}
109112

110113
if (t.setup > 5) /* shouldn't actually happen... */

0 commit comments

Comments
 (0)