diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2010-01-18 02:21:05 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-01-19 04:52:30 -0500 |
commit | cde727be967a86aee01042f35c8a861728272cf1 (patch) | |
tree | 940b60eaf2c106337677ce06b9557816e90044b6 /drivers/ide/alim15x3.c | |
parent | 8e714a074bc4da070807d019d4287dcd32af55f5 (diff) |
alim15x3: fix handling of address setup timings
Account for the requirements of the other device on the port.
Based on libata pata_ali host driver.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ide/alim15x3.c')
-rw-r--r-- | drivers/ide/alim15x3.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/ide/alim15x3.c b/drivers/ide/alim15x3.c index 6f0debae4e27..8e29801bbeb0 100644 --- a/drivers/ide/alim15x3.c +++ b/drivers/ide/alim15x3.c | |||
@@ -72,6 +72,7 @@ static void ali_fifo_control(ide_hwif_t *hwif, ide_drive_t *drive, int on) | |||
72 | static void ali_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | 72 | static void ali_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
73 | { | 73 | { |
74 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 74 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
75 | ide_drive_t *pair = ide_get_pair_dev(drive); | ||
75 | int bus_speed = ide_pci_clk ? ide_pci_clk : 33; | 76 | int bus_speed = ide_pci_clk ? ide_pci_clk : 33; |
76 | unsigned long T = 1000000 / bus_speed; /* PCI clock based */ | 77 | unsigned long T = 1000000 / bus_speed; /* PCI clock based */ |
77 | int port = hwif->channel ? 0x5c : 0x58; | 78 | int port = hwif->channel ? 0x5c : 0x58; |
@@ -79,6 +80,16 @@ static void ali_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
79 | struct ide_timing t; | 80 | struct ide_timing t; |
80 | 81 | ||
81 | ide_timing_compute(drive, drive->pio_mode, &t, T, 1); | 82 | ide_timing_compute(drive, drive->pio_mode, &t, T, 1); |
83 | if (pair) { | ||
84 | struct ide_timing p; | ||
85 | |||
86 | ide_timing_compute(pair, pair->pio_mode, &p, T, 1); | ||
87 | ide_timing_merge(&p, &t, &t, IDE_TIMING_SETUP); | ||
88 | if (pair->dma_mode) { | ||
89 | ide_timing_compute(pair, pair->dma_mode, &p, T, 1); | ||
90 | ide_timing_merge(&p, &t, &t, IDE_TIMING_SETUP); | ||
91 | } | ||
92 | } | ||
82 | 93 | ||
83 | t.setup = clamp_val(t.setup, 1, 8) & 7; | 94 | t.setup = clamp_val(t.setup, 1, 8) & 7; |
84 | t.active = clamp_val(t.active, 1, 8) & 7; | 95 | t.active = clamp_val(t.active, 1, 8) & 7; |