The Raspberry Pi 4 has an additional SD/MMC controller.  This
controller is almost completely standard and just needs one tiny
quirk.  So the diff is really simple.

By default, if you use the EDK2-base UEFI firmware this controller
isn't actually connected to anything.  So you'll see

  sdmmc0: can't enable card

in your dmesg.  If you change the "Raspberry Pi Configuration" ->
"SD/MMC Configuration" -> "uSD routing" setting in the "Device
Manager" firmware configuration screen to "eMMC2 SDHCI".  The uSD card
will show up behind this controller and WiFi will show up on the other
controller.  Note that after you've made that configuration change and
reset the machine, any further change you make won't stick.  You can
fix this by replacing the RPI_EFI.fd file on the MS-DOS partition of
your uSD card.

For now the SDHC controllers are only supported in device tree mode
which can be enabled using the "Raspberry Pi Configuration" ->
"Advanced Configuration" -> "Device Tree" option in the "Device
Manager".

Anyway, ok?


Index: dev/fdt/sdhc_fdt.c
===================================================================
RCS file: /cvs/src/sys/dev/fdt/sdhc_fdt.c,v
retrieving revision 1.6
diff -u -p -r1.6 sdhc_fdt.c
--- dev/fdt/sdhc_fdt.c  19 Apr 2020 16:17:03 -0000      1.6
+++ dev/fdt/sdhc_fdt.c  19 Apr 2020 19:28:28 -0000
@@ -68,6 +68,7 @@ sdhc_fdt_match(struct device *parent, vo
        struct fdt_attach_args *faa = aux;
 
        return (OF_is_compatible(faa->fa_node, "arasan,sdhci-5.1") ||
+           OF_is_compatible(faa->fa_node, "brcm,bcm2711-emmc2") ||
            OF_is_compatible(faa->fa_node, "brcm,bcm2835-sdhci"));
 }
 
@@ -157,6 +158,9 @@ sdhc_fdt_attach(struct device *parent, s
                /* XXX Doesn't work on Rockchip RK3399. */
                sc->sc.sc_flags |= SDHC_F_NODDR50;
        }
+
+       if (OF_is_compatible(faa->fa_node, "brcm,bcm2711-emmc2"))
+               sc->sc.sc_flags |= SDHC_F_NOPWR0;
 
        if (OF_is_compatible(faa->fa_node, "brcm,bcm2835-sdhci")) {
                cap = SDHC_VOLTAGE_SUPP_3_3V | SDHC_HIGH_SPEED_SUPP;

Reply via email to