1.\" $NetBSD: gpioiic.4,v 1.2 2009/08/09 08:44:30 wiz Exp $ 2.\" $OpenBSD: gpioiic.4,v 1.6 2008/11/24 15:30:21 jmc Exp $ 3.\" 4.\" Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org> 5.\" 6.\" Permission to use, copy, modify, and distribute this software for any 7.\" purpose with or without fee is hereby granted, provided that the above 8.\" copyright notice and this permission notice appear in all copies. 9.\" 10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" 18.Dd August 8, 2009 19.Dt GPIOIIC 4 20.Os 21.Sh NAME 22.Nm gpioiic 23.Nd GPIO I2C controller 24.Sh SYNOPSIS 25.Cd "gpioiic* at gpio? offset 0 mask 0x3" 26.Cd "gpioiic* at gpio?" 27.Cd "iic* at gpioiic?" 28.Sh DESCRIPTION 29The 30.Nm 31driver allows bit-banging an I2C bus as a master using two GPIO pins. 32The first pin is used as a serial data (SDA) signal and the second as 33a serial clock (SCL). 34Both GPIO pins must be able to drive an output and the SDA pin must be 35also able to read an input. 36.Pp 37The pins can be specified in the kernel configuration with the 38.Ar offset 39and the 40.Ar mask 41locators. 42The 43.Ar offset 44and 45.Ar mask 46can also be specified when 47.Nm 48is attached at runtime using the 49.Dv GPIOATTACH 50.Xr ioctl 2 51on the 52.Xr gpio 4 53device. 54Each bit in the 55.Ar mask 56locator defines one pin; the pin number is calculated as an addition of 57the bit position and the 58.Ar offset 59locator. 60For example, 61.Ar offset 17 62and 63.Ar mask 0x5 64defines pin numbers 17 and 19. 65.Sh SEE ALSO 66.Xr gpio 4 , 67.Xr iic 4 , 68.Xr intro 4 69.Sh HISTORY 70The 71.Nm 72driver first appeared in 73.Ox 3.9 74and 75.Nx 5.0 . 76.Sh AUTHORS 77.An -nosplit 78The 79.Nm 80driver was written by 81.An Alexander Yurchenko Aq grange@openbsd.org 82and was ported to 83.Nx 84by 85.An Marc Balmer Aq marc@msys.ch . 86.Sh CAVEATS 87A 88.Nm 89device can not be detached from the 90.Xr gpio 4 91bus at runtime due to the fact that 92.Xr iic 4 93busses can not detach once attached. 94