Make sdhc(4) attachment work on Zynq-7000.
authorvisa <visa@openbsd.org>
Mon, 3 May 2021 13:11:40 +0000 (13:11 +0000)
committervisa <visa@openbsd.org>
Mon, 3 May 2021 13:11:40 +0000 (13:11 +0000)
OK kettenis@

sys/dev/fdt/sdhc_fdt.c

index f085c03..9633d66 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: sdhc_fdt.c,v 1.15 2021/04/05 09:31:45 patrick Exp $   */
+/*     $OpenBSD: sdhc_fdt.c,v 1.16 2021/05/03 13:11:40 visa Exp $      */
 /*
  * Copyright (c) 2017 Mark Kettenis
  *
@@ -126,6 +126,7 @@ sdhc_fdt_match(struct device *parent, void *match, void *aux)
        struct fdt_attach_args *faa = aux;
 
        return (OF_is_compatible(faa->fa_node, "arasan,sdhci-5.1") ||
+           OF_is_compatible(faa->fa_node, "arasan,sdhci-8.9a") ||
            OF_is_compatible(faa->fa_node, "brcm,bcm2711-emmc2") ||
            OF_is_compatible(faa->fa_node, "brcm,bcm2835-sdhci") ||
            OF_is_compatible(faa->fa_node, "marvell,armada-3700-sdhci") ||
@@ -232,6 +233,11 @@ sdhc_fdt_attach(struct device *parent, struct device *self, void *aux)
                sc->sc.sc_flags |= SDHC_F_NODDR50;
        }
 
+       if (OF_is_compatible(faa->fa_node, "arasan,sdhci-8.9a")) {
+               freq = clock_get_frequency(faa->fa_node, "clk_xin");
+               sc->sc.sc_clkbase = freq / 1000;
+       }
+
        if (OF_is_compatible(faa->fa_node, "brcm,bcm2711-emmc2"))
                sc->sc.sc_flags |= SDHC_F_NOPWR0;