Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Oct 2020 02:01:29 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        freebsd-arm <freebsd-arm@freebsd.org>
Subject:   RPi4B: emmc2bus dma-range handling does not track the boot-time-FDT (u-boot based booting)
Message-ID:  <D8BDF95A-D6A8-4E95-A0CE-D53068E8355B@yahoo.com>
References:  <D8BDF95A-D6A8-4E95-A0CE-D53068E8355B.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 =3D "simple-bus";
                #address-cells =3D <2>;
                #size-cells =3D <1>;
               =20
                ranges =3D <0x0 0x7e000000  0x0 0xfe000000  0x01800000>;
                dma-ranges =3D <0x0 0xc0000000  0x0 0x00000000  =
0x40000000>;
                       =20
                emmc2: emmc2@7e340000 {
                        compatible =3D "brcm,bcm2711-emmc2";
                        reg =3D <0x0 0x7e340000 0x100>;
                        interrupts =3D <GIC_SPI 126 =
IRQ_TYPE_LEVEL_HIGH>;
                        clocks =3D <&clocks BCM2711_CLOCK_EMMC2>;
                        status =3D "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[] =3D {
        {"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[] =3D {
. . .
        {
                .memmap =3D bcm2838_memmap,
                .soc_compat =3D "brcm,bcm2711",
                .busdma_lowaddr =3D BCM2838_PERIPH_MAXADDR,
        },
        {
                .memmap =3D bcm2838_memmap,
                .soc_compat =3D "brcm,bcm2838",
                .busdma_lowaddr =3D 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.)

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D8BDF95A-D6A8-4E95-A0CE-D53068E8355B>