RPi4B: emmc2bus dma-range handling does not track the boot-time-FDT (u-boot based booting)

Mark Millard marklmi at yahoo.com
Thu Oct 8 09:01:37 UTC 2020


sys/gnu/dts/arm/bcm2711.dtsi reports:

        /*
         * emmc2 has different DMA constraints based on SoC revisions. It was
         * moved into its own bus, so as for RPi4's firmware to update them.
         * The firmware will find whether the emmc2bus alias is defined, and if
         * so, it'll edit the dma-ranges property below accordingly.
         */
        emmc2bus: emmc2bus {
                compatible = "simple-bus";
                #address-cells = <2>;
                #size-cells = <1>;
                
                ranges = <0x0 0x7e000000  0x0 0xfe000000  0x01800000>;
                dma-ranges = <0x0 0xc0000000  0x0 0x00000000  0x40000000>;
                        
                emmc2: emmc2 at 7e340000 {
                        compatible = "brcm,bcm2711-emmc2";
                        reg = <0x0 0x7e340000 0x100>;
                        interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&clocks BCM2711_CLOCK_EMMC2>;
                        status = "disabled";
                };
        };


The old u-boot/DTB combination in use does not have emmc2bus.
And, even if it did, FreeBSD would not use the dma-ranges
content, expecting it to not vary within the RPi4B family.
Relative to "lowaddr", for example, there is:

#define       BCM2838_PERIPH_MAXADDR          0x3fffffff

(the emmc2bus dma-ranges' size_cell_value-1 for the text
above).

sys/arm/broadcom/bcm2835/bcm2835_sdhci.c does list brcm,bcm2711-emmc2 in
its compat_data:

static struct ofw_compat_data compat_data[] = {
        {"broadcom,bcm2835-sdhci",      (uintptr_t)&bcm2835_sdhci_conf},
        {"brcm,bcm2835-sdhci",          (uintptr_t)&bcm2835_sdhci_conf},
        {"brcm,bcm2835-mmc",            (uintptr_t)&bcm2835_sdhci_conf},
        {"brcm,bcm2711-emmc2",          (uintptr_t)&bcm2838_emmc2_conf},
        {"brcm,bcm2838-emmc2",          (uintptr_t)&bcm2838_emmc2_conf},
        {NULL,                          0}
};

where BCM2838_PERIPH_MAXADDR is picked out based on:
(from sys/arm/broadcom/bcm2835/bcm2835_vcbus.c)

static struct bcm283x_memory_soc_cfg {
        struct bcm283x_memory_mapping   *memmap;
        const char                      *soc_compat;
        bus_addr_t                       busdma_lowaddr;
} bcm283x_memory_configs[] = {
. . .
        {
                .memmap = bcm2838_memmap,
                .soc_compat = "brcm,bcm2711",
                .busdma_lowaddr = BCM2838_PERIPH_MAXADDR,
        },
        {
                .memmap = bcm2838_memmap,
                .soc_compat = "brcm,bcm2838",
                .busdma_lowaddr = BCM2838_PERIPH_MAXADDR,
        },
};

(I've not found tracking of SoC revisions. But I also do
not know what varies across which SoC revisions. So far
as I know, the few I have access to have a uniform
structure.)

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)



More information about the freebsd-arm mailing list