1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
.\" $NetBSD: umcpmioctl.8,v 1.5 2025/11/29 18:39:15 brad Exp $
.\"
.\" Copyright (c) 2024, 2025 Brad Spencer <brad@anduin.eldar.org>
.\"
.\" 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.
|