Subject: Re: CD DMA problems on Blade 100
To: NetBSD port-sparc64 mailing list <port-sparc64@netbsd.org>
From: Julian Coleman <jdc@coris.org.uk>
List: port-sparc64
Date: 08/02/2006 16:39:46
I had a look at the FreeBSD and Linux IDE code and came up with the attached
changes to aceride.c.  Although I believe I have all the settings that they
use, I still can't get the Blade 100 to use DMA (or UDMA) with the CD drive.
I don't know if these changes should be commited as I can't test them.

J

  - - 8< - - - - - - - - - - - - - Cut here - - - - - - - - - - - - - >8 - -
--- aceride.c.dist	2005-12-11 15:10:43.000000000 +0000
+++ aceride.c	2006-08-01 14:20:03.000000000 +0100
@@ -149,9 +149,19 @@
 	sc->sc_wdcdev.sc_atac.atac_channels = sc->wdc_chanarray;
 	sc->sc_wdcdev.sc_atac.atac_nchannels = PCIIDE_NUM_CHANNELS;
 
-	pciide_pci_write(sc->sc_pc, sc->sc_tag, ACER_CDRC,
-	    (pciide_pci_read(sc->sc_pc, sc->sc_tag, ACER_CDRC) |
-		ACER_CDRC_DMA_EN) & ~ACER_CDRC_FIFO_DISABLE);
+	/* Enable CD DMA */
+	if (rev <= 0x20)
+		pciide_pci_write(sc->sc_pc, sc->sc_tag, ACER_CDRC,
+		    (pciide_pci_read(sc->sc_pc, sc->sc_tag, ACER_CDRC) |
+			ACER_CDRC_DMA_EN) & ~ACER_CDRC_FIFO_DISABLE);
+	else if (rev == 0xc7)
+		pciide_pci_write(sc->sc_pc, sc->sc_tag, ACER_CDRC,
+		    (pciide_pci_read(sc->sc_pc, sc->sc_tag, ACER_CDRC) |
+			ACER_CDRC_DMA_EN) | ACER_CDRC_FIFO_DISABLE);
+	else
+		pciide_pci_write(sc->sc_pc, sc->sc_tag, ACER_CDRC,
+		    pciide_pci_read(sc->sc_pc, sc->sc_tag, ACER_CDRC) |
+			ACER_CDRC_DMA_EN);
 
 	/* Enable "microsoft register bits" R/W. */
 	pciide_pci_write(sc->sc_pc, sc->sc_tag, ACER_CCAR3,
@@ -169,8 +179,13 @@
 	interface = PCI_INTERFACE(pci_conf_read(sc->sc_pc, sc->sc_tag,
 	    PCI_CLASS_REG));
 
-	/* From linux: enable "Cable Detection" */
 	if (rev >= 0xC2) {
+		/* From FreeBSD: use device interrupt as byte count end */
+		pciide_pci_write(sc->sc_pc, sc->sc_tag, ACER_0x4A,
+		    pciide_pci_read(sc->sc_pc, sc->sc_tag, ACER_0x4A)
+		    | ACER_0x4A_BCEINT);
+
+		/* From linux: enable "Cable Detection" */
 		pciide_pci_write(sc->sc_pc, sc->sc_tag, ACER_0x4B,
 		    pciide_pci_read(sc->sc_pc, sc->sc_tag, ACER_0x4B)
 		    | ACER_0x4B_CDETECT);

  - - 8< - - - - - - - - - - - - - Cut here - - - - - - - - - - - - - >8 - -

-- 
  My other computer also runs NetBSD    /        Sailing at Newbiggin
        http://www.netbsd.org/        /   http://www.newbigginsailingclub.org/