Date: Tue, 29 Apr 2014 14:35:25 -0700 From: Thomas Skibo <ThomasSkibo@sbcglobal.net> To: freebsd-arm <freebsd-arm@freebsd.org> Subject: sdhci_fdt ignores clock-frequency property in .dtb Message-ID: <53601B1D.2090702@sbcglobal.net>
index | next in thread | raw e-mail
[-- Attachment #1 --] Another Zynq bug-fix. One Zynq board out there needs to set this property or else the SD card gets clocked too fast. Thanks, -- -------- Thomas Skibo ThomasSkibo@sbcglobal.net [-- Attachment #2 --] Index: sys/dev/sdhci/sdhci_fdt.c =================================================================== --- sys/dev/sdhci/sdhci_fdt.c (revision 264766) +++ sys/dev/sdhci/sdhci_fdt.c (working copy) @@ -66,6 +66,7 @@ device_t dev; /* Controller device */ u_int quirks; /* Chip specific quirks */ u_int caps; /* If we override SDHCI_CAPABILITIES */ + uint32_t max_clk; /* Max possible freq */ struct resource *irq_res; /* IRQ resource */ void *intrhand; /* Interrupt handle */ @@ -156,6 +157,7 @@ sc->quirks = 0; sc->num_slots = 1; + sc->max_clk = 0; if (!ofw_bus_status_okay(dev)) return (ENXIO); @@ -170,11 +172,14 @@ node = ofw_bus_get_node(dev); - /* Allow dts to patch quirks and slots. */ - if ((OF_getprop(node, "quirks", &cid, sizeof(cid))) > 0) - sc->quirks = fdt32_to_cpu(cid); - if ((OF_getprop(node, "num-slots", &cid, sizeof(cid))) > 0) - sc->num_slots = fdt32_to_cpu(cid); + /* Allow dts to patch quirks, slots, and clock frequency. */ + if ((OF_getencprop(node, "quirks", &cid, sizeof(cid))) > 0) + sc->quirks = cid; + if ((OF_getencprop(node, "num-slots", &cid, sizeof(cid))) > 0) + sc->num_slots = cid; + if ((OF_getencprop(node, "clock-frequency", &cid, sizeof(cid))) > 0) + sc->max_clk = cid; + return (0); } @@ -214,6 +219,7 @@ slot->quirks = sc->quirks; slot->caps = sc->caps; + slot->max_clk = sc->max_clk; if (sdhci_init_slot(dev, slot, i) != 0) continue;home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53601B1D.2090702>
