xref: /netbsd-src/share/man/man4/mcpgpio.4 (revision 5eb438ad7ab9d8a59ec84f8c11db82dad27d43d4)
1.\"	$NetBSD: mcpgpio.4,v 1.1 2022/01/17 16:31:23 thorpej Exp $
2.\"
3.\"Copyright (c) 2014 Frank Kardel
4.\"All rights reserved.
5.\"
6.\"Redistribution and use in source and binary forms, with or without
7.\"modification, are permitted provided that the following conditions
8.\"are met:
9.\"1. Redistributions of source code must retain the above copyright
10.\"   notice, this list of conditions and the following disclaimer.
11.\"2. Redistributions in binary form must reproduce the above copyright
12.\"   notice, this list of conditions and the following disclaimer in the
13.\"   documentation and/or other materials provided with the distribution.
14.\"
15.\"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS
16.\"``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17.\"TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18.\"PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19.\"BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20.\"CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21.\"SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22.\"INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23.\"CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24.\"ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25.\"POSSIBILITY OF SUCH DAMAGE.
26.\"
27.Dd January 10, 2022
28.Dt MCPGPIO 4
29.Os
30.Sh NAME
31.Nm mcpgpio
32.Nd Driver for Microchip I/O Expanders on I2C and SPI bus
33.Sh SYNOPSIS
34.Ss I2C
35.Cd "mcpgpio* at iic? addr ?"
36.Cd "gpio* at gpiobus?"
37.Ss SPI
38.Cd "mcpgpio0 at spi? slave 0 flags 0"
39.Cd "mcpgpio1 at spi? slave 0 flags 1"
40.Cd "mcpgpio2 at spi? slave 0 flags 2"
41.Cd "mcpgpio3 at spi? slave 0 flags 3"
42.Cd "gpio* at gpiobus?"
43.Sh DESCRIPTION
44The
45.Nm
46driver supports the following Microchip I/O Expanders:
47.Bl -tag -width "mcp23x08"
48.It MCP23008
498-bit I/O expander, I2C interface
50.It MCP23S08
518-bit I/O expander, SPI interface
52.It MCP23017
5316-bit I/O expander, I2C interface
54.It MCP23S17
5516-bit I/O expander, SPI interface
56.It MCP23018
5716-bit I/O expander, open-drain outputs, I2C interface
58.It MCP23S18
5916-bit I/O expander, open-drain outputs, SPI interface
60.El
61.Pp
62Access to the pins is provided by the
63.Xr gpio 4
64interface.
65.Pp
66The SPI version of these devices support multiple chips per chip select
67signal.
68On the MCP23S08 and MCP23S17, this is achieved by tying the address select
69pins to VDD or GND to select an address
70.Pq 0-3 on MCP23S08 or 0-7 on MCP23S17 .
71The MCP23S18 has a similar capability, but uses an analog voltage input
72on a single address select pin, along with an internal voltage divider
73ladder and a series of comparators to generate the 3 address bits; see
74the data sheet for details.
75The
76.Ar flags
77argument in the configuration directive for SPI attachments selects the
78hardware address of the chip instance for that driver instance.
79.Sh SEE ALSO
80.Xr gpio 4 ,
81.Xr iic 4 ,
82.Xr intro 4 ,
83.Xr spi 4
84.Sh HISTORY
85The
86.Nm
87driver first appeared in
88.Nx 7.0 .
89It was overhauled in
90.Nx 10.0
91to support additional chip types and to add the I2C attachment.
92.Sh AUTHORS
93.An -nosplit
94The
95.Nm
96driver was written by
97.An Frank Kardel Aq Mt kardel@NetBSD.org
98and
99.An Jason R. Thorpe Aq Mt thorpej@NetBSD.org .
100.Sh BUGS
101SPI instances of the
102.Nm
103driver do not utilize the Device Tree bindings for this device.
104.Pp
105The
106.Nm
107driver does not currently act as a GPIO provider for the platform
108device tree.
109