Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc/booke/dev When using DMA, make sure to init...



details:   https://anonhg.NetBSD.org/src/rev/e7d75bb315c4
branches:  trunk
changeset: 780471:e7d75bb315c4
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Jul 26 18:38:10 2012 +0000

description:
When using DMA, make sure to initialize SNOOPing.

diffstat:

 sys/arch/powerpc/booke/dev/pq3sdhc.c |  20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diffs (50 lines):

diff -r fb2946102f85 -r e7d75bb315c4 sys/arch/powerpc/booke/dev/pq3sdhc.c
--- a/sys/arch/powerpc/booke/dev/pq3sdhc.c      Thu Jul 26 18:36:55 2012 +0000
+++ b/sys/arch/powerpc/booke/dev/pq3sdhc.c      Thu Jul 26 18:38:10 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pq3sdhc.c,v 1.4 2012/02/23 21:07:35 matt Exp $ */
+/*     $NetBSD: pq3sdhc.c,v 1.5 2012/07/26 18:38:10 matt Exp $ */
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -28,8 +28,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#define        ESDHC_PRIVATE
+
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pq3sdhc.c,v 1.4 2012/02/23 21:07:35 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3sdhc.c,v 1.5 2012/07/26 18:38:10 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -85,7 +87,7 @@
        psc->sc_children |= cna->cna_childmask;
        sc->sc.sc_dmat = cna->cna_dmat;
        sc->sc.sc_dev = self;
-       sc->sc.sc_flags |= SDHC_FLAG_USE_DMA;
+       //sc->sc.sc_flags |= SDHC_FLAG_USE_DMA;
        sc->sc.sc_flags |=
            SDHC_FLAG_HAVE_DVS | SDHC_FLAG_32BIT_ACCESS | SDHC_FLAG_ENHANCED;
        sc->sc.sc_host = sc->sc_hosts;
@@ -100,8 +102,18 @@
                return;
        }
 
+       /*
+        * If using DMA, enable SNOOPing.
+        */
+       if (sc->sc.sc_flags & SDHC_FLAG_USE_DMA) {
+               uint32_t dcr = bus_space_read_4(sc->sc_bst, sc->sc_bsh, DCR);
+               dcr |= DCR_SNOOP | DCR_RD_SAFE | DCR_RD_PFE;
+               bus_space_write_4(sc->sc_bst, sc->sc_bsh, DCR, dcr);
+       }
+
        aprint_naive(": SDHC controller\n");
-       aprint_normal(": SDHC controller\n");
+       aprint_normal(": SDHC controller%s\n",
+          (sc->sc.sc_flags & SDHC_FLAG_USE_DMA) ? " (DMA enabled)" : "");
 
        sc->sc_ih = intr_establish(cnl->cnl_intrs[0], IPL_VM, IST_ONCHIP,
            sdhc_intr, &sc->sc);



Home | Main Index | Thread Index | Old Index