From owner-freebsd-hackers@FreeBSD.ORG Thu May 21 14:25:47 2015 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D36231CA for ; Thu, 21 May 2015 14:25:47 +0000 (UTC) Received: from pmta2.delivery4.ore.mailhop.org (pmta2.delivery4.ore.mailhop.org [54.200.247.200]) by mx1.freebsd.org (Postfix) with SMTP id B0952142F for ; Thu, 21 May 2015 14:25:47 +0000 (UTC) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Thu, 21 May 2015 14:25:34 +0000 (UTC) Received: from revolution.hippie.lan (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id t4LEPdYq001317; Thu, 21 May 2015 08:25:40 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1432218339.1208.1.camel@freebsd.org> Subject: Re: OF_getprop weirdness - raspberry pi From: Ian Lepore To: Daniel Braniss Cc: hackers@freebsd.org, current@freebsd.org Date: Thu, 21 May 2015 08:25:39 -0600 In-Reply-To: References: Content-Type: text/plain; charset="windows-1251" X-Mailer: Evolution 3.12.10 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 May 2015 14:25:47 -0000 On Thu, 2015-05-21 at 09:41 +0300, Daniel Braniss wrote: > Hi, > I’m running current as of last week on a raspberry pi B. > > i don’t know if this only related to arm, but this is what I have in my rpi-b.dts: > …. > spi0 { > rfid0 { > compatible = "rfid,mfrc5"; > spi-chipselect = <0>; > reset { > compatible = "pcd-reset"; > gpios = <&gpio 6 2>; > }; > lock { > compatible = "lock-1"; > gpios = <&gpio 13 2>; > }; > sense { > compatible = "sense-1"; > gpios = <&gpio 19 1>; > }; > }; > … > and a call to > uint32_t data[3]; > > OF_getprop(node, “gpios”, data, sizeof(data)); // node is ‘pcd-reset' > returns: > data[0]: 0x03000000 > data[1]: 0x06000000 > data[2]: 0x02000000 > > which looks to me that it’s in the wrong endian? > > cheers, > danny FDT data is always big-endian, use OF_getencprop() to unpack it to host format. -- Ian