linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] spi: spidev{,_test}: Add support for Octal mode data transfers
@ 2020-04-16 10:18 Geert Uytterhoeven
  2020-04-16 10:18 ` [PATCH 1/2] spi: spidev: " Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2020-04-16 10:18 UTC (permalink / raw)
  To: Mark Brown, Boris Brezillon, Yogesh Narayan Gaur
  Cc: linux-spi, Geert Uytterhoeven

	Hi Mark,

This patch adds support for Octal mode data transfers to spidev and the
spidev_test tool.

Note that this was not tested with Octal-capable hardware.

Thanks for your comments!

Geert Uytterhoeven (2):
  spi: spidev: Add support for Octal mode data transfers
  spi: spidev_test: Add support for Octal mode data transfers

 drivers/spi/spidev.c    |  3 ++-
 tools/spi/spidev_test.c | 21 ++++++++++++++++-----
 2 files changed, 18 insertions(+), 6 deletions(-)

-- 
2.17.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] spi: spidev: Add support for Octal mode data transfers
  2020-04-16 10:18 [PATCH 0/2] spi: spidev{,_test}: Add support for Octal mode data transfers Geert Uytterhoeven
@ 2020-04-16 10:18 ` Geert Uytterhoeven
  2020-04-16 10:18 ` [PATCH 2/2] spi: spidev_test: " Geert Uytterhoeven
  2020-04-16 15:44 ` [PATCH 0/2] spi: spidev{,_test}: " Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2020-04-16 10:18 UTC (permalink / raw)
  To: Mark Brown, Boris Brezillon, Yogesh Narayan Gaur
  Cc: linux-spi, Geert Uytterhoeven

Include the flags for Octal mode data transfers in the mask, so
userspace can set them.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/spi/spidev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index 80dd1025b9530493..d753df700e9ea3cc 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -62,7 +62,8 @@ static DECLARE_BITMAP(minors, N_SPI_MINORS);
 #define SPI_MODE_MASK		(SPI_CPHA | SPI_CPOL | SPI_CS_HIGH \
 				| SPI_LSB_FIRST | SPI_3WIRE | SPI_LOOP \
 				| SPI_NO_CS | SPI_READY | SPI_TX_DUAL \
-				| SPI_TX_QUAD | SPI_RX_DUAL | SPI_RX_QUAD)
+				| SPI_TX_QUAD | SPI_TX_OCTAL | SPI_RX_DUAL \
+				| SPI_RX_QUAD | SPI_RX_OCTAL)
 
 struct spidev_data {
 	dev_t			devt;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] spi: spidev_test: Add support for Octal mode data transfers
  2020-04-16 10:18 [PATCH 0/2] spi: spidev{,_test}: Add support for Octal mode data transfers Geert Uytterhoeven
  2020-04-16 10:18 ` [PATCH 1/2] spi: spidev: " Geert Uytterhoeven
@ 2020-04-16 10:18 ` Geert Uytterhoeven
  2020-04-16 15:44 ` [PATCH 0/2] spi: spidev{,_test}: " Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2020-04-16 10:18 UTC (permalink / raw)
  To: Mark Brown, Boris Brezillon, Yogesh Narayan Gaur
  Cc: linux-spi, Geert Uytterhoeven

Add support for octal transfers using the -8/--octal command line
parameter.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 tools/spi/spidev_test.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/tools/spi/spidev_test.c b/tools/spi/spidev_test.c
index 27967dd90f8f3f77..4d219daea2ebcfa2 100644
--- a/tools/spi/spidev_test.c
+++ b/tools/spi/spidev_test.c
@@ -128,18 +128,22 @@ static void transfer(int fd, uint8_t const *tx, uint8_t const *rx, size_t len)
 		.bits_per_word = bits,
 	};
 
-	if (mode & SPI_TX_QUAD)
+	if (mode & SPI_TX_OCTAL)
+		tr.tx_nbits = 8;
+	else if (mode & SPI_TX_QUAD)
 		tr.tx_nbits = 4;
 	else if (mode & SPI_TX_DUAL)
 		tr.tx_nbits = 2;
-	if (mode & SPI_RX_QUAD)
+	if (mode & SPI_RX_OCTAL)
+		tr.rx_nbits = 8;
+	else if (mode & SPI_RX_QUAD)
 		tr.rx_nbits = 4;
 	else if (mode & SPI_RX_DUAL)
 		tr.rx_nbits = 2;
 	if (!(mode & SPI_LOOP)) {
-		if (mode & (SPI_TX_QUAD | SPI_TX_DUAL))
+		if (mode & (SPI_TX_OCTAL | SPI_TX_QUAD | SPI_TX_DUAL))
 			tr.rx_buf = 0;
-		else if (mode & (SPI_RX_QUAD | SPI_RX_DUAL))
+		else if (mode & (SPI_RX_OCTAL | SPI_RX_QUAD | SPI_RX_DUAL))
 			tr.tx_buf = 0;
 	}
 
@@ -187,6 +191,7 @@ static void print_usage(const char *prog)
 	     "  -R --ready    slave pulls low to pause\n"
 	     "  -2 --dual     dual transfer\n"
 	     "  -4 --quad     quad transfer\n"
+	     "  -8 --octal    octal transfer\n"
 	     "  -S --size     transfer size\n"
 	     "  -I --iter     iterations\n");
 	exit(1);
@@ -213,13 +218,14 @@ static void parse_opts(int argc, char *argv[])
 			{ "dual",    0, 0, '2' },
 			{ "verbose", 0, 0, 'v' },
 			{ "quad",    0, 0, '4' },
+			{ "octal",   0, 0, '8' },
 			{ "size",    1, 0, 'S' },
 			{ "iter",    1, 0, 'I' },
 			{ NULL, 0, 0, 0 },
 		};
 		int c;
 
-		c = getopt_long(argc, argv, "D:s:d:b:i:o:lHOLC3NR24p:vS:I:",
+		c = getopt_long(argc, argv, "D:s:d:b:i:o:lHOLC3NR248p:vS:I:",
 				lopts, NULL);
 
 		if (c == -1)
@@ -280,6 +286,9 @@ static void parse_opts(int argc, char *argv[])
 		case '4':
 			mode |= SPI_TX_QUAD;
 			break;
+		case '8':
+			mode |= SPI_TX_OCTAL;
+			break;
 		case 'S':
 			transfer_size = atoi(optarg);
 			break;
@@ -295,6 +304,8 @@ static void parse_opts(int argc, char *argv[])
 			mode |= SPI_RX_DUAL;
 		if (mode & SPI_TX_QUAD)
 			mode |= SPI_RX_QUAD;
+		if (mode & SPI_TX_OCTAL)
+			mode |= SPI_RX_OCTAL;
 	}
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] spi: spidev{,_test}: Add support for Octal mode data transfers
  2020-04-16 10:18 [PATCH 0/2] spi: spidev{,_test}: Add support for Octal mode data transfers Geert Uytterhoeven
  2020-04-16 10:18 ` [PATCH 1/2] spi: spidev: " Geert Uytterhoeven
  2020-04-16 10:18 ` [PATCH 2/2] spi: spidev_test: " Geert Uytterhoeven
@ 2020-04-16 15:44 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2020-04-16 15:44 UTC (permalink / raw)
  To: Yogesh Narayan Gaur, Boris Brezillon, Geert Uytterhoeven; +Cc: linux-spi

On Thu, 16 Apr 2020 12:18:33 +0200, Geert Uytterhoeven wrote:
> 	Hi Mark,
> 
> This patch adds support for Octal mode data transfers to spidev and the
> spidev_test tool.
> 
> Note that this was not tested with Octal-capable hardware.
> 
> [...]

Applied, thanks!

[1/2] spi: spidev: Add support for Octal mode data transfers
      commit: 66ec7b3bc9c043518da828cd84aefe6242943a97
[2/2] spi: spidev_test: Add support for Octal mode data transfers
      commit: 896fa735084e4a9160f8f17d75d2899fb38a6215

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-16 15:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16 10:18 [PATCH 0/2] spi: spidev{,_test}: Add support for Octal mode data transfers Geert Uytterhoeven
2020-04-16 10:18 ` [PATCH 1/2] spi: spidev: " Geert Uytterhoeven
2020-04-16 10:18 ` [PATCH 2/2] spi: spidev_test: " Geert Uytterhoeven
2020-04-16 15:44 ` [PATCH 0/2] spi: spidev{,_test}: " Mark Brown

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).