From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Alexandru Ardelean <alexandru.ardelean@analog.com>,
Mark Brown <broonie@kernel.org>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>,
kernel@pengutronix.de, linux-kernel@vger.kernel.org,
linux-input@vger.kernel.org, linux-spi@vger.kernel.org,
David Jander <david@protonic.nl>
Subject: [PATCH v2 1/2] spi: introduce SPI_MODE_X_MASK macro
Date: Tue, 27 Oct 2020 10:57:23 +0100 [thread overview]
Message-ID: <20201027095724.18654-2-o.rempel@pengutronix.de> (raw)
In-Reply-To: <20201027095724.18654-1-o.rempel@pengutronix.de>
Provide a macro to filter all SPI_MODE_0,1,2,3 mode in one run.
The latest SPI framework will parse the devicetree in following call
sequence: of_register_spi_device() -> of_spi_parse_dt()
So, driver do not need to pars the devicetree and will get prepared
flags in the probe.
On one hand it is good far most drivers. On other hand some drivers need to
filter flags provide by SPI framework and apply know to work flags. This drivers
may use SPI_MODE_X_MASK to filter MODE flags and set own, known flags:
spi->flags &= ~SPI_MODE_X_MASK;
spi->flags |= SPI_MODE_0;
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
include/linux/spi/spi.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 99380c0825db..8097f27702f3 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -171,6 +171,7 @@ struct spi_device {
#define SPI_MODE_1 (0|SPI_CPHA)
#define SPI_MODE_2 (SPI_CPOL|0)
#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA)
+#define SPI_MODE_X_MASK (SPI_CPOL|SPI_CPHA)
#define SPI_CS_HIGH 0x04 /* chipselect active high? */
#define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */
#define SPI_3WIRE 0x10 /* SI/SO signals shared */
--
2.28.0
next prev parent reply other threads:[~2020-10-27 9:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 9:57 [PATCH v2 0/2] SPI/ Input: ads7846: properly handle spi->mode flags Oleksij Rempel
2020-10-27 9:57 ` Oleksij Rempel [this message]
2020-10-27 9:57 ` [PATCH v2 2/2] Input: ads7846: do not overwrite spi->mode flags set by spi framework Oleksij Rempel
2020-11-09 11:02 ` Oleksij Rempel
2020-11-11 18:51 ` Dmitry Torokhov
2020-11-11 15:48 ` [PATCH v2 0/2] SPI/ Input: ads7846: properly handle spi->mode flags Mark Brown
2020-11-12 19:39 ` 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=20201027095724.18654-2-o.rempel@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=alexandru.ardelean@analog.com \
--cc=broonie@kernel.org \
--cc=david@protonic.nl \
--cc=dmitry.torokhov@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.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).