aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-timings.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-timings.c')
-rw-r--r--drivers/ide/ide-timings.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/ide/ide-timings.c b/drivers/ide/ide-timings.c
index 8c2f8327f487..d64f345f2fc0 100644
--- a/drivers/ide/ide-timings.c
+++ b/drivers/ide/ide-timings.c
@@ -78,15 +78,15 @@ EXPORT_SYMBOL_GPL(ide_timing_find_mode);
78 78
79u16 ide_pio_cycle_time(ide_drive_t *drive, u8 pio) 79u16 ide_pio_cycle_time(ide_drive_t *drive, u8 pio)
80{ 80{
81 struct hd_driveid *id = drive->id; 81 u16 *id = drive->id;
82 struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio); 82 struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio);
83 u16 cycle = 0; 83 u16 cycle = 0;
84 84
85 if (id->field_valid & 2) { 85 if (id[ATA_ID_FIELD_VALID] & 2) {
86 if (id->capability & 8) 86 if (drive->driveid->capability & 8)
87 cycle = id->eide_pio_iordy; 87 cycle = id[ATA_ID_EIDE_PIO_IORDY];
88 else 88 else
89 cycle = id->eide_pio; 89 cycle = id[ATA_ID_EIDE_PIO];
90 90
91 /* conservative "downgrade" for all pre-ATA2 drives */ 91 /* conservative "downgrade" for all pre-ATA2 drives */
92 if (pio < 3 && cycle < t->cycle) 92 if (pio < 3 && cycle < t->cycle)
@@ -138,7 +138,7 @@ EXPORT_SYMBOL_GPL(ide_timing_merge);
138int ide_timing_compute(ide_drive_t *drive, u8 speed, 138int ide_timing_compute(ide_drive_t *drive, u8 speed,
139 struct ide_timing *t, int T, int UT) 139 struct ide_timing *t, int T, int UT)
140{ 140{
141 struct hd_driveid *id = drive->id; 141 u16 *id = drive->id;
142 struct ide_timing *s, p; 142 struct ide_timing *s, p;
143 143
144 /* 144 /*
@@ -157,16 +157,15 @@ int ide_timing_compute(ide_drive_t *drive, u8 speed,
157 * If the drive is an EIDE drive, it can tell us it needs extended 157 * If the drive is an EIDE drive, it can tell us it needs extended
158 * PIO/MWDMA cycle timing. 158 * PIO/MWDMA cycle timing.
159 */ 159 */
160 if (id && id->field_valid & 2) { /* EIDE drive */ 160 if (id[ATA_ID_FIELD_VALID] & 2) { /* EIDE drive */
161
162 memset(&p, 0, sizeof(p)); 161 memset(&p, 0, sizeof(p));
163 162
164 if (speed <= XFER_PIO_2) 163 if (speed <= XFER_PIO_2)
165 p.cycle = p.cyc8b = id->eide_pio; 164 p.cycle = p.cyc8b = id[ATA_ID_EIDE_PIO];
166 else if (speed <= XFER_PIO_5) 165 else if (speed <= XFER_PIO_5)
167 p.cycle = p.cyc8b = id->eide_pio_iordy; 166 p.cycle = p.cyc8b = id[ATA_ID_EIDE_PIO_IORDY];
168 else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2) 167 else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2)
169 p.cycle = id->eide_dma_min; 168 p.cycle = id[ATA_ID_EIDE_DMA_MIN];
170 169
171 ide_timing_merge(&p, t, t, IDE_TIMING_CYCLE | IDE_TIMING_CYC8B); 170 ide_timing_merge(&p, t, t, IDE_TIMING_CYCLE | IDE_TIMING_CYC8B);
172 } 171 }