mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 06:01:57 +00:00
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 <boerge.struempfel@gmail.com> Link: https://lore.kernel.org/r/20230530141641.1155691-6-boerge.struempfel@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
113f36f2dc
commit
b229a7f530
@ -172,7 +172,7 @@ static void transfer(int fd, uint8_t const *tx, uint8_t const *rx, size_t len)
|
|||||||
|
|
||||||
static void print_usage(const char *prog)
|
static void print_usage(const char *prog)
|
||||||
{
|
{
|
||||||
printf("Usage: %s [-2348CDHILNORSbdilopsv]\n", prog);
|
printf("Usage: %s [-2348CDFHILMNORSZbdilopsv]\n", prog);
|
||||||
puts("general device settings:\n"
|
puts("general device settings:\n"
|
||||||
" -D --device device to use (default /dev/spidev1.1)\n"
|
" -D --device device to use (default /dev/spidev1.1)\n"
|
||||||
" -s --speed max speed (Hz)\n"
|
" -s --speed max speed (Hz)\n"
|
||||||
@ -181,11 +181,13 @@ static void print_usage(const char *prog)
|
|||||||
"spi mode:\n"
|
"spi mode:\n"
|
||||||
" -H --cpha clock phase\n"
|
" -H --cpha clock phase\n"
|
||||||
" -O --cpol clock polarity\n"
|
" -O --cpol clock polarity\n"
|
||||||
|
" -F --rx-cpha-flip flip CPHA on Rx only xfer\n"
|
||||||
"number of wires for transmission:\n"
|
"number of wires for transmission:\n"
|
||||||
" -2 --dual dual transfer\n"
|
" -2 --dual dual transfer\n"
|
||||||
" -4 --quad quad transfer\n"
|
" -4 --quad quad transfer\n"
|
||||||
" -8 --octal octal transfer\n"
|
" -8 --octal octal transfer\n"
|
||||||
" -3 --3wire SI/SO signals shared\n"
|
" -3 --3wire SI/SO signals shared\n"
|
||||||
|
" -Z --3wire-hiz high impedance turnaround\n"
|
||||||
"data:\n"
|
"data:\n"
|
||||||
" -i --input input data from a file (e.g. \"test.bin\")\n"
|
" -i --input input data from a file (e.g. \"test.bin\")\n"
|
||||||
" -o --output output data to a file (e.g. \"results.bin\")\n"
|
" -o --output output data to a file (e.g. \"results.bin\")\n"
|
||||||
@ -198,6 +200,7 @@ static void print_usage(const char *prog)
|
|||||||
" -C --cs-high chip select active high\n"
|
" -C --cs-high chip select active high\n"
|
||||||
" -N --no-cs no chip select\n"
|
" -N --no-cs no chip select\n"
|
||||||
" -R --ready slave pulls low to pause\n"
|
" -R --ready slave pulls low to pause\n"
|
||||||
|
" -M --mosi-idle-low leave mosi line low when idle\n"
|
||||||
"misc:\n"
|
"misc:\n"
|
||||||
" -v --verbose Verbose (show tx buffer)\n");
|
" -v --verbose Verbose (show tx buffer)\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -213,10 +216,12 @@ static void parse_opts(int argc, char *argv[])
|
|||||||
{ "loop", 0, 0, 'l' },
|
{ "loop", 0, 0, 'l' },
|
||||||
{ "cpha", 0, 0, 'H' },
|
{ "cpha", 0, 0, 'H' },
|
||||||
{ "cpol", 0, 0, 'O' },
|
{ "cpol", 0, 0, 'O' },
|
||||||
|
{ "rx-cpha-flip", 0, 0, 'F' },
|
||||||
{ "dual", 0, 0, '2' },
|
{ "dual", 0, 0, '2' },
|
||||||
{ "quad", 0, 0, '4' },
|
{ "quad", 0, 0, '4' },
|
||||||
{ "octal", 0, 0, '8' },
|
{ "octal", 0, 0, '8' },
|
||||||
{ "3wire", 0, 0, '3' },
|
{ "3wire", 0, 0, '3' },
|
||||||
|
{ "3wire-hiz", 0, 0, 'Z' },
|
||||||
{ "input", 1, 0, 'i' },
|
{ "input", 1, 0, 'i' },
|
||||||
{ "output", 1, 0, 'o' },
|
{ "output", 1, 0, 'o' },
|
||||||
{ "size", 1, 0, 'S' },
|
{ "size", 1, 0, 'S' },
|
||||||
@ -226,12 +231,13 @@ static void parse_opts(int argc, char *argv[])
|
|||||||
{ "cs-high", 0, 0, 'C' },
|
{ "cs-high", 0, 0, 'C' },
|
||||||
{ "no-cs", 0, 0, 'N' },
|
{ "no-cs", 0, 0, 'N' },
|
||||||
{ "ready", 0, 0, 'R' },
|
{ "ready", 0, 0, 'R' },
|
||||||
|
{ "mosi-idle-low", 0, 0, 'M' },
|
||||||
{ "verbose", 0, 0, 'v' },
|
{ "verbose", 0, 0, 'v' },
|
||||||
{ NULL, 0, 0, 0 },
|
{ NULL, 0, 0, 0 },
|
||||||
};
|
};
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
c = getopt_long(argc, argv, "D:s:d:b:i:o:lHOLC3NR248p:vS:I:",
|
c = getopt_long(argc, argv, "D:s:d:b:i:o:lHOLC3ZFMNR248p:vS:I:",
|
||||||
lopts, NULL);
|
lopts, NULL);
|
||||||
|
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
@ -274,6 +280,15 @@ static void parse_opts(int argc, char *argv[])
|
|||||||
case '3':
|
case '3':
|
||||||
mode |= SPI_3WIRE;
|
mode |= SPI_3WIRE;
|
||||||
break;
|
break;
|
||||||
|
case 'Z':
|
||||||
|
mode |= SPI_3WIRE_HIZ;
|
||||||
|
break;
|
||||||
|
case 'F':
|
||||||
|
mode |= SPI_RX_CPHA_FLIP;
|
||||||
|
break;
|
||||||
|
case 'M':
|
||||||
|
mode |= SPI_MOSI_IDLE_LOW;
|
||||||
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
mode |= SPI_NO_CS;
|
mode |= SPI_NO_CS;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user