aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/arm/icside.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index 99a27f2dc03a..7912a471f10d 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -250,7 +250,7 @@ static void icside_build_sglist(ide_drive_t *drive, struct request *rq)
250 */ 250 */
251static int icside_set_speed(ide_drive_t *drive, const u8 xfer_mode) 251static int icside_set_speed(ide_drive_t *drive, const u8 xfer_mode)
252{ 252{
253 int on = 0, cycle_time = 0, use_dma_info = 0; 253 int cycle_time, use_dma_info = 0;
254 254
255 switch (xfer_mode) { 255 switch (xfer_mode) {
256 case XFER_MW_DMA_2: 256 case XFER_MW_DMA_2:
@@ -272,6 +272,8 @@ static int icside_set_speed(ide_drive_t *drive, const u8 xfer_mode)
272 case XFER_SW_DMA_0: 272 case XFER_SW_DMA_0:
273 cycle_time = 480; 273 cycle_time = 480;
274 break; 274 break;
275 default:
276 return 1;
275 } 277 }
276 278
277 /* 279 /*
@@ -283,17 +285,10 @@ static int icside_set_speed(ide_drive_t *drive, const u8 xfer_mode)
283 285
284 drive->drive_data = cycle_time; 286 drive->drive_data = cycle_time;
285 287
286 if (cycle_time && ide_config_drive_speed(drive, xfer_mode) == 0)
287 on = 1;
288 else
289 drive->drive_data = 480;
290
291 printk("%s: %s selected (peak %dMB/s)\n", drive->name, 288 printk("%s: %s selected (peak %dMB/s)\n", drive->name,
292 ide_xfer_verbose(xfer_mode), 2000 / drive->drive_data); 289 ide_xfer_verbose(xfer_mode), 2000 / drive->drive_data);
293 290
294 drive->current_speed = xfer_mode; 291 return ide_config_drive_speed(drive, xfer_mode);
295
296 return on;
297} 292}
298 293
299static void icside_dma_host_off(ide_drive_t *drive) 294static void icside_dma_host_off(ide_drive_t *drive)
@@ -320,8 +315,7 @@ static int icside_dma_check(ide_drive_t *drive)
320{ 315{
321 struct hd_driveid *id = drive->id; 316 struct hd_driveid *id = drive->id;
322 ide_hwif_t *hwif = HWIF(drive); 317 ide_hwif_t *hwif = HWIF(drive);
323 int xfer_mode = XFER_PIO_2; 318 int xfer_mode = 0;
324 int on;
325 319
326 if (!(id->capability & 1) || !hwif->autodma) 320 if (!(id->capability & 1) || !hwif->autodma)
327 goto out; 321 goto out;
@@ -350,9 +344,10 @@ static int icside_dma_check(ide_drive_t *drive)
350 } 344 }
351 345
352out: 346out:
353 on = icside_set_speed(drive, xfer_mode); 347 if (xfer_mode == 0)
348 return -1;
354 349
355 return on ? 0 : -1; 350 return icside_set_speed(drive, xfer_mode) ? -1 : 0;
356} 351}
357 352
358static int icside_dma_end(ide_drive_t *drive) 353static int icside_dma_end(ide_drive_t *drive)