1dbcb0e96SSean Bruno.\" Copyright (c) 2013, Sean Bruno <sbruno@freebsd.org> 2dbcb0e96SSean Bruno.\" All rights reserved. 3dbcb0e96SSean Bruno.\" 4dbcb0e96SSean Bruno.\" Redistribution and use in source and binary forms, with or without 5dbcb0e96SSean Bruno.\" modification, are permitted provided that the following conditions 6dbcb0e96SSean Bruno.\" are met: 7dbcb0e96SSean Bruno.\" 1. Redistributions of source code must retain the above copyright 8dbcb0e96SSean Bruno.\" notice, this list of conditions and the following disclaimer. 9dbcb0e96SSean Bruno.\" 2. Redistributions in binary form must reproduce the above copyright 10dbcb0e96SSean Bruno.\" notice, this list of conditions and the following disclaimer in the 11dbcb0e96SSean Bruno.\" documentation and/or other materials provided with the distribution. 12dbcb0e96SSean Bruno.\" 13dbcb0e96SSean Bruno.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14dbcb0e96SSean Bruno.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15dbcb0e96SSean Bruno.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16dbcb0e96SSean Bruno.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17dbcb0e96SSean Bruno.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18dbcb0e96SSean Bruno.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19dbcb0e96SSean Bruno.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20dbcb0e96SSean Bruno.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21dbcb0e96SSean Bruno.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22dbcb0e96SSean Bruno.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23dbcb0e96SSean Bruno.\" SUCH DAMAGE. 24dbcb0e96SSean Bruno.\" 25dbcb0e96SSean Bruno.\" $FreeBSD$ 26dbcb0e96SSean Bruno.\" 27dbcb0e96SSean Bruno.Dd September 13, 2013 28dbcb0e96SSean Bruno.Dt GPIO 4 29dbcb0e96SSean Bruno.Os 30dbcb0e96SSean Bruno.Sh NAME 31dbcb0e96SSean Bruno.Nm gpiobus 32dbcb0e96SSean Bruno.Nd GPIO bus system 33dbcb0e96SSean Bruno.Sh SYNOPSIS 34dbcb0e96SSean BrunoTo compile these devices into your kernel and use the device hints, place the 35dbcb0e96SSean Brunofollowing lines in your kernel configuration file: 36dbcb0e96SSean Bruno.Bd -ragged -offset indent 37dbcb0e96SSean Bruno.Cd "device gpiobus" 38dbcb0e96SSean Bruno.Cd "device gpioiic" 39dbcb0e96SSean Bruno.Cd "device gpio" 40dbcb0e96SSean Bruno.Cd "device gpioc" 41dbcb0e96SSean Bruno.Cd "device gpioled" 42dbcb0e96SSean Bruno.Ed 43dbcb0e96SSean Bruno.Pp 44dbcb0e96SSean BrunoAdditional device entries for the 45dbcb0e96SSean Bruno.Li ARM 46dbcb0e96SSean Brunoarchitecure include: 47dbcb0e96SSean Bruno.Bd -ragged -offset indent 48dbcb0e96SSean Bruno.Cd "device a10_gpio" 49dbcb0e96SSean Bruno.Cd "device bcm_gpio" 50dbcb0e96SSean Bruno.Cd "device imx51_gpio" 51dbcb0e96SSean Bruno.Cd "device lpcgpio" 52dbcb0e96SSean Bruno.Cd "device mv_gpio" 53dbcb0e96SSean Bruno.Cd "device ti_gpio" 54dbcb0e96SSean Bruno.Cd "device gpio_avila" 55dbcb0e96SSean Bruno.Cd "device gpio_cambria" 56dbcb0e96SSean Bruno.Cd "device zy7_gpio" 57dbcb0e96SSean Bruno.Cd "device pxagpio" 58dbcb0e96SSean Bruno.Ed 59dbcb0e96SSean Bruno.Pp 60dbcb0e96SSean BrunoAdditional device entries for the 61dbcb0e96SSean Bruno.Li MIPS 62dbcb0e96SSean Brunoarchitecure include: 63dbcb0e96SSean Bruno.Bd -ragged -offset indent 64dbcb0e96SSean Bruno.Cd "device ar71xxx_gpio" 65dbcb0e96SSean Bruno.Cd "device octeon_gpio" 66dbcb0e96SSean Bruno.Cd "device rt305_gpio" 67dbcb0e96SSean Bruno.Ed 68dbcb0e96SSean Bruno.Pp 69dbcb0e96SSean BrunoAdditional device entries for the 70dbcb0e96SSean Bruno.Li POWERPC 71dbcb0e96SSean Brunoarchitecure include: 72dbcb0e96SSean Bruno.Bd -ragged -offset indent 73dbcb0e96SSean Bruno.Cd "device wiigpio" 74dbcb0e96SSean Bruno.Cd "device macgpio" 75dbcb0e96SSean Bruno.Ed 76dbcb0e96SSean Bruno.Sh DESCRIPTION 77dbcb0e96SSean BrunoThe 78dbcb0e96SSean Bruno.Em gpiobus 79dbcb0e96SSean Brunosystem provides a simple interface to the bit banging style GPIO bus 80dbcb0e96SSean Brunofound on embedded architectures. 81dbcb0e96SSean Bruno.Pp 82dbcb0e96SSean BrunoThe acronym 83dbcb0e96SSean Bruno.Li GPIO 84dbcb0e96SSean Brunomeans 85dbcb0e96SSean Bruno.Dq General-Purpose Input/Output. 86dbcb0e96SSean Bruno.Pp 87dbcb0e96SSean BrunoThe BUS physically consists of multiple pins that can be configured 88dbcb0e96SSean Brunofor input/output, IRQ delivery, SDA/SCL 89dbcb0e96SSean Bruno.Em iicbus 90dbcb0e96SSean Brunouse, etc. 91dbcb0e96SSean BrunoOn most embedded architechtures (mips/arm), discovery of the bus and 92dbcb0e96SSean Brunoconfiguration of the pins is done via 93dbcb0e96SSean Bruno.Xr device.hints 5 94dbcb0e96SSean Brunoin the platform's kernel 95dbcb0e96SSean Bruno.Xr config 5 96dbcb0e96SSean Brunofile. 97dbcb0e96SSean Bruno.Pp 98dbcb0e96SSean BrunoAssignment of 99dbcb0e96SSean Bruno.Xr gpioiic 4 100dbcb0e96SSean Brunobus variables is done via: 101dbcb0e96SSean Bruno.Bl -tag -width ".Va hint.gpioiic.%d.atXXX" 102dbcb0e96SSean Bruno.It Va hint.gpioiic.%d.at 103dbcb0e96SSean BrunoNormally just gpiobus0. 104dbcb0e96SSean Bruno.It Va hint.gpioiic.%d.pins 105dbcb0e96SSean BrunoThis is a bitmask of the pins on the gpio board that are to be used for 106dbcb0e96SSean BrunoSCLOCK and SDATA from the IIC bus. 107dbcb0e96SSean BrunoTo configure pin 0 and 7, use the bitmask of 108dbcb0e96SSean Bruno10000001 and convert it to a hexadecimal value of 0x0081. 109dbcb0e96SSean BrunoShould only ever have two bits set in mask. 110dbcb0e96SSean Bruno.It Va hint.gpioiic.%d.scl 111dbcb0e96SSean BrunoIndicates which bit in the 112dbcb0e96SSean Bruno.Va hint.gpioiic.%d.pins 113dbcb0e96SSean Brunoshould be used as the SCLOCK 114dbcb0e96SSean Brunosource. 115dbcb0e96SSean Bruno.It Va hint.gpioiic.%d.sda 116dbcb0e96SSean BrunoIndicates which bit in the 117dbcb0e96SSean Bruno.Va hint.gpioiic.%d.pins 118dbcb0e96SSean Brunoshould be used as the SDATA 119dbcb0e96SSean Brunosource. 120dbcb0e96SSean Bruno.El 121dbcb0e96SSean Bruno.Pp 122dbcb0e96SSean BrunoThe following are only provided by the 123dbcb0e96SSean Bruno.Cd ar71xx_gpio 124dbcb0e96SSean Brunodriver. 125dbcb0e96SSean Bruno.Bl -tag -width ".Va hint.gpioiic.%d.atXXX" 126dbcb0e96SSean Bruno.It Va hint.gpio.%d.pinmask 127dbcb0e96SSean BrunoThis is a bitmask of pins on the gpio board that we would like to expose 128dbcb0e96SSean Brunofor use to the host o/s. 129dbcb0e96SSean BrunoTo expose pin 0, 4 and 7, use the bitmask of 130dbcb0e96SSean Bruno10010001 converted to the hexadecimal value 0x0091. 131dbcb0e96SSean Bruno.It Va hint.gpio.%d.pinon 132dbcb0e96SSean BrunoThis is a bitmask of pins on the gpio board that will be set to ON at host 133dbcb0e96SSean Brunostart. 134dbcb0e96SSean BrunoTo set pin 2, 5 and 13 to be set ON at boot, use the bitmask of 135*ff8b9505SSean Bruno10000000010010 converted to the hexadecimal value 0x2012. 136dbcb0e96SSean Bruno.It Va hint.gpio.function_set 137dbcb0e96SSean Bruno.It Va hint.gpio.function_clear 138dbcb0e96SSean BrunoThese are a bitmask of pins that will remap a pin to handle a specific 139dbcb0e96SSean Brunofunction (USB, UART TX/RX, etc) in the Atheros function registers. 140dbcb0e96SSean BrunoThis is mainly used to set/clear functions that we need when they are setup or 141dbcb0e96SSean Brunonot setup by uBoot. 142dbcb0e96SSean Bruno.El 143dbcb0e96SSean Bruno.Pp 144dbcb0e96SSean BrunoThese values are configureable from the 145dbcb0e96SSean Bruno.Xr gpioled 4 146dbcb0e96SSean Brunointerface and help create 147dbcb0e96SSean Bruno.Xr led 4 148dbcb0e96SSean Brunocompatible devices in 149dbcb0e96SSean Bruno.Pa /dev/led/<name> . 150dbcb0e96SSean Bruno.Bl -tag -width ".Va hint.gpioiic.%d.atXXX" 151dbcb0e96SSean Bruno.It Va hint.gpioled.%d.at 152dbcb0e96SSean BrunoNormally assigned to gpiobus0. 153dbcb0e96SSean Bruno.It Va hint.gpioled.%d.name 154dbcb0e96SSean BrunoArbitrary name of device in 155dbcb0e96SSean Bruno.Pa /dev/led/ 156dbcb0e96SSean Brunoto create for 157dbcb0e96SSean Bruno.Xr led 4 158dbcb0e96SSean Brunointerfaces. 159dbcb0e96SSean Bruno.It Va hint.gpioled.%d.pins 160dbcb0e96SSean BrunoWhich pin on the GPIO interface to map to this instance. 161dbcb0e96SSean Bruno.El 162dbcb0e96SSean Bruno.Pp 163dbcb0e96SSean BrunoSimply put, each pin of the GPIO interface is connected to an input/output 164dbcb0e96SSean Brunoof some device in a system. 165dbcb0e96SSean Bruno.Sh SEE ALSO 166dbcb0e96SSean Bruno.Xr iicbus 4 , 167dbcb0e96SSean Bruno.Xr gpioctl 8 168dbcb0e96SSean Bruno.Sh HISTORY 169dbcb0e96SSean BrunoThe 170dbcb0e96SSean Bruno.Nm 171dbcb0e96SSean Brunomanual page first appeared in 172dbcb0e96SSean Bruno.Fx 10.0 . 173dbcb0e96SSean Bruno.Sh AUTHORS 174dbcb0e96SSean BrunoThis 175dbcb0e96SSean Brunomanual page was written by 176dbcb0e96SSean Bruno.An Sean Bruno Aq sbruno@FreeBSD.org . 177