All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: [PATCH] ide-pmac: use ide_tune_dma() (take 2)
Date: Sat, 4 Aug 2007 22:04:01 +0200	[thread overview]
Message-ID: <200708042204.01165.bzolnier@gmail.com> (raw)


* Add missing initialization of hwif->autodma and drive->autodma to
  pmac_ide_setup_dma().

* Use ide_tune_dma() in pmac_ide_dma_check().

While at it:

* Fix pmac_ide_dma_check() return value if DMA mode is not programmed
  (should be "-1" otherwise ide_set_dma() will try to enable DMA).

* Remove unnecessary drive->using_dma fiddling (->dma_off_quietly is always
  called before ide_set_dma() call and ide_set_dma() calls ->ide_dma_on if
  ->ide_dma_check returns "0").

v2:
* No reason to blacklist all ide_floppy devices and the old code was always
  enabling DMA anyway (without even programming controller/device if the
  device was ide_floppy).

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
Ben, any update on the testing status of ide-pmac series?

I also merged your patch to my tree but it is lacking description:
http://kernel.org/pub/linux/kernel/people/bart/pata-2.6/patches/ide-pmac-fix-pio-setup-and-enable-autotune.patch

Thanks, Bart.

 drivers/ide/ppc/pmac.c |   24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

Index: b/drivers/ide/ppc/pmac.c
===================================================================
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1592,23 +1592,10 @@ pmac_ide_destroy_dmatable (ide_drive_t *
 static int
 pmac_ide_dma_check(ide_drive_t *drive)
 {
-	int enable = 1;
-	drive->using_dma = 0;
-	
-	if (drive->media == ide_floppy)
-		enable = 0;
-	if ((drive->id->capability & 1) == 0 && !__ide_dma_good_drive(drive))
-		enable = 0;
-	if (__ide_dma_bad_drive(drive))
-		enable = 0;
-
-	if (enable) {
-		u8 mode = ide_max_dma_mode(drive);
+	if (ide_tune_dma(drive))
+		return 0;
 
-		if (mode && pmac_ide_tune_chipset(drive, mode) == 0)
-			drive->using_dma = 1;
-	}
-	return 0;
+	return -1;
 }
 
 /*
@@ -1842,7 +1829,10 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif
 			hwif->mwdma_mask = 0x07;
 			hwif->swdma_mask = 0x00;
 			break;
-	}	
+	}
+
+	hwif->autodma = 1;
+	hwif->drives[1].autodma = hwif->drives[0].autodma = hwif->autodma;
 }
 
 #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */

                 reply	other threads:[~2007-08-04 20:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200708042204.01165.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=benh@kernel.crashing.org \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.