aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-05-15 18:51:43 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-05-15 18:51:43 -0400
commit38ff8a74e8f015f94289b84cd6572a68c3431cdd (patch)
treee3ecc51f4717f3c763c8d4888b9647033fd55556 /drivers/ide
parent6b8cf7724bd0f8ae1f61937c5f40f4dbbda40960 (diff)
alim15x3: use ide_tune_dma()
Use ide_tune_dma() in ali15x3_config_drive_for_dma() and remove all the open coded DMA tuning code and also config_chipset_for_dma(). Set ->atapi_dma flag correctly in init_hwif_common_ali15x3() so ide_tune_dma() can take care of checking if ATAPI DMA is allowed and remove open coded ATAPI DMA check from ali15x3_config_drive_for_dma(). There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/pci/alim15x3.c69
1 files changed, 7 insertions, 62 deletions
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 428efdae0c7b..27525ec2e19a 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -455,28 +455,6 @@ static int ali15x3_tune_chipset (ide_drive_t *drive, u8 xferspeed)
455 return (ide_config_drive_speed(drive, speed)); 455 return (ide_config_drive_speed(drive, speed));
456} 456}
457 457
458
459/**
460 * config_chipset_for_dma - set up DMA mode
461 * @drive: drive to configure for
462 *
463 * Place a drive into DMA mode and tune the chipset for
464 * the selected speed.
465 *
466 * Returns true if DMA mode can be used
467 */
468
469static int config_chipset_for_dma (ide_drive_t *drive)
470{
471 u8 speed = ide_max_dma_mode(drive);
472
473 if (!(speed))
474 return 0;
475
476 (void) ali15x3_tune_chipset(drive, speed);
477 return ide_dma_enable(drive);
478}
479
480/** 458/**
481 * ali15x3_config_drive_for_dma - configure for DMA 459 * ali15x3_config_drive_for_dma - configure for DMA
482 * @drive: drive to configure 460 * @drive: drive to configure
@@ -487,48 +465,14 @@ static int config_chipset_for_dma (ide_drive_t *drive)
487 465
488static int ali15x3_config_drive_for_dma(ide_drive_t *drive) 466static int ali15x3_config_drive_for_dma(ide_drive_t *drive)
489{ 467{
490 ide_hwif_t *hwif = HWIF(drive);
491 struct hd_driveid *id = drive->id;
492
493 if ((m5229_revision<=0x20) && (drive->media!=ide_disk))
494 goto ata_pio;
495
496 drive->init_speed = 0; 468 drive->init_speed = 0;
497 469
498 if ((id != NULL) && ((id->capability & 1) != 0) && drive->autodma) { 470 if (ide_tune_dma(drive))
499 /* Consult the list of known "bad" drives */ 471 return 0;
500 if (__ide_dma_bad_drive(drive))
501 goto ata_pio;
502 if ((id->field_valid & 4) && (m5229_revision >= 0xC2)) {
503 if (id->dma_ultra & hwif->ultra_mask) {
504 /* Force if Capable UltraDMA */
505 int dma = config_chipset_for_dma(drive);
506 if ((id->field_valid & 2) && !dma)
507 goto try_dma_modes;
508 }
509 } else if (id->field_valid & 2) {
510try_dma_modes:
511 if ((id->dma_mword & hwif->mwdma_mask) ||
512 (id->dma_1word & hwif->swdma_mask)) {
513 /* Force if Capable regular DMA modes */
514 if (!config_chipset_for_dma(drive))
515 goto ata_pio;
516 }
517 } else if (__ide_dma_good_drive(drive) &&
518 (id->eide_dma_time < 150)) {
519 /* Consult the list of known "good" drives */
520 if (!config_chipset_for_dma(drive))
521 goto ata_pio;
522 } else {
523 goto ata_pio;
524 }
525 } else {
526ata_pio:
527 hwif->tuneproc(drive, 255);
528 return -1;
529 }
530 472
531 return 0; 473 ali15x3_tune_drive(drive, 255);
474
475 return -1;
532} 476}
533 477
534/** 478/**
@@ -739,7 +683,8 @@ static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif)
739 return; 683 return;
740 } 684 }
741 685
742 hwif->atapi_dma = 1; 686 if (m5229_revision > 0x20)
687 hwif->atapi_dma = 1;
743 688
744 if (m5229_revision <= 0x20) 689 if (m5229_revision <= 0x20)
745 hwif->ultra_mask = 0x00; /* no udma */ 690 hwif->ultra_mask = 0x00; /* no udma */