Date: Wed, 30 Apr 2014 08:38:01 -0700 From: Thomas Skibo <ThomasSkibo@sbcglobal.net> To: Ian Lepore <ian@FreeBSD.org> Cc: freebsd-arm <freebsd-arm@FreeBSD.org> Subject: Re: sdhci_fdt ignores clock-frequency property in .dtb Message-ID: <536118D9.30902@sbcglobal.net> In-Reply-To: <1398816332.22079.49.camel@revolution.hippie.lan> References: <53601B1D.2090702@sbcglobal.net> <1398816332.22079.49.camel@revolution.hippie.lan>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------010400020803080908070908 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit New patch. On 4/29/14, 5:05 PM, Ian Lepore wrote: > On Tue, 2014-04-29 at 14:35 -0700, Thomas Skibo wrote: >> Another Zynq bug-fix. One Zynq board out there needs to set this >> property or else the SD card gets clocked too fast. >> >> Thanks, >> > > The documented property for this is max-frequency rather than > clock-frequency. Is this a completely new property for us, or are you > just making the code honor what's in our existing dts files? Either way > we should use the documented name, I'm just wondering if we need to fix > dts files and give folks a heads-up about the change. > > -- Ian > > > -- -------- Thomas Skibo ThomasSkibo@sbcglobal.net --------------010400020803080908070908 Content-Type: text/plain; charset=UTF-8; name="patch.sdhci_fdt.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch.sdhci_fdt.txt" Index: sys/boot/fdt/dts/arm/zedboard.dts =================================================================== --- sys/boot/fdt/dts/arm/zedboard.dts (revision 265110) +++ sys/boot/fdt/dts/arm/zedboard.dts (working copy) @@ -183,7 +176,7 @@ reg = <0x100000 0x1000>; interrupts = <56>; interrupt-parent = <&GIC>; - clock-frequency = <50000000>; + max-frequency = <50000000>; }; // QSPI Index: sys/boot/fdt/dts/arm/exynos5250.dtsi =================================================================== --- sys/boot/fdt/dts/arm/exynos5250.dtsi (revision 265110) +++ sys/boot/fdt/dts/arm/exynos5250.dtsi (working copy) @@ -126,7 +126,7 @@ reg = <0x12200000 0x1000>; interrupts = <107>; interrupt-parent = <&GIC>; - clock-frequency = <24000000>; /* TODO: verify freq */ + max-frequency = <24000000>; /* TODO: verify freq */ }; sdhci@12210000 { @@ -134,7 +134,7 @@ reg = <0x12210000 0x1000>; interrupts = <108>; interrupt-parent = <&GIC>; - clock-frequency = <24000000>; + max-frequency = <24000000>; }; sdhci@12220000 { @@ -142,7 +142,7 @@ reg = <0x12220000 0x1000>; interrupts = <109>; interrupt-parent = <&GIC>; - clock-frequency = <24000000>; + max-frequency = <24000000>; }; sdhci@12230000 { @@ -150,7 +150,7 @@ reg = <0x12230000 0x1000>; interrupts = <110>; interrupt-parent = <&GIC>; - clock-frequency = <24000000>; + max-frequency = <24000000>; }; serial0: serial@12C00000 { Index: sys/dev/sdhci/sdhci_fdt.c =================================================================== --- sys/dev/sdhci/sdhci_fdt.c (revision 265110) +++ 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 max-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, "max-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; --------------010400020803080908070908--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?536118D9.30902>