linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boerge Struempfel <boerge.struempfel@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: boerge.struempfel@gmail.com, bstruempfel@ultratronik.de,
	andy.shevchenko@gmail.com, festevam@gmail.com,
	amit.kumar-mahapatra@amd.com, broonie@kernel.org,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	NXP Linux Team <linux-imx@nxp.com>,
	linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v6 5/5] spi: spidev_test Add three missing spi mode bits
Date: Wed, 24 May 2023 11:19:48 +0200	[thread overview]
Message-ID: <20230524091948.41779-6-boerge.struempfel@gmail.com> (raw)
In-Reply-To: <20230524091948.41779-1-boerge.struempfel@gmail.com>

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>
---
 tools/spi/spidev_test.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/tools/spi/spidev_test.c b/tools/spi/spidev_test.c
index 2d2cee339b39..9179942d7f15 100644
--- a/tools/spi/spidev_test.c
+++ b/tools/spi/spidev_test.c
@@ -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)
 {
-	printf("Usage: %s [-2348CDHILNORSbdilopsv]\n", prog);
+	printf("Usage: %s [-2348CDFHILMNORSZbdilopsv]\n", prog);
 	puts("general device settings:\n"
 		 "  -D --device         device to use (default /dev/spidev1.1)\n"
 		 "  -s --speed          max speed (Hz)\n"
@@ -181,11 +181,13 @@ static void print_usage(const char *prog)
 		 "spi mode:\n"
 		 "  -H --cpha           clock phase\n"
 		 "  -O --cpol           clock polarity\n"
+		 "  -F --rx-cpha-flip   flip CPHA on Rx only xfer\n"
 		 "number of wires for transmission:\n"
 		 "  -2 --dual           dual transfer\n"
 		 "  -4 --quad           quad transfer\n"
 		 "  -8 --octal          octal transfer\n"
 		 "  -3 --3wire          SI/SO signals shared\n"
+		 "  -Z --3wire-hiz      high impedance turnaround\n"
 		 "data:\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"
@@ -198,6 +200,7 @@ static void print_usage(const char *prog)
 		 "  -C --cs-high        chip select active high\n"
 		 "  -N --no-cs          no chip select\n"
 		 "  -R --ready          slave pulls low to pause\n"
+		 "  -M --mosi-idle-low  leave mosi line low when idle\n"
 		 "misc:\n"
 		 "  -v --verbose        Verbose (show tx buffer)\n");
 	exit(1);
@@ -213,10 +216,12 @@ static void parse_opts(int argc, char *argv[])
 			{ "loop",          0, 0, 'l' },
 			{ "cpha",          0, 0, 'H' },
 			{ "cpol",          0, 0, 'O' },
+			{ "rx-cpha-flip",  0, 0, 'F' },
 			{ "dual",          0, 0, '2' },
 			{ "quad",          0, 0, '4' },
 			{ "octal",         0, 0, '8' },
 			{ "3wire",         0, 0, '3' },
+			{ "3wire-hiz",     0, 0, 'Z' },
 			{ "input",         1, 0, 'i' },
 			{ "output",        1, 0, 'o' },
 			{ "size",          1, 0, 'S' },
@@ -226,12 +231,13 @@ static void parse_opts(int argc, char *argv[])
 			{ "cs-high",       0, 0, 'C' },
 			{ "no-cs",         0, 0, 'N' },
 			{ "ready",         0, 0, 'R' },
+			{ "mosi-idle-low", 0, 0, 'M' },
 			{ "verbose",       0, 0, 'v' },
 			{ NULL, 0, 0, 0 },
 		};
 		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);
 
 		if (c == -1)
@@ -274,6 +280,15 @@ static void parse_opts(int argc, char *argv[])
 		case '3':
 			mode |= SPI_3WIRE;
 			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':
 			mode |= SPI_NO_CS;
 			break;
-- 
2.40.1


  parent reply	other threads:[~2023-05-24  9:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24  9:19 [PATCH v6 0/5] spi: add SPI_MOSI_IDLE_LOW mode bit Boerge Struempfel
2023-05-24  9:19 ` [PATCH v6 1/5] " Boerge Struempfel
2023-05-24  9:19 ` [PATCH v6 2/5] spi: spi-imx: add support for " Boerge Struempfel
2023-05-24  9:47   ` Frieder Schrempf
2023-05-24 11:42     ` Börge Strümpfel
2023-05-30 12:46   ` Mark Brown
2023-05-30 13:27     ` Börge Strümpfel
2023-05-24  9:19 ` [PATCH v6 3/5] spi: spidev: add two new spi mode bits Boerge Struempfel
2023-05-24  9:19 ` [PATCH v6 4/5] spi: spidev_test: Sorted the options into logical groups Boerge Struempfel
2023-05-24  9:19 ` Boerge Struempfel [this message]
2023-05-30 17:40 ` [PATCH v6 0/5] spi: add SPI_MOSI_IDLE_LOW mode bit Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230524091948.41779-6-boerge.struempfel@gmail.com \
    --to=boerge.struempfel@gmail.com \
    --cc=amit.kumar-mahapatra@amd.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=broonie@kernel.org \
    --cc=bstruempfel@ultratronik.de \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).