MCPGPIO(4)

MCPGPIO(4) | Device Drivers Manual | MCPGPIO(4)

# NAME

`mcpgpio` —
Driver for Microchip I/O Expanders on I2C and SPI bus

# SYNOPSIS

## I2C

`mcpgpio* at iic? addr ?`
`gpio* at gpiobus?`

## SPI

`mcpgpio0 at spi? slave 0 flags 0`
`mcpgpio1 at spi? slave 0 flags 1`
`mcpgpio2 at spi? slave 0 flags 2`
`mcpgpio3 at spi? slave 0 flags 3`
`gpio* at gpiobus?`

# DESCRIPTION

The `mcpgpio` driver supports the following Microchip I/O Expanders:

MCP23008
  8-bit I/O expander, I2C interface
MCP23S08
  8-bit I/O expander, SPI interface
MCP23017
  16-bit I/O expander, I2C interface
MCP23S17
  16-bit I/O expander, SPI interface
MCP23018
  16-bit I/O expander, open-drain outputs, I2C interface
MCP23S18
  16-bit I/O expander, open-drain outputs, SPI interface

Access to the pins is provided by the gpio(4) interface.

The SPI version of these devices support multiple chips per chip select signal. On the MCP23S08 and MCP23S17, this is achieved by tying the address select pins to VDD or GND to select an address (0-3 on MCP23S08 or 0-7 on MCP23S17). The MCP23S18 has a similar capability, but uses an analog voltage input on a single address select pin, along with an internal voltage divider ladder and a series of comparators to generate the 3 address bits; see the data sheet for details. The flags argument in the configuration directive for SPI attachments selects the hardware address of the chip instance for that driver instance.

# SEE ALSO

gpio(4), iic(4), intro(4), spi(4)

# HISTORY

The `mcpgpio` driver first appeared in NetBSD 7.0. It was overhauled in NetBSD 10.0 to support additional chip types and to add the I2C attachment.

# AUTHORS

The `mcpgpio` driver was written by Frank Kardel <kardel@NetBSD.org> and Jason R. Thorpe <thorpej@NetBSD.org>.

# BUGS

SPI instances of the `mcpgpio` driver do not utilize the Device Tree bindings for this device.

The `mcpgpio` driver does not currently act as a GPIO provider for the platform device tree.

January 10, 2022 | NetBSD 10.1