Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Make emmc use of dma controller optional and disabl...



details:   https://anonhg.NetBSD.org/src/rev/f0b5cb39d830
branches:  trunk
changeset: 802398:f0b5cb39d830
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Sep 13 08:08:24 2014 +0000

description:
Make emmc use of dma controller optional and disable the bcmdmac for now.

It doesn't work for me.

diffstat:

 sys/arch/arm/broadcom/bcm2835_emmc.c |  26 ++++++++++++++++++--------
 sys/arch/arm/broadcom/files.bcm2835  |   4 ++--
 sys/arch/evbarm/conf/RPI             |   4 ++--
 3 files changed, 22 insertions(+), 12 deletions(-)

diffs (137 lines):

diff -r 94366ca72ee4 -r f0b5cb39d830 sys/arch/arm/broadcom/bcm2835_emmc.c
--- a/sys/arch/arm/broadcom/bcm2835_emmc.c      Sat Sep 13 02:21:52 2014 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_emmc.c      Sat Sep 13 08:08:24 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_emmc.c,v 1.13 2014/09/12 21:00:11 jmcneill Exp $       */
+/*     $NetBSD: bcm2835_emmc.c,v 1.14 2014/09/13 08:08:24 skrll Exp $  */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.13 2014/09/12 21:00:11 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.14 2014/09/13 08:08:24 skrll Exp $");
+
+#include "bcmdmac.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -79,8 +81,10 @@
 static int bcmemmc_match(device_t, struct cfdata *, void *);
 static void bcmemmc_attach(device_t, device_t, void *);
 static void bcmemmc_attach_i(device_t);
+#if BCMDMAC > 0
 static int bcmemmc_xfer_data_dma(struct sdhc_host *, struct sdmmc_command *);
 static void bcmemmc_dma_done(void *);
+#endif
 
 CFATTACH_DECL_NEW(bcmemmc, sizeof(struct bcmemmc_softc),
     bcmemmc_match, bcmemmc_attach, NULL, NULL);
@@ -106,7 +110,6 @@
        struct amba_attach_args *aaa = aux;
        prop_number_t frequency;
        int error;
-       int rseg;
 
        sc->sc.sc_dev = self;
        sc->sc.sc_dmat = aaa->aaa_dmat;
@@ -116,14 +119,10 @@
        sc->sc.sc_flags |= SDHC_FLAG_NO_HS_BIT;
        sc->sc.sc_caps = SDHC_VOLTAGE_SUPP_3_3V | SDHC_HIGH_SPEED_SUPP |
            SDHC_MAX_BLK_LEN_1024;
-       sc->sc.sc_flags |= SDHC_FLAG_USE_DMA;
-       sc->sc.sc_flags |= SDHC_FLAG_EXTERNAL_DMA;
-       sc->sc.sc_caps |= SDHC_DMA_SUPPORT;
 
        sc->sc.sc_host = sc->sc_hosts;
        sc->sc.sc_clkbase = 50000;      /* Default to 50MHz */
        sc->sc_iot = aaa->aaa_iot;
-       sc->sc.sc_vendor_transfer_data_dma = bcmemmc_xfer_data_dma;
 
        /* Fetch the EMMC clock frequency from property if set. */
        frequency = prop_dictionary_get(dict, "frequency");
@@ -154,15 +153,22 @@
        }
        aprint_normal_dev(self, "interrupting on intr %d\n", aaa->aaa_intr);
 
+#if BCMDMAC > 0
        sc->sc_dmac = bcm_dmac_alloc(BCM_DMAC_TYPE_NORMAL, IPL_SDMMC,
            bcmemmc_dma_done, sc);
        if (sc->sc_dmac == NULL)
-               goto fail;
+               goto done;
+
+       sc->sc.sc_flags |= SDHC_FLAG_USE_DMA;
+       sc->sc.sc_flags |= SDHC_FLAG_EXTERNAL_DMA;
+       sc->sc.sc_caps |= SDHC_DMA_SUPPORT;
+       sc->sc.sc_vendor_transfer_data_dma = bcmemmc_xfer_data_dma;
 
        sc->sc_state = EMMC_DMA_STATE_IDLE;
        mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_SDMMC);
        cv_init(&sc->sc_cv, "bcmemmcdma");
 
+       int rseg;
        error = bus_dmamem_alloc(sc->sc.sc_dmat, PAGE_SIZE, PAGE_SIZE,
             PAGE_SIZE, sc->sc_segs, 1, &rseg, BUS_DMA_WAITOK);
        if (error) {
@@ -194,6 +200,8 @@
                goto fail;
        }
 
+done:
+#endif
        config_interrupts(self, bcmemmc_attach_i);
        return;
 
@@ -229,6 +237,7 @@
        bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_ios);
 }
 
+#if BCMDMAC > 0
 static int
 bcmemmc_xfer_data_dma(struct sdhc_host *hp, struct sdmmc_command *cmd)
 {
@@ -315,3 +324,4 @@
        mutex_exit(&sc->sc_lock);
 
 }
+#endif
diff -r 94366ca72ee4 -r f0b5cb39d830 sys/arch/arm/broadcom/files.bcm2835
--- a/sys/arch/arm/broadcom/files.bcm2835       Sat Sep 13 02:21:52 2014 +0000
+++ b/sys/arch/arm/broadcom/files.bcm2835       Sat Sep 13 08:08:24 2014 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.bcm2835,v 1.22 2014/09/07 14:16:44 jmcneill Exp $
+#      $NetBSD: files.bcm2835,v 1.23 2014/09/13 08:08:24 skrll Exp $
 #
 # Configuration info for Broadcom BCM2835 ARM Peripherals
 #
@@ -57,7 +57,7 @@
 # DMA Controller (BCM2835_DMA0_BASE)
 device bcmdmac
 attach bcmdmac at obio with bcmdmac_amba
-file   arch/arm/broadcom/bcm2835_dmac.c        bcmdmac
+file   arch/arm/broadcom/bcm2835_dmac.c        bcmdmac         needs-flag
 
 # USB (BCM2835_USB_BASE)
 attach dwctwo at obio with bcmdwctwo
diff -r 94366ca72ee4 -r f0b5cb39d830 sys/arch/evbarm/conf/RPI
--- a/sys/arch/evbarm/conf/RPI  Sat Sep 13 02:21:52 2014 +0000
+++ b/sys/arch/evbarm/conf/RPI  Sat Sep 13 08:08:24 2014 +0000
@@ -1,5 +1,5 @@
 #
-#      $NetBSD: RPI,v 1.52 2014/09/12 20:51:21 jmcneill Exp $
+#      $NetBSD: RPI,v 1.53 2014/09/13 08:08:24 skrll Exp $
 #
 #      RPi -- Raspberry Pi
 #
@@ -181,7 +181,7 @@
 vcmbox0        at bcmmbox0
 
 # DMA Controller
-bcmdmac0       at obio?
+#bcmdmac0      at obio?
 
 # VCHIQ
 vchiq0         at obio?



Home | Main Index | Thread Index | Old Index