1 .\" Copyright (c) 2013, Luiz Otavio O Souza <loos@FreeBSD.org>
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .Nd GPIO I2C bit-banging device driver
42 driver provides an IIC bit-banging interface using two GPIO pins for the
46 implements an open colector kind of output, as recommended by the standard,
47 when driving the pins on the
49 i.e, they are never switched to the logical value of '1',
50 or they are '0' or simply open (Hi-Z/tri-state).
51 So the pullup resistors are required so
55 On a hint based system, like
56 .Li MIPS , these values are configureable for the
58 .Bl -tag -width ".Va hint.gpioiic.%d.atXXX"
59 .It Va hint.gpioiic.%d.at
60 The gpiobus you are attaching to.
61 Normally just gpiobus0.
62 .It Va hint.gpioiic.%d.pins
63 This is a bitmask of the pins on the
65 that are to be used for SCLOCK and SDATA from the GPIO IIC
67 To configure pin 0 and 7, use the bitmask of
68 0b10000001 and convert it to a hexadecimal value of 0x0081.
69 Please note that this mask should only ever have two bits set
70 (any others bits - i.e., pins - will be ignored).
71 .It Va hint.gpioiic.%d.scl
72 Indicates which bit in the
73 .Va hint.gpioiic.%d.pins
74 should be used as the SCLOCK
76 Optional, defaults to 0.
77 .It Va hint.gpioiic.%d.sda
78 Indicates which bit in the
79 .Va hint.gpioiic.%d.pins
80 should be used as the SDATA
82 Optional, defaults to 1.
88 .Li ARM , the dts part for a
90 device usually looks like:
98 compatible = "gpioiic";
100 * Attach to GPIO pins 21 and 22. Set them
101 * initially as inputs.
103 gpios = <&gpio 21 1 0
105 scl = <0>; /* GPIO pin 21 - optional */
106 sda = <1>; /* GPIO pin 22 - optional */
108 /* This is an example of a gpioiic child. */
111 i2c-address = <0x4f>;
118 .Bl -tag -width ".Va compatible"
120 Should always be set to "gpioiic".
124 property indicates which GPIO pins should be used for SCLOCK and SDATA
125 on the GPIO IIC bit-banging bus.
126 For more details about the
128 property, please consult
129 .Pa /usr/src/sys/boot/fdt/dts/bindings-gpio.txt .
133 option indicates which bit in the
135 should be used as the SCLOCK source.
136 Optional, defaults to 0.
140 option indicates which bit in the
142 should be used as the SDATA source.
143 Optional, defaults to 1.
155 manual page first appeared in
159 manual page was written by
160 .An Luiz Otavio O Souza .