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