--- freebsd/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c | 21 +++++++++++++++++++++ freebsd/sys/dev/mmc/mmc.c | 2 +- freebsd/sys/dev/sdhci/sdhci.c | 6 ++++++ freebsd/sys/dev/sdhci/sdhci.h | 2 +- rtemsbsd/include/bsp/nexus-devices.h | 20 +++++++++++++++++++- 5 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/freebsd/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c b/freebsd/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c index 4844f19..9ba83f3 100644 --- a/freebsd/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c +++ b/freebsd/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c @@ -43,9 +43,11 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> +#ifndef __rtems__ #include <dev/fdt/fdt_common.h> #include <dev/ofw/ofw_bus.h> #include <dev/ofw/ofw_bus_subr.h> +#endif /* __rtems__ */ #include <dev/mmc/bridge.h> #include <dev/mmc/mmcreg.h> @@ -55,9 +57,15 @@ __FBSDID("$FreeBSD$"); #include <rtems/bsd/local/sdhci_if.h> #include "bcm2835_dma.h" +#ifndef __rtems__ #include <arm/broadcom/bcm2835/bcm2835_mbox_prop.h> +#endif /* __rtems__ */ #include "bcm2835_vcbus.h" +#ifdef __rtems__ +#define BUS_SPACE_PHYSADDR(res, offs) ((u_int)(rman_get_start(res)+(offs))) +#endif /* __rtems__ */ + #define BCM2835_DEFAULT_SDHCI_FREQ 50 #define BCM_SDHCI_BUFFER_SIZE 512 @@ -125,11 +133,13 @@ static int bcm_sdhci_probe(device_t dev) { +#ifndef __rtems__ if (!ofw_bus_status_okay(dev)) return (ENXIO); if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-sdhci")) return (ENXIO); +#endif /* __rtems__ */ device_set_desc(dev, "Broadcom 2708 SDHCI controller"); return (BUS_PROBE_DEFAULT); @@ -140,13 +150,16 @@ bcm_sdhci_attach(device_t dev) { struct bcm_sdhci_softc *sc = device_get_softc(dev); int rid, err; +#ifndef __rtems__ phandle_t node; pcell_t cell; +#endif /* __rtems__ */ u_int default_freq; sc->sc_dev = dev; sc->sc_req = NULL; +#ifndef __rtems__ err = bcm2835_mbox_set_power_state(BCM2835_MBOX_POWER_ID_EMMC, TRUE); if (err != 0) { @@ -168,6 +181,7 @@ bcm_sdhci_attach(device_t dev) sizeof(cell))) > 0) default_freq = cell / 1000000; } +#endif /* __rtems__ */ if (default_freq == 0) default_freq = BCM2835_DEFAULT_SDHCI_FREQ; @@ -216,6 +230,7 @@ bcm_sdhci_attach(device_t dev) sdhci_init_slot(dev, &sc->sc_slot, 0); +#ifndef __rtems__ sc->sc_dma_ch = bcm_dma_allocate(BCM_DMA_CH_ANY); if (sc->sc_dma_ch == BCM_DMA_CH_INVALID) goto fail; @@ -243,6 +258,7 @@ bcm_sdhci_attach(device_t dev) sc->sc_sdhci_buffer_phys = BUS_SPACE_PHYSADDR(sc->sc_mem_res, SDHCI_BUFFER); +#endif /* __rtems__ */ bus_generic_probe(dev); bus_generic_attach(dev); @@ -671,7 +687,12 @@ static driver_t bcm_sdhci_driver = { sizeof(struct bcm_sdhci_softc), }; +#ifndef __rtems__ DRIVER_MODULE(sdhci_bcm, simplebus, bcm_sdhci_driver, bcm_sdhci_devclass, 0, 0); MODULE_DEPEND(sdhci_bcm, sdhci, 1, 1, 1); DRIVER_MODULE(mmc, sdhci_bcm, mmc_driver, mmc_devclass, NULL, NULL); MODULE_DEPEND(sdhci_bcm, mmc, 1, 1, 1); +#else /* __rtems__ */ +DRIVER_MODULE(sdhci_bcm, nexus, bcm_sdhci_driver, bcm_sdhci_devclass, 0, 0); +MODULE_DEPEND(sdhci_bcm, sdhci, 1, 1, 1); +#endif /* __rtems__ */ \ No newline at end of file diff --git a/freebsd/sys/dev/mmc/mmc.c b/freebsd/sys/dev/mmc/mmc.c index 7a94dc4..ac3f1e0 100644 --- a/freebsd/sys/dev/mmc/mmc.c +++ b/freebsd/sys/dev/mmc/mmc.c @@ -1734,4 +1734,4 @@ static devclass_t mmc_devclass; DRIVER_MODULE(mmc, at91_mci, mmc_driver, mmc_devclass, NULL, NULL); DRIVER_MODULE(mmc, dw_mmc, mmc_driver, mmc_devclass, NULL, NULL); -DRIVER_MODULE(mmc, sdhci, mmc_driver, mmc_devclass, NULL, NULL); +DRIVER_MODULE(mmc, sdhci_bcm, mmc_driver, mmc_devclass, NULL, NULL); diff --git a/freebsd/sys/dev/sdhci/sdhci.c b/freebsd/sys/dev/sdhci/sdhci.c index 924f06d..91bcc83 100644 --- a/freebsd/sys/dev/sdhci/sdhci.c +++ b/freebsd/sys/dev/sdhci/sdhci.c @@ -682,7 +682,11 @@ int sdhci_init_slot( slot->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; } +#ifndef __rtems__ slot->host.f_min = SDHCI_MIN_FREQ( slot->bus, slot ); +#elif defined(LIBBSP_ARM_RASPBERRYPI_BSP_H) + slot->host.f_min = 400000; +#endif slot->host.f_max = slot->max_clk; slot->host.host_ocr = 0; @@ -739,10 +743,12 @@ int sdhci_init_slot( } slot->timeout = 10; +#ifndef __rtems__ SYSCTL_ADD_INT( device_get_sysctl_ctx( slot->bus ), SYSCTL_CHILDREN( device_get_sysctl_tree( slot->bus ) ), OID_AUTO, "timeout", CTLFLAG_RW, &slot->timeout, 0, "Maximum timeout for SDHCI transfers (in secs)" ); +#endif /* __rtems__ */ TASK_INIT( &slot->card_task, 0, sdhci_card_task, slot ); callout_init( &slot->card_callout, 1 ); callout_init_mtx( &slot->timeout_callout, &slot->mtx, 0 ); diff --git a/freebsd/sys/dev/sdhci/sdhci.h b/freebsd/sys/dev/sdhci/sdhci.h index 91b8b76..d54c093 100644 --- a/freebsd/sys/dev/sdhci/sdhci.h +++ b/freebsd/sys/dev/sdhci/sdhci.h @@ -276,7 +276,7 @@ struct sdhci_slot { device_t dev; /* Slot device */ u_char num; /* Slot number */ u_char opt; /* Slot options */ -#define SDHCI_HAVE_DMA 1 +#define SDHCI_HAVE_DMA 0 #define SDHCI_PLATFORM_TRANSFER 2 u_char version; int timeout; /* Transfer timeout */ diff --git a/rtemsbsd/include/bsp/nexus-devices.h b/rtemsbsd/include/bsp/nexus-devices.h index decd042..d2a2852 100644 --- a/rtemsbsd/include/bsp/nexus-devices.h +++ b/rtemsbsd/include/bsp/nexus-devices.h @@ -183,6 +183,24 @@ RTEMS_BSD_DEFINE_NEXUS_DEVICE(tsec, 0, RTEMS_ARRAY_SIZE(tsec0_res), #include <bsp/raspberrypi.h> #include <bsp/irq.h> +static const rtems_bsd_device_resource rpi_emmc_res[] = { + { + .type = RTEMS_BSD_RES_MEMORY, + .start_request = 0, + .start_actual = BCM2835_EMMC_BASE + }, { + .type = RTEMS_BSD_RES_IRQ, + .start_request = 0, + .start_actual = 62 + } +}; + +RTEMS_BSD_DEFINE_NEXUS_DEVICE(sdhci_bcm, 0, RTEMS_ARRAY_SIZE(rpi_emmc_res), + &rpi_emmc_res[0]); + +SYSINIT_DRIVER_REFERENCE(mmc, sdhci_bcm); +SYSINIT_DRIVER_REFERENCE(mmcsd, mmc); + static const rtems_bsd_device_resource rpi_dma_res[] = { { .type = RTEMS_BSD_RES_MEMORY, @@ -196,6 +214,6 @@ static const rtems_bsd_device_resource rpi_dma_res[] = { }; RTEMS_BSD_DEFINE_NEXUS_DEVICE(bcm_dma, 0, RTEMS_ARRAY_SIZE(rpi_dma_res), -&rpi_dma_res[0]); + &rpi_dma_res[0]); #endif -- 1.9.1 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel