svn commit: r355026 - head/sys/arm/broadcom/bcm2835

Kyle Evans kevans at FreeBSD.org
Sat Nov 23 01:47:18 UTC 2019


Author: kevans
Date: Sat Nov 23 01:47:17 2019
New Revision: 355026
URL: https://svnweb.freebsd.org/changeset/base/355026

Log:
  bcm2835_dma: rip out the "use_dma" flag, make it non-optional
  
  Now that it works for the Raspberry Pi 4, we can discontinue our workarounds
  that were put in place to at least get a bootable kernel for other testing.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c	Sat Nov 23 01:46:02 2019	(r355025)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c	Sat Nov 23 01:47:17 2019	(r355026)
@@ -113,7 +113,6 @@ struct bcm_mmc_conf {
 	int	clock_src;
 	int	default_freq;
 	int	quirks;
-	bool	use_dma;
 	int	emmc_dreq;
 };
 
@@ -124,7 +123,6 @@ struct bcm_mmc_conf bcm2835_sdhci_conf = {
 	.quirks		= SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
 	    SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | SDHCI_QUIRK_DONT_SET_HISPD_BIT |
 	    SDHCI_QUIRK_MISSING_CAPS,
-	.use_dma	= true
 	.emmc_dreq	= BCM_DMA_DREQ_EMMC,
 };
 
@@ -133,7 +131,6 @@ struct bcm_mmc_conf bcm2838_emmc2_conf = {
 	.clock_src	= -1,
 	.default_freq	= BCM2838_DEFAULT_SDHCI_FREQ,
 	.quirks		= 0,
-	.use_dma	= true
 	.emmc_dreq	= BCM_DMA_DREQ_NONE,
 };
 
@@ -319,37 +316,35 @@ bcm_sdhci_attach(device_t dev)
 
 	sdhci_init_slot(dev, &sc->sc_slot, 0);
 
-	if (sc->conf->use_dma) {
-		sc->sc_dma_ch = bcm_dma_allocate(BCM_DMA_CH_ANY);
-		if (sc->sc_dma_ch == BCM_DMA_CH_INVALID)
-			goto fail;
+	sc->sc_dma_ch = bcm_dma_allocate(BCM_DMA_CH_ANY);
+	if (sc->sc_dma_ch == BCM_DMA_CH_INVALID)
+		goto fail;
 
-		err = bcm_dma_setup_intr(sc->sc_dma_ch, bcm_sdhci_dma_intr, sc);
-		if (err != 0) {
-			device_printf(dev,
-			    "cannot setup dma interrupt handler\n");
-			err = ENXIO;
-			goto fail;
-		}
+	err = bcm_dma_setup_intr(sc->sc_dma_ch, bcm_sdhci_dma_intr, sc);
+	if (err != 0) {
+		device_printf(dev,
+		    "cannot setup dma interrupt handler\n");
+		err = ENXIO;
+		goto fail;
+	}
 
-		/* Allocate bus_dma resources. */
-		err = bus_dma_tag_create(bus_get_dma_tag(dev),
-		    1, 0, bcm283x_dmabus_peripheral_lowaddr(),
-		    BUS_SPACE_MAXADDR, NULL, NULL,
-		    BCM_DMA_MAXSIZE, ALLOCATED_DMA_SEGS, BCM_SDHCI_BUFFER_SIZE,
-		    BUS_DMA_ALLOCNOW, NULL, NULL,
-		    &sc->sc_dma_tag);
+	/* Allocate bus_dma resources. */
+	err = bus_dma_tag_create(bus_get_dma_tag(dev),
+	    1, 0, bcm283x_dmabus_peripheral_lowaddr(),
+	    BUS_SPACE_MAXADDR, NULL, NULL,
+	    BCM_DMA_MAXSIZE, ALLOCATED_DMA_SEGS, BCM_SDHCI_BUFFER_SIZE,
+	    BUS_DMA_ALLOCNOW, NULL, NULL,
+	    &sc->sc_dma_tag);
 
-		if (err) {
-			device_printf(dev, "failed allocate DMA tag");
-			goto fail;
-		}
+	if (err) {
+		device_printf(dev, "failed allocate DMA tag");
+		goto fail;
+	}
 
-		err = bus_dmamap_create(sc->sc_dma_tag, 0, &sc->sc_dma_map);
-		if (err) {
-			device_printf(dev, "bus_dmamap_create failed\n");
-			goto fail;
-		}
+	err = bus_dmamap_create(sc->sc_dma_tag, 0, &sc->sc_dma_map);
+	if (err) {
+		device_printf(dev, "bus_dmamap_create failed\n");
+		goto fail;
 	}
 
 	/* FIXME: Fix along with other BUS_SPACE_PHYSADDR instances */
@@ -724,9 +719,6 @@ static int
 bcm_sdhci_will_handle_transfer(device_t dev, struct sdhci_slot *slot)
 {
 	struct bcm_sdhci_softc *sc = device_get_softc(slot->bus);
-
-	if (!sc->conf->use_dma)
-		return (0);
 
 	/*
 	 * This indicates that we somehow let a data interrupt slip by into the


More information about the svn-src-all mailing list