Skip to content

Commit b229a7f

Browse files
BoergeStbroonie
authored andcommitted
spi: spidev_test Add three missing spi mode bits
Added the three missing spi mode bits SPI_3WIRE_HIZ, SPI_RX_CPHA_FLIP, and SPI_MOSI_IDLE_LOW. Signed-off-by: Boerge Struempfel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 113f36f commit b229a7f

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

tools/spi/spidev_test.c

+17-2
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ static void transfer(int fd, uint8_t const *tx, uint8_t const *rx, size_t len)
172172

173173
static void print_usage(const char *prog)
174174
{
175-
printf("Usage: %s [-2348CDHILNORSbdilopsv]\n", prog);
175+
printf("Usage: %s [-2348CDFHILMNORSZbdilopsv]\n", prog);
176176
puts("general device settings:\n"
177177
" -D --device device to use (default /dev/spidev1.1)\n"
178178
" -s --speed max speed (Hz)\n"
@@ -181,11 +181,13 @@ static void print_usage(const char *prog)
181181
"spi mode:\n"
182182
" -H --cpha clock phase\n"
183183
" -O --cpol clock polarity\n"
184+
" -F --rx-cpha-flip flip CPHA on Rx only xfer\n"
184185
"number of wires for transmission:\n"
185186
" -2 --dual dual transfer\n"
186187
" -4 --quad quad transfer\n"
187188
" -8 --octal octal transfer\n"
188189
" -3 --3wire SI/SO signals shared\n"
190+
" -Z --3wire-hiz high impedance turnaround\n"
189191
"data:\n"
190192
" -i --input input data from a file (e.g. \"test.bin\")\n"
191193
" -o --output output data to a file (e.g. \"results.bin\")\n"
@@ -198,6 +200,7 @@ static void print_usage(const char *prog)
198200
" -C --cs-high chip select active high\n"
199201
" -N --no-cs no chip select\n"
200202
" -R --ready slave pulls low to pause\n"
203+
" -M --mosi-idle-low leave mosi line low when idle\n"
201204
"misc:\n"
202205
" -v --verbose Verbose (show tx buffer)\n");
203206
exit(1);
@@ -213,10 +216,12 @@ static void parse_opts(int argc, char *argv[])
213216
{ "loop", 0, 0, 'l' },
214217
{ "cpha", 0, 0, 'H' },
215218
{ "cpol", 0, 0, 'O' },
219+
{ "rx-cpha-flip", 0, 0, 'F' },
216220
{ "dual", 0, 0, '2' },
217221
{ "quad", 0, 0, '4' },
218222
{ "octal", 0, 0, '8' },
219223
{ "3wire", 0, 0, '3' },
224+
{ "3wire-hiz", 0, 0, 'Z' },
220225
{ "input", 1, 0, 'i' },
221226
{ "output", 1, 0, 'o' },
222227
{ "size", 1, 0, 'S' },
@@ -226,12 +231,13 @@ static void parse_opts(int argc, char *argv[])
226231
{ "cs-high", 0, 0, 'C' },
227232
{ "no-cs", 0, 0, 'N' },
228233
{ "ready", 0, 0, 'R' },
234+
{ "mosi-idle-low", 0, 0, 'M' },
229235
{ "verbose", 0, 0, 'v' },
230236
{ NULL, 0, 0, 0 },
231237
};
232238
int c;
233239

234-
c = getopt_long(argc, argv, "D:s:d:b:i:o:lHOLC3NR248p:vS:I:",
240+
c = getopt_long(argc, argv, "D:s:d:b:i:o:lHOLC3ZFMNR248p:vS:I:",
235241
lopts, NULL);
236242

237243
if (c == -1)
@@ -274,6 +280,15 @@ static void parse_opts(int argc, char *argv[])
274280
case '3':
275281
mode |= SPI_3WIRE;
276282
break;
283+
case 'Z':
284+
mode |= SPI_3WIRE_HIZ;
285+
break;
286+
case 'F':
287+
mode |= SPI_RX_CPHA_FLIP;
288+
break;
289+
case 'M':
290+
mode |= SPI_MOSI_IDLE_LOW;
291+
break;
277292
case 'N':
278293
mode |= SPI_NO_CS;
279294
break;

0 commit comments

Comments
 (0)