Home | History | Annotate | Download | only in umcpmioctl
History log of /src/usr.sbin/umcpmioctl/putflash.h
RevisionDateAuthorComments
 1.1  16-Dec-2024  brad A driver for the MCP-2221 / 2221A multi-io chip. This is a USB to
UART / GPIO / I2C multi-io chip probably based upon a programmed PIC.
The end result is that simple gpio and i2c can exist on any system
that provides a USB port. This is everything from a RPI to a
Virtualbox VM.


o The UART presents itself as a umodem(4) device and pretty much works
as one would expect.

o There are 4 simple GPIO pins with multiple functions that attach to
gpio(4). Support for basic GPIO input and output exists with gpioctl,
the ADC, DAC and clock pulse functions exist as ALT functions. For
the ADC and DAC /dev/ devices are provided such that simple reads and
writes interact with the ADC and DAC. The IRQ function on pin GP1 and
bit banging the GPIO with gpiopps(4) and gpioow(4) are not really
supported. The short answer is that a spin lock is held while trying
to do USB transfers and that isn't allowed.

o There is a simple I2C engine that attaches to iic(4). This mostly
works as expected, except that a READ without STOP is not supported by
the engine which causes problems for some drivers. Most drivers do
not seem to use READ without STOP and seem to work as expected.
Support for changing the I2C speed is not supported, but nothing much
really does that.

o A userland utility called umcpmioctl(8) is provided that allows the
query of the status of the chip and allows for the query of the flash
memory and the setting of some of the flash memory parameters mostly
related to gpio. This utility interacts with a control device in
/dev/. The flash memory contents is copied to the sram on boot up of
the chip and can be used to adjust how the chip sets up the gpio pins,
among other things. Support for setting or entering the chip password
is not provided.

o A number of sysctls are provided to mess with various settings.
These are detailed in the man page.


While not perfect, the chip is reasonable, cheap, and has at least one
vendor making a breakout board. It is also one of the only ones in
this space that has enough documentation to write a driver.

Support for a related chip, the MCP-2210, which provides SPI and GPIO
may exist some day as the programming interface is very simular.

RSS XML Feed