95 lines
3.3 KiB
Diff
95 lines
3.3 KiB
Diff
From dedb0ed826070a5a8c6b3a02688f5bafccb9c263 Mon Sep 17 00:00:00 2001
|
|
From: Yogesh Narayan Gaur <yogeshnarayan.gaur@nxp.com>
|
|
Date: Mon, 3 Dec 2018 08:39:06 +0000
|
|
Subject: [PATCH 01/39] spi: add support for octal mode I/O data transfer
|
|
|
|
mainline inclusion
|
|
from mainline-v5.0-rc1
|
|
commit 6b03061f882de49b83ccf44beb3a12c920a2da1b
|
|
category: feature
|
|
bugzilla: https://gitee.com/openeuler/kernel/issues/I8CSBP
|
|
CVE: NA
|
|
|
|
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6b03061f882de49b83ccf44beb3a12c920a2da1b
|
|
|
|
----------------------------------------------------------------------------
|
|
|
|
Add flags for Octal mode I/O data transfer
|
|
Required for the SPI controller which can do the data transfer (TX/RX)
|
|
on 8 data lines e.g. NXP FlexSPI controller.
|
|
SPI_TX_OCTAL: transmit with 8 wires
|
|
SPI_RX_OCTAL: receive with 8 wires
|
|
|
|
Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>
|
|
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
|
|
Signed-off-by: Mark Brown <broonie@kernel.org>
|
|
Signed-off-by: YunYi Yang <yangyunyi2@huawei.com>
|
|
|
|
Conflicts:
|
|
include/linux/spi/spi.h
|
|
---
|
|
drivers/spi/spi.c | 12 ++++++++++--
|
|
include/linux/spi/spi.h | 3 +++
|
|
2 files changed, 13 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
|
|
index d2334bfae076..08c7c8ee3271 100644
|
|
--- a/drivers/spi/spi.c
|
|
+++ b/drivers/spi/spi.c
|
|
@@ -1593,6 +1593,9 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
|
|
case 4:
|
|
spi->mode |= SPI_TX_QUAD;
|
|
break;
|
|
+ case 8:
|
|
+ spi->mode |= SPI_TX_OCTAL;
|
|
+ break;
|
|
default:
|
|
dev_warn(&ctlr->dev,
|
|
"spi-tx-bus-width %d not supported\n",
|
|
@@ -1611,6 +1614,9 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
|
|
case 4:
|
|
spi->mode |= SPI_RX_QUAD;
|
|
break;
|
|
+ case 8:
|
|
+ spi->mode |= SPI_RX_OCTAL;
|
|
+ break;
|
|
default:
|
|
dev_warn(&ctlr->dev,
|
|
"spi-rx-bus-width %d not supported\n",
|
|
@@ -2857,14 +2863,16 @@ int spi_setup(struct spi_device *spi)
|
|
/* if it is SPI_3WIRE mode, DUAL and QUAD should be forbidden
|
|
*/
|
|
if ((spi->mode & SPI_3WIRE) && (spi->mode &
|
|
- (SPI_TX_DUAL | SPI_TX_QUAD | SPI_RX_DUAL | SPI_RX_QUAD)))
|
|
+ (SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTAL |
|
|
+ SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTAL)))
|
|
return -EINVAL;
|
|
/* help drivers fail *cleanly* when they need options
|
|
* that aren't supported with their current controller
|
|
*/
|
|
bad_bits = spi->mode & ~spi->controller->mode_bits;
|
|
ugly_bits = bad_bits &
|
|
- (SPI_TX_DUAL | SPI_TX_QUAD | SPI_RX_DUAL | SPI_RX_QUAD);
|
|
+ (SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTAL |
|
|
+ SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTAL);
|
|
if (ugly_bits) {
|
|
dev_warn(&spi->dev,
|
|
"setup: ignoring unsupported mode bits %x\n",
|
|
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
|
|
index 1c0a0fa34586..80d6bd6e46c5 100644
|
|
--- a/include/linux/spi/spi.h
|
|
+++ b/include/linux/spi/spi.h
|
|
@@ -163,6 +163,9 @@ struct spi_device {
|
|
#define SPI_TX_QUAD 0x200 /* transmit with 4 wires */
|
|
#define SPI_RX_DUAL 0x400 /* receive with 2 wires */
|
|
#define SPI_RX_QUAD 0x800 /* receive with 4 wires */
|
|
+#define SPI_CS_WORD 0x1000 /* toggle cs after each word */
|
|
+#define SPI_TX_OCTAL 0x2000 /* transmit with 8 wires */
|
|
+#define SPI_RX_OCTAL 0x4000 /* receive with 8 wires */
|
|
int irq;
|
|
void *controller_state;
|
|
void *controller_data;
|
|
--
|
|
2.27.0
|
|
|