]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/gpioiic.4
Merge ^/vendor/lldb/dist up to its last change, and resolve conflicts.
[FreeBSD/FreeBSD.git] / share / man / man4 / gpioiic.4
1 .\" Copyright (c) 2013, Luiz Otavio O Souza <loos@FreeBSD.org>
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
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.
12 .\"
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
23 .\" SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd December 1, 2019
28 .Dt GPIOIIC 4
29 .Os
30 .Sh NAME
31 .Nm gpioiic
32 .Nd GPIO I2C bit-banging device driver
33 .Sh SYNOPSIS
34 To compile this driver into the kernel,
35 place the following lines in your
36 kernel configuration file:
37 .Bd -ragged -offset indent
38 .Cd "device gpio"
39 .Cd "device gpioiic"
40 .Cd "device iicbb"
41 .Cd "device iicbus"
42 .Ed
43 .Pp
44 Alternatively, to load the driver as a
45 module at boot time, place the following line in
46 .Xr loader.conf 5 :
47 .Bd -literal -offset indent
48 gpioiic_load="YES"
49 .Ed
50 .Sh DESCRIPTION
51 The
52 .Nm
53 driver provides an IIC bit-banging interface using two GPIO pins for the
54 SCL and SDA lines on the bus.
55 .Pp
56 .Nm
57 simulates an open collector kind of output when managing the pins on the
58 bus, even on systems which don't directly support configuring gpio pins
59 in that mode.
60 The pins are never driven to the logical value of '1'.
61 They are driven to '0' or switched to input mode (Hi-Z/tri-state), and
62 an external pullup resistor pulls the line to the 1 state unless some
63 other device on the bus is driving it to 0.
64 .Pp
65 .Sh HINTS CONFIGURATION
66 On a
67 .Xr device.hints 5
68 based system, such as MIPS, these values are configurable for
69 .Nm :
70 .Bl -tag -width ".Va hint.gpioiic.%d.atXXX"
71 .It Va hint.gpioiic.%d.at
72 The
73 .Nm gpiobus
74 you are attaching to.
75 Normally just gpiobus0 on systems with a single bank of gpio pins.
76 .It Va hint.gpioiic.%d.pins
77 This is a bitmask of the pins on the
78 .Nm gpiobus
79 that are to be used for SCLOCK and SDATA from the GPIO IIC
80 bit-banging bus.
81 To configure pin 0 and 7, use the bitmask of
82 0b10000001 and convert it to a hexadecimal value of 0x0081.
83 Please note that this mask should only ever have two bits set
84 (any other bits - i.e., pins - will be ignored).
85 Because
86 .Nm
87 must be a child of the gpiobus, both gpio pins must be part of that bus.
88 .It Va hint.gpioiic.%d.scl
89 Indicates which bit in the
90 .Va hint.gpioiic.%d.pins
91 should be used as the SCLOCK
92 source.
93 Optional, defaults to 0.
94 .It Va hint.gpioiic.%d.sda
95 Indicates which bit in the
96 .Va hint.gpioiic.%d.pins
97 should be used as the SDATA
98 source.
99 Optional, defaults to 1.
100 .El
101 .Sh FDT CONFIGURATION
102 On an
103 .Xr FDT 4
104 based system, such as ARM, the DTS node for
105 .Nm gpioiic
106 conforms to the standard bindings document i2c/i2c-gpio.yaml.
107 The device node typically appears at the root of the device tree.
108 The following is an example of a
109 .Nm
110 node with one slave device
111 on the IIC bus:
112 .Bd -literal
113 / {
114         gpioiic0 {
115                 compatible = "i2c-gpio";
116                 pinctrl-names = "default";
117                 pinctrl-0 = <&pinctrl_gpioiic0>;
118                 scl-gpios = <&gpio1  5 GPIO_ACTIVE_HIGH>;
119                 sda-gpios = <&gpio7 11 GPIO_ACTIVE_HIGH>;
120                 status = "okay";
121
122                 /* One slave device on the i2c bus. */
123                 rtc@51 {
124                         compatible="nxp,pcf2127";
125                         reg = <0x51>;
126                         status = "okay";
127                 };
128         };
129 };
130 .Ed
131 .Pp
132 Where:
133 .Bl -tag -width ".Va compatible"
134 .It Va compatible
135 Should be set to "i2c-gpio".
136 The deprecated string "gpioiic" is also accepted for backwards compatibility.
137 .It Va scl-gpios Va sda-gpios
138 These properties indicate which GPIO pins should be used for clock
139 and data on the GPIO IIC bit-banging bus.
140 There is no requirement that the two pins belong to the same gpio controller.
141 .It Va pinctrl-names pinctrl-0
142 These properties may be required to configure the chosen pins as gpio
143 pins, unless the pins default to that state on your system.
144 .El
145 .Sh SEE ALSO
146 .Xr fdt 4 ,
147 .Xr gpio 4 ,
148 .Xr iic 4 ,
149 .Xr iicbb 4 ,
150 .Xr iicbus 4
151 .Sh HISTORY
152 The
153 .Nm
154 manual page first appeared in
155 .Fx 10.1 .
156 .Sh AUTHORS
157 This
158 manual page was written by
159 .An Luiz Otavio O Souza .