From: Pratyush Yadav <p.yadav@ti.com>
To: Tudor Ambarus <tudor.ambarus@microchip.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org, Sekhar Nori <nsekhar@ti.com>,
linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
linux-mtd@lists.infradead.org, Pratyush Yadav <p.yadav@ti.com>
Subject: [PATCH v2 02/11] spi: set mode bits for "spi-rx-dtr" and "spi-tx-dtr"
Date: Wed, 26 Feb 2020 15:06:54 +0530 [thread overview]
Message-ID: <20200226093703.19765-3-p.yadav@ti.com> (raw)
In-Reply-To: <20200226093703.19765-1-p.yadav@ti.com>
These two DT properties express DTR receive and transmit capabilities of
a SPI flash and controller. Introduce two new mode bits: SPI_RX_DTR and
SPI_TX_DTR which correspond to the new DT properties. Set these bits
when the two corresponding properties are present in the device tree.
Also update the detection of unsupported mode bits to include the new
bits.
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
---
drivers/spi/spi.c | 10 +++++++++-
include/linux/spi/spi.h | 2 ++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 38b4c78df506..25c8ed9343f9 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1927,6 +1927,13 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
}
}
+ /* Device DTR mode. */
+ if (of_property_read_bool(nc, "spi-tx-dtr"))
+ spi->mode |= SPI_TX_DTR;
+
+ if (of_property_read_bool(nc, "spi-rx-dtr"))
+ spi->mode |= SPI_RX_DTR;
+
if (spi_controller_is_slave(ctlr)) {
if (!of_node_name_eq(nc, "slave")) {
dev_err(&ctlr->dev, "%pOF is not called 'slave'\n",
@@ -3252,7 +3259,8 @@ int spi_setup(struct spi_device *spi)
bad_bits &= ~SPI_CS_HIGH;
ugly_bits = bad_bits &
(SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTAL |
- SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTAL);
+ SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTAL |
+ SPI_TX_DTR | SPI_RX_DTR);
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 6d16ba01ff5a..bf1108318389 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -183,6 +183,8 @@ struct spi_device {
#define SPI_TX_OCTAL 0x2000 /* transmit with 8 wires */
#define SPI_RX_OCTAL 0x4000 /* receive with 8 wires */
#define SPI_3WIRE_HIZ 0x8000 /* high impedance turnaround */
+#define SPI_RX_DTR 0x10000 /* receive in DTR mode */
+#define SPI_TX_DTR 0x20000 /* transmit in DTR mode */
int irq;
void *controller_state;
void *controller_data;
--
2.25.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2020-02-26 9:36 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-26 9:36 [PATCH v2 00/11] mtd: spi-nor: add xSPI Octal DTR support Pratyush Yadav
2020-02-26 9:36 ` [PATCH v2 01/11] dt-bindings: spi: allow expressing DTR capability Pratyush Yadav
[not found] ` <20200226093703.19765-2-p.yadav-l0cyMroinI0@public.gmane.org>
2020-02-27 16:11 ` Boris Brezillon
[not found] ` <20200227171147.32cc6fcf-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2020-02-27 16:28 ` Mark Brown
[not found] ` <20200227162842.GE4062-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2020-02-27 16:40 ` Geert Uytterhoeven
[not found] ` <CAMuHMdWMCDzQm0tjpybJZyHy4imbC9NqRXP5d4C0xgxQx-Pf8g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-02-27 16:44 ` Mark Brown
[not found] ` <20200227164425.GF4062-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2020-02-27 17:03 ` Geert Uytterhoeven
2020-03-02 9:53 ` Pratyush Yadav
2020-02-27 17:06 ` Boris Brezillon
2020-02-27 16:29 ` Geert Uytterhoeven
2020-02-28 9:46 ` Pratyush Yadav
2020-02-26 9:36 ` Pratyush Yadav [this message]
[not found] ` <20200226093703.19765-3-p.yadav-l0cyMroinI0@public.gmane.org>
2020-02-27 16:23 ` [PATCH v2 02/11] spi: set mode bits for "spi-rx-dtr" and "spi-tx-dtr" Boris Brezillon
2020-03-02 9:48 ` Pratyush Yadav
[not found] ` <20200302094829.opazalwldrdn4s7y-l0cyMroinI0@public.gmane.org>
2020-03-02 10:20 ` Boris Brezillon
2020-02-26 9:36 ` [PATCH v2 03/11] spi: spi-mem: allow specifying whether an op is DTR or not Pratyush Yadav
[not found] ` <20200226093703.19765-4-p.yadav-l0cyMroinI0@public.gmane.org>
2020-02-27 16:36 ` Boris Brezillon
2020-02-26 9:36 ` [PATCH v2 04/11] spi: spi-mem: allow specifying a command's extension Pratyush Yadav
[not found] ` <20200226093703.19765-5-p.yadav-l0cyMroinI0@public.gmane.org>
2020-02-27 16:44 ` Boris Brezillon
2020-02-28 9:41 ` Pratyush Yadav
[not found] ` <20200226093703.19765-1-p.yadav-l0cyMroinI0@public.gmane.org>
2020-02-26 9:36 ` [PATCH v2 05/11] spi: cadence-quadspi: Add support for octal DTR flashes Pratyush Yadav
2020-02-26 9:36 ` [PATCH v2 06/11] mtd: spi-nor: add support for DTR protocol Pratyush Yadav
2020-02-27 16:58 ` Boris Brezillon
[not found] ` <20200227175841.51435e3f-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2020-02-28 9:36 ` Pratyush Yadav
[not found] ` <20200228093658.zc3uifqg4zruokq3-l0cyMroinI0@public.gmane.org>
2020-02-28 10:53 ` Boris Brezillon
[not found] ` <20200228115355.5033798f-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2020-02-28 12:07 ` Pratyush Yadav
[not found] ` <20200228120750.hstohetdnqja2g2p-l0cyMroinI0@public.gmane.org>
2020-02-28 13:18 ` Boris Brezillon
2020-02-26 9:37 ` [PATCH v2 09/11] mtd: spi-nor: use dummy cycle and address width info from SFDP Pratyush Yadav
2020-02-26 9:37 ` [PATCH v2 10/11] mtd: spi-nor: enable octal DTR mode when possible Pratyush Yadav
2020-02-26 9:37 ` [PATCH v2 11/11] mtd: spi-nor: add support for Cypress Semper flash Pratyush Yadav
2020-02-26 9:36 ` [PATCH v2 07/11] mtd: spi-nor: get command opcode extension type from BFPT Pratyush Yadav
2020-02-26 9:37 ` [PATCH v2 08/11] mtd: spi-nor: parse xSPI Profile 1.0 table Pratyush Yadav
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=20200226093703.19765-3-p.yadav@ti.com \
--to=p.yadav@ti.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=miquel.raynal@bootlin.com \
--cc=nsekhar@ti.com \
--cc=richard@nod.at \
--cc=robh+dt@kernel.org \
--cc=tudor.ambarus@microchip.com \
--cc=vigneshr@ti.com \
/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).