From owner-freebsd-arm@FreeBSD.ORG Wed Apr 30 15:44:56 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 99A7B886 for ; Wed, 30 Apr 2014 15:44:56 +0000 (UTC) Received: from nm21-vm6.access.bullet.mail.bf1.yahoo.com (nm21-vm6.access.bullet.mail.bf1.yahoo.com [216.109.115.133]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C50F1176 for ; Wed, 30 Apr 2014 15:44:56 +0000 (UTC) Received: from [66.196.81.164] by nm21.access.bullet.mail.bf1.yahoo.com with NNFMP; 30 Apr 2014 15:38:04 -0000 Received: from [98.139.244.53] by tm10.access.bullet.mail.bf1.yahoo.com with NNFMP; 30 Apr 2014 15:38:04 -0000 Received: from [127.0.0.1] by smtp115.sbc.mail.bf1.yahoo.com with NNFMP; 30 Apr 2014 15:38:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sbcglobal.net; s=s1024; t=1398872284; bh=xdD3oPybVDO7pkwBdvvS9MgUvXY+Y5Rh4Vv8jStZzys=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type; b=aPuGgUsoeBLmP3ycJRUCudzhavbsNoFbf5CisYnPRTonGTyg8azicN0RPgHed4FdcgsHWRCEyJsjJHyjPJh2TwnslWLabAhRCfDcULb+eqFDF04wcn6rLAGPetCwDRaL0bMZpglrAaNQ4V2i1x6Yx9RaCzbaliZdSIsw7BK/0Cs= X-Yahoo-Newman-Id: 201002.9838.bm@smtp115.sbc.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 33ZRKXQVM1kUx9qcsfneUrE_ORnrbFKvQhnmN5kYVX0JmTD EuCGSQYOWyopwXr27x8I8_cTYzA91RKFpm_T4eHHh9YA2HW7RF2V4npw5Fnb BYoO_1jemrH6SPIbuVlGqUbwx6ikLLhwDwP8G763vu8RI0NNCYNT_XkmXp2B x3Vq7weiHsqvaguMt1dKfgRbSkTJbcEv.0aM4Oniy97k4K6d52A7o8MdlyXq K7_8o3hNhRvapuU4WF7N_0FnODffQtoYAODvOG8BpZrcjoKi7jlo.G_TFkRl Vlvw8NJYR2MKGQ5aef68sRwmZJFtCtJcNId6HMw9NGeQoXwQ7f76SoN8ijUd gAiNFdFpZo1Hj8decFPpHKYgo2LrnvHtlhudP9EZkkWaaAu390hBNLgjBny4 kDwp39IqIPdc1rjEsFKNizlWKKI6Y.gevfC9wP.Umrj4bJpLg2Sg4.Xou8hA vgvTOERkj5pRMwo9bWkE8eSPx6pASMJSHv1n4z08pX2xfrNWjOE.qfNOi9IK 9GmtgJJMXyPuz9DJ65RcpllnFTP6cYNfqTo87TRtZyc7pVFV7hg-- X-Yahoo-SMTP: tUxoRneswBA21azLM.3ybMESf0mC2bFhTbmt0VU5ervH0kqi5lo- X-Rocket-Received: from [192.168.1.9] (ThomasSkibo@71.139.160.145 with plain [98.139.221.42]) by smtp115.sbc.mail.bf1.yahoo.com with SMTP; 30 Apr 2014 08:38:04 -0700 PDT Message-ID: <536118D9.30902@sbcglobal.net> Date: Wed, 30 Apr 2014 08:38:01 -0700 From: Thomas Skibo User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Ian Lepore Subject: Re: sdhci_fdt ignores clock-frequency property in .dtb References: <53601B1D.2090702@sbcglobal.net> <1398816332.22079.49.camel@revolution.hippie.lan> In-Reply-To: <1398816332.22079.49.camel@revolution.hippie.lan> Content-Type: multipart/mixed; boundary="------------010400020803080908070908" Cc: freebsd-arm X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Apr 2014 15:44:56 -0000 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--