.\" $NetBSD: umcpmioctl.8,v 1.5 2025/11/29 18:39:15 brad Exp $ .\" .\" Copyright (c) 2024, 2025 Brad Spencer .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .Dd November 24, 2024 .Dt UMCPMIOCTL 8 .Os .Sh NAME .Nm umcpmioctl .Nd interact with a MCP2210 or MCP2221 / MCP2221A multi-io chip .Sh SYNOPSIS .Nm umcpmioctl .Op Fl dh .Ar device .Cm status .Nm umcpmioctl .Op Fl dh .Ar device .Cm get sram (MCP2221 / MCP2221A) .Nm umcpmioctl .Op Fl dh .Ar device .Cm get sram gpio (MCP2210) .Nm umcpmioctl .Op Fl dh .Ar device .Cm get sram gpio_values (MCP2210) .Nm umcpmioctl .Op Fl dh .Ar device .Cm get sram gpio_direction (MCP2210) .Nm umcpmioctl .Op Fl dh .Ar device .Cm get sram spi (MCP2210) .Nm umcpmioctl .Op Fl dh .Ar device .Cm get gp .Nm umcpmioctl .Op Fl dh .Ar device .Cm get flash cs .Nm umcpmioctl .Op Fl dh .Ar device .Cm get flash gp .Nm umcpmioctl .Op Fl dh .Ar device .Cm get flash usbman .Nm umcpmioctl .Op Fl dh .Ar device .Cm get flash usbprod .Nm umcpmioctl .Op Fl dh .Ar device .Cm get flash usbsn (MCP2221 / MCP2221A) .Nm umcpmioctl .Op Fl dh .Ar device .Cm get flash chipsn (MCP2221 / MCP2221A) .Nm umcpmioctl .Op Fl dh .Ar device .Cm get flash spi (MCP2210) .Nm umcpmioctl .Op Fl dh .Ar device .Cm get flash usbkeyparams (MCP2210) .Nm umcpmioctl .Op Fl dh .Ar device .Cm put flash gp .Ar GPn PIN_FUNCTION ... .Nm umcpmioctl .Op Fl dh .Ar device .Cm put flash spi .Ar SPI_PARAMETER VALUE ... (MCP2210) .Nm umcpmioctl .Op Fl dh .Ar device .Cm put flash usbkeyparams .Ar USB_PARAMETER VALUE ... (MCP2210) .Sh DESCRIPTION The .Nm utility interacts with a MCP2210 or MCP2221 / MCP2221A and can be used to pull the status of the chip, get the SRAM values, get the values from the on-board FLASH and can be used to set some of the FLASH values associated with the GPIO pins and SPI. The values from flash are copied into the SRAM when the chip enumerates or powers up. .Pp For the .Cm put flash gp command, .Ar GPn is one of .Cm GP0 to .Cm GP3 or .Cm GP7 depending on the chip and .Ar PIN_FUNCTION is one of .Cm GPIO_PIN_INPUT , .Cm GPIO_PIN_OUTPUT , .Cm GPIO_PIN_ALT0 , .Cm GPIO_PIN_ALT1 , .Cm GPIO_PIN_ALT2 , .Cm GPIO_PIN_ALT3 , .Cm DEFAULT_OUTPUT_ZERO or .Cm DEFAULT_OUTPUT_ONE . .Pp For the .Cm put flash spi command. .Ar SPI_PARAMETER is one of .Cm CS_TO_DATA_DELAY , .Cm LAST_BYTE_TO_CS_DELAY , or .Cm DELAY_BETWEEN_BYTES . The .Ar VALUE is the number of microseconds for that parameter. .Pp For the .Cm put flash usbkeyparams command, .Ar USB_PARAMETER is one of .Cm POWERED or .Cm MA . The .Ar VALUE is .Cm SELF or .Cm BUS for .Cm POWERED or a number from 1 to 511 for the amount of MA power requested. .Pp For the .Cm put flash command, the function and value pairs may be repeated. .Sh EXAMPLES .Dl "umcpmioctl /dev/umcpmio0ctl status" .Pp Query the chip for its status. .Pp .Dl "umcpmioctl /dev/umcpmio0ctl get sram" .Pp Return the values from the SRAM on the chip. .Pp .Dl "umcpmioctl /dev/umcpmio0ctl get flash cs" .Pp Return the values for the chip settings from the FLASH. .Pp .Dl "umcpmioctl /dev/umcpmio0ctl put flash gp GP0 GPIO_PIN_INPUT" .Pp This will set the GP0 pin to be an input pin on start up of the chip. .Pp .Dl "umcpmioctl /dev/umcpmio0ctl put flash gp GP2 GPIO_PIN_OUTPUT GP0 GPIO_PIN_ALT0" .Pp This will set the GP2 pin to be an output pin and GP0 pin to have the ALT0 function upon chip start up. .Sh SEE ALSO .Xr gpio 4 , .Xr umcpmio 4 .Sh HISTORY The .Nm utility first appeared in .Nx 11.0 . .Sh AUTHORS .An -nosplit The .Nm utility was written by .An Brad Spencer Aq Mt brad@anduin.eldar.org . .Sh BUGS Only a limited number of setting can be changed in FLASH or NVRAM. .Pp The output is not very pleasant to use and one will probably need to have the data sheet for the MCP2210 or MCP2221 / MCP2221A on hand to make sense of the output. .