diff options
Diffstat (limited to 'drivers/ide/legacy/qd65xx.c')
-rw-r--r-- | drivers/ide/legacy/qd65xx.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 2338f344ea24..ef4e84053a81 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c | |||
@@ -151,12 +151,14 @@ static int qd_find_disk_type (ide_drive_t *drive, | |||
151 | int *active_time, int *recovery_time) | 151 | int *active_time, int *recovery_time) |
152 | { | 152 | { |
153 | struct qd65xx_timing_s *p; | 153 | struct qd65xx_timing_s *p; |
154 | char model[40]; | 154 | char *m = (char *)&drive->id[ATA_ID_PROD]; |
155 | char model[ATA_ID_PROD_LEN]; | ||
155 | 156 | ||
156 | if (!*drive->id->model) return 0; | 157 | if (*m == 0) |
158 | return 0; | ||
157 | 159 | ||
158 | strncpy(model,drive->id->model,40); | 160 | strncpy(model, m, ATA_ID_PROD_LEN); |
159 | ide_fixstring(model,40,1); /* byte-swap */ | 161 | ide_fixstring(model, ATA_ID_PROD_LEN, 1); /* byte-swap */ |
160 | 162 | ||
161 | for (p = qd65xx_timing ; p->offset != -1 ; p++) { | 163 | for (p = qd65xx_timing ; p->offset != -1 ; p++) { |
162 | if (!strncmp(p->model, model+p->offset, 4)) { | 164 | if (!strncmp(p->model, model+p->offset, 4)) { |
@@ -185,20 +187,20 @@ static void qd_set_timing (ide_drive_t *drive, u8 timing) | |||
185 | 187 | ||
186 | static void qd6500_set_pio_mode(ide_drive_t *drive, const u8 pio) | 188 | static void qd6500_set_pio_mode(ide_drive_t *drive, const u8 pio) |
187 | { | 189 | { |
190 | u16 *id = drive->id; | ||
188 | int active_time = 175; | 191 | int active_time = 175; |
189 | int recovery_time = 415; /* worst case values from the dos driver */ | 192 | int recovery_time = 415; /* worst case values from the dos driver */ |
190 | 193 | ||
191 | /* | 194 | /* |
192 | * FIXME: use "pio" value | 195 | * FIXME: use "pio" value |
193 | */ | 196 | */ |
194 | if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time) | 197 | if (!qd_find_disk_type(drive, &active_time, &recovery_time) && |
195 | && drive->id->tPIO && (drive->id->field_valid & 0x02) | 198 | drive->driveid->tPIO && (id[ATA_ID_FIELD_VALID] & 2) && |
196 | && drive->id->eide_pio >= 240) { | 199 | id[ATA_ID_EIDE_PIO] >= 240) { |
197 | |||
198 | printk(KERN_INFO "%s: PIO mode%d\n", drive->name, | 200 | printk(KERN_INFO "%s: PIO mode%d\n", drive->name, |
199 | drive->id->tPIO); | 201 | drive->driveid->tPIO); |
200 | active_time = 110; | 202 | active_time = 110; |
201 | recovery_time = drive->id->eide_pio - 120; | 203 | recovery_time = drive->id[ATA_ID_EIDE_PIO] - 120; |
202 | } | 204 | } |
203 | 205 | ||
204 | qd_set_timing(drive, qd6500_compute_timing(HWIF(drive), active_time, recovery_time)); | 206 | qd_set_timing(drive, qd6500_compute_timing(HWIF(drive), active_time, recovery_time)); |