Date: Sun, 20 Dec 2015 10:42:47 -0700 From: Ian Lepore <ian@freebsd.org> To: Karl Denninger <karl@denninger.net>, freebsd-arm@freebsd.org Subject: Re: Set GPIO at boot on Raspberry Pi Message-ID: <1450633367.25138.145.camel@freebsd.org> In-Reply-To: <5676E368.7080800@denninger.net> References: <5676DF0F.1060602@fsck.ch> <5676E368.7080800@denninger.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1450633367.25138.145.camel>