2013-09-13 19:55:40 +00:00
|
|
|
.\" Copyright (c) 2013, Sean Bruno <sbruno@freebsd.org>
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2019-06-27 15:46:06 +00:00
|
|
|
.Dd June 27, 2019
|
2013-09-13 19:55:40 +00:00
|
|
|
.Dt GPIO 4
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm gpiobus
|
|
|
|
.Nd GPIO bus system
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
To compile these devices into your kernel and use the device hints, place the
|
|
|
|
following lines in your kernel configuration file:
|
|
|
|
.Bd -ragged -offset indent
|
|
|
|
.Cd "device gpio"
|
|
|
|
.Cd "device gpioc"
|
2013-11-12 12:44:59 +00:00
|
|
|
.Cd "device gpioiic"
|
2013-09-13 19:55:40 +00:00
|
|
|
.Cd "device gpioled"
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Additional device entries for the
|
|
|
|
.Li ARM
|
2014-02-19 21:31:04 +00:00
|
|
|
architecture include:
|
2013-09-13 19:55:40 +00:00
|
|
|
.Bd -ragged -offset indent
|
|
|
|
.Cd "device a10_gpio"
|
|
|
|
.Cd "device bcm_gpio"
|
|
|
|
.Cd "device imx51_gpio"
|
|
|
|
.Cd "device lpcgpio"
|
|
|
|
.Cd "device mv_gpio"
|
|
|
|
.Cd "device ti_gpio"
|
|
|
|
.Cd "device gpio_avila"
|
|
|
|
.Cd "device gpio_cambria"
|
|
|
|
.Cd "device zy7_gpio"
|
|
|
|
.Cd "device pxagpio"
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Additional device entries for the
|
|
|
|
.Li MIPS
|
2014-02-19 21:31:04 +00:00
|
|
|
architecture include:
|
2013-09-13 19:55:40 +00:00
|
|
|
.Bd -ragged -offset indent
|
|
|
|
.Cd "device ar71xxx_gpio"
|
|
|
|
.Cd "device octeon_gpio"
|
|
|
|
.Cd "device rt305_gpio"
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Additional device entries for the
|
|
|
|
.Li POWERPC
|
2014-02-19 21:31:04 +00:00
|
|
|
architecture include:
|
2013-09-13 19:55:40 +00:00
|
|
|
.Bd -ragged -offset indent
|
|
|
|
.Cd "device wiigpio"
|
|
|
|
.Cd "device macgpio"
|
|
|
|
.Ed
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
2014-02-19 21:31:04 +00:00
|
|
|
.Nm
|
2013-11-12 12:44:59 +00:00
|
|
|
system provides a simple interface to the GPIO pins that are usually
|
|
|
|
available on embedded architectures and can provide bit banging style
|
|
|
|
devices to the system.
|
2013-09-13 19:55:40 +00:00
|
|
|
.Pp
|
|
|
|
The acronym
|
|
|
|
.Li GPIO
|
|
|
|
means
|
|
|
|
.Dq General-Purpose Input/Output.
|
|
|
|
.Pp
|
|
|
|
The BUS physically consists of multiple pins that can be configured
|
|
|
|
for input/output, IRQ delivery, SDA/SCL
|
|
|
|
.Em iicbus
|
|
|
|
use, etc.
|
2013-11-12 12:44:59 +00:00
|
|
|
.Pp
|
2014-02-19 21:31:04 +00:00
|
|
|
On some embedded architectures (like MIPS), discovery of the bus and
|
2013-09-13 19:55:40 +00:00
|
|
|
configuration of the pins is done via
|
|
|
|
.Xr device.hints 5
|
|
|
|
in the platform's kernel
|
|
|
|
.Xr config 5
|
|
|
|
file.
|
|
|
|
.Pp
|
2013-11-12 12:44:59 +00:00
|
|
|
On some others (like ARM), where
|
|
|
|
.Xr FDT 4
|
|
|
|
is used to describe the device tree, the bus discovery is done via the DTS
|
|
|
|
passed to the kernel, being either statically compiled in, or by a variety
|
|
|
|
of ways where the boot loader (or Open Firmware enabled system) passes the
|
2014-02-19 21:31:04 +00:00
|
|
|
DTS blob to the kernel at boot.
|
2013-09-13 19:55:40 +00:00
|
|
|
.Pp
|
2019-06-26 07:38:31 +00:00
|
|
|
On a
|
|
|
|
.Xr device.hints 5
|
|
|
|
based system these hints can be used to configure drivers for devices
|
|
|
|
attached to
|
|
|
|
.Nm
|
|
|
|
pins:
|
2019-06-27 15:46:06 +00:00
|
|
|
.Bl -tag -width ".Va hint.driver.unit.pin_list"
|
2019-06-26 07:38:31 +00:00
|
|
|
.It Va hint.driver.unit.at
|
|
|
|
The
|
|
|
|
.Nm gpiobus
|
|
|
|
where the device is attached.
|
|
|
|
For example,
|
|
|
|
.Qq gpiobus0 .
|
|
|
|
.Ar driver
|
|
|
|
and
|
|
|
|
.Ar unit
|
|
|
|
are the driver name and the unit number for the device driver.
|
|
|
|
.It Va hint.driver.unit.pins
|
|
|
|
This is a bitmask of the pins on the
|
|
|
|
.Nm gpiobus
|
|
|
|
that are connected to the device.
|
|
|
|
The pins will be allocated to the specified driver instance.
|
2019-06-27 15:46:06 +00:00
|
|
|
Only pins with numbers from 0 to 31 can be specified using this hint.
|
|
|
|
.It Va hint.driver.unit.pin_list
|
|
|
|
This is a list of pin numbers of pins on the
|
|
|
|
.Nm gpiobus
|
|
|
|
that are connected to the device.
|
|
|
|
The pins will be allocated to the specified driver instance.
|
|
|
|
This is a more user friendly alternative to the
|
|
|
|
.Ar pins
|
|
|
|
hint.
|
|
|
|
Additionally, this hint allows specifying pin numbers greater than 31.
|
|
|
|
The numbers can be decimal or hexadecimal with 0x prefix.
|
|
|
|
Any non-digit character can be used as a separator.
|
|
|
|
For example, it can be a comma, a slash or a space.
|
|
|
|
The separator can be followed by any number of space characters.
|
2019-06-26 07:38:31 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
2014-02-19 21:31:04 +00:00
|
|
|
The following
|
|
|
|
.Xr device.hints 5
|
|
|
|
are only provided by the
|
2013-09-13 19:55:40 +00:00
|
|
|
.Cd ar71xx_gpio
|
2014-02-19 21:31:04 +00:00
|
|
|
driver:
|
2019-06-26 07:38:31 +00:00
|
|
|
.Bl -tag -width ".Va hint.gpio.function_clear"
|
2013-09-13 19:55:40 +00:00
|
|
|
.It Va hint.gpio.%d.pinmask
|
2014-02-19 21:31:04 +00:00
|
|
|
This is a bitmask of pins on the GPIO board that we would like to expose
|
|
|
|
for use to the host operating system.
|
2013-09-13 19:55:40 +00:00
|
|
|
To expose pin 0, 4 and 7, use the bitmask of
|
|
|
|
10010001 converted to the hexadecimal value 0x0091.
|
|
|
|
.It Va hint.gpio.%d.pinon
|
2014-02-19 21:31:04 +00:00
|
|
|
This is a bitmask of pins on the GPIO board that will be set to ON at host
|
2013-09-13 19:55:40 +00:00
|
|
|
start.
|
|
|
|
To set pin 2, 5 and 13 to be set ON at boot, use the bitmask of
|
2013-09-13 21:23:04 +00:00
|
|
|
10000000010010 converted to the hexadecimal value 0x2012.
|
2013-09-13 19:55:40 +00:00
|
|
|
.It Va hint.gpio.function_set
|
|
|
|
.It Va hint.gpio.function_clear
|
2014-02-19 21:31:04 +00:00
|
|
|
These are bitmasks of pins that will remap a pin to handle a specific
|
2013-09-13 19:55:40 +00:00
|
|
|
function (USB, UART TX/RX, etc) in the Atheros function registers.
|
2014-02-19 21:31:04 +00:00
|
|
|
This is mainly used to set/clear functions that we need when they are set up or
|
|
|
|
not set up by uBoot.
|
2013-09-13 19:55:40 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Simply put, each pin of the GPIO interface is connected to an input/output
|
|
|
|
of some device in a system.
|
|
|
|
.Sh SEE ALSO
|
2013-11-12 12:44:59 +00:00
|
|
|
.Xr gpioiic 4 ,
|
|
|
|
.Xr gpioled 4 ,
|
2013-09-13 19:55:40 +00:00
|
|
|
.Xr iicbus 4 ,
|
2019-06-26 07:38:31 +00:00
|
|
|
.Xr device.hints 5 ,
|
2013-09-13 19:55:40 +00:00
|
|
|
.Xr gpioctl 8
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
manual page first appeared in
|
|
|
|
.Fx 10.0 .
|
|
|
|
.Sh AUTHORS
|
|
|
|
This
|
|
|
|
manual page was written by
|
2014-06-26 21:46:14 +00:00
|
|
|
.An Sean Bruno Aq Mt sbruno@FreeBSD.org .
|