From owner-freebsd-arm@freebsd.org Sun Dec 20 17:42:54 2015 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A5B5A4DA40 for ; Sun, 20 Dec 2015 17:42:54 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F4F81AA1 for ; Sun, 20 Dec 2015 17:42:54 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Sun, 20 Dec 2015 17:43:00 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id tBKHglkf032264; Sun, 20 Dec 2015 10:42:47 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1450633367.25138.145.camel@freebsd.org> Subject: Re: Set GPIO at boot on Raspberry Pi From: Ian Lepore To: Karl Denninger , freebsd-arm@freebsd.org Date: Sun, 20 Dec 2015 10:42:47 -0700 In-Reply-To: <5676E368.7080800@denninger.net> References: <5676DF0F.1060602@fsck.ch> <5676E368.7080800@denninger.net> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2015 17:42:54 -0000 On Sun, 2015-12-20 at 11:20 -0600, Karl Denninger wrote: > On 12/20/2015 11:02, Toby wrote: > > Hi all > > > > Is there a way to set GPIOs at boot? I'd like to set GPIO 28 to out > > and > > high before usb devices are probed, in order to be able to use my > > usb > > disk. If I have it plugged in during boot, I can't get it to work. > > It > > works though if I boot the pi, then plug in the disk and then set > > the > > pin to high. > > > > Thanks, > > Toby > I've had good luck setting the state FIRST, then the pin config to > desired (in this case, OUT.) > > I have this general problem with driving a relay board, in that the > jackwads that designed the board set it up to be active LOW, so if > you > set the config first you chatter the outputs, and FreeBSD's GPIO > config > rejects "active low" config as a setting. > > The pins should come up configured as inputs so the peripheral > shouldn't > be upset about that. > I'm not sure what you mean by "FreeBSD's GPIO config rejects active low" -- what config are you refering to? But I don't think pin state when changing config is quite what Toby was asking; he needs a way to configure driven pins very early in boot. Right now we have no way of preconfiguring gpio pins to be driven a certain way early in boot. By manipulating the device-tree data you can configure a pin as input or output, and usually you can configure pull up/down values for inputs, but there's no standard device-tree syntax to configure the drive value when configuring a pin to be driven. Maybe we could add some dev.gpioc tunables so that pins could be configured via loader.conf. -- Ian