[PATCH 2/7] SD Card : Changes over initial commit

Mudit Jain muditjain18011995 at gmail.com
Sun Aug 28 07:25:07 UTC 2016


---
 freebsd/sys/arm/broadcom/bcm2835/bcm2835_dma.c | 13 +++++++++++++
 libbsd_waf.py                                  |  3 ++-
 rtemsbsd/include/bsp/nexus-devices.h           |  7 +++++++
 rtemsbsd/include/machine/rtems-bsd-nexus-bus.h | 21 +++++++++++++++++++++
 4 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/freebsd/sys/arm/broadcom/bcm2835/bcm2835_dma.c b/freebsd/sys/arm/broadcom/bcm2835/bcm2835_dma.c
index 98dd2cf..a3b89ee 100644
--- a/freebsd/sys/arm/broadcom/bcm2835/bcm2835_dma.c
+++ b/freebsd/sys/arm/broadcom/bcm2835/bcm2835_dma.c
@@ -42,10 +42,12 @@ __FBSDID("$FreeBSD$");
 #include <rtems/bsd/sys/resource.h>
 #include <sys/rman.h>
 
+#ifndef __rtems__
 #include <dev/fdt/fdt_common.h>
 #include <dev/ofw/openfirm.h>
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
+#endif /* __rtems__ */
 
 #include <vm/vm.h>
 #include <vm/pmap.h>
@@ -657,11 +659,13 @@ static int
 bcm_dma_probe(device_t dev)
 {
 
+#ifndef __rtems__
 	if (!ofw_bus_status_okay(dev))
 		return (ENXIO);
 
 	if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-dma"))
 		return (ENXIO);
+#endif /* __rtems__ */
 
 	device_set_desc(dev, "BCM2835 DMA Controller");
 	return (BUS_PROBE_DEFAULT);
@@ -671,7 +675,9 @@ static int
 bcm_dma_attach(device_t dev)
 {
 	struct bcm_dma_softc *sc = device_get_softc(dev);
+#ifndef __rtems__
 	phandle_t node;
+#endif /* __rtems__ */
 	int rid, err = 0;
 	int i;
 
@@ -685,6 +691,7 @@ bcm_dma_attach(device_t dev)
 		sc->sc_intrhand[i] = NULL;
 	}
 
+#ifndef __rtems__
 	/* Get DMA channel mask. */
 	node = ofw_bus_get_node(sc->sc_dev);
 	if (OF_getencprop(node, "brcm,dma-channel-mask", &bcm_dma_channel_mask,
@@ -695,6 +702,7 @@ bcm_dma_attach(device_t dev)
 		return (ENXIO);
 	}
 
+#endif /* __rtems__ */
 	/* Mask out channels used by GPU. */
 	bcm_dma_channel_mask &= ~BCM_DMA_CH_GPU_MASK;
 
@@ -764,5 +772,10 @@ static driver_t bcm_dma_driver = {
 
 static devclass_t bcm_dma_devclass;
 
+#ifndef __rtems__
 DRIVER_MODULE(bcm_dma, simplebus, bcm_dma_driver, bcm_dma_devclass, 0, 0);
 MODULE_VERSION(bcm_dma, 1);
+#else /* __rtems__ */
+DRIVER_MODULE(bcm_dma, nexus, bcm_dma_driver, bcm_dma_devclass, 0, 0);
+MODULE_VERSION(bcm_dma, 1);
+#endif /* __rtems__ */
diff --git a/libbsd_waf.py b/libbsd_waf.py
index 524b8bc..eff7bf8 100644
--- a/libbsd_waf.py
+++ b/libbsd_waf.py
@@ -1142,7 +1142,8 @@ def build(bld):
               'rtemsbsd/telnetd/telnetd-service.c',
               'rtemsbsd/telnetd/telnetd.c']
     if bld.get_env()["RTEMS_ARCH"] == "arm":
-        source += ['freebsd/sys/mips/mips/in_cksum.c']
+        source += ['freebsd/sys/arm/broadcom/bcm2835/bcm2835_dma.c',
+                   'freebsd/sys/mips/mips/in_cksum.c']
     if bld.get_env()["RTEMS_ARCH"] == "avr":
         source += ['freebsd/sys/mips/mips/in_cksum.c']
     if bld.get_env()["RTEMS_ARCH"] == "bfin":
diff --git a/rtemsbsd/include/bsp/nexus-devices.h b/rtemsbsd/include/bsp/nexus-devices.h
index 45beb30..cbffcf6 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -95,6 +95,13 @@ RTEMS_BSD_DRIVER_TSEC(0xffeb0000,
 
 #endif /* !QORIQ_CHIP_IS_T_VARIANT(QORIQ_CHIP_VARIANT) */
 
+#elif defined(LIBBSP_ARM_RASPBERRYPI_BSP_H)
+
+#include <bsp/raspberrypi.h>
+#include <bsp/irq.h>
+
+RTEMS_BSD_DRIVER_BCM2835_DMA((unsigned long)0x20007000, 16);
+
 #endif
 
 #endif
diff --git a/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h b/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
index 5a3458c..25688a0 100644
--- a/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
+++ b/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
@@ -172,6 +172,27 @@ extern "C" {
 #endif /* RTEMS_BSD_DRIVER_MMC */
 
 /*
+ * [BCM2835] Raspberry Pi DMA Controller
+ */
+#if !defined(RTEMS_BSD_DRIVER_BCM2835_DMA)
+  #define RTEMS_BSD_DRIVER_BCM2835_DMA(_base, _irq)                  \
+    static const rtems_bsd_device_resource rpi_dma_res[] = {     \
+      {                                                          \
+        .type = RTEMS_BSD_RES_MEMORY,                            \
+        .start_request = 0,                                      \
+        .start_actual = (_base)                                  \
+      }, {                                                       \
+        .type = RTEMS_BSD_RES_IRQ,                               \
+        .start_request = 0,                                      \
+        .start_actual = (_irq)                                   \
+      }                                                          \
+    };                                                           \
+    RTEMS_BSD_DEFINE_NEXUS_DEVICE(bcm_dma, 0,                     \
+                                  RTEMS_ARRAY_SIZE(rpi_dma_res), \
+                                  &rpi_dma_res[0])
+#endif /* RTEMS_BSD_DRIVER_BCM2835_DMA */
+
+/*
  * USB Drivers.
  */
 #if !defined(RTEMS_BSD_DRIVER_USB)
-- 
2.1.4




More information about the devel mailing list