mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krishna Yarlagadda <kyarlagadda@nvidia.com>
To: <jsnitsel@redhat.com>, <robh+dt@kernel.org>, <broonie@kernel.org>,
	<peterhuewe@gmx.de>, <jgg@ziepe.ca>, <jarkko@kernel.org>,
	<krzysztof.kozlowski+dt@linaro.org>, <linux-spi@vger.kernel.org>,
	<linux-tegra@vger.kernel.org>, <linux-integrity@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <thierry.reding@gmail.com>, <jonathanh@nvidia.com>,
	<skomatineni@nvidia.com>, <ldewangan@nvidia.com>,
	Krishna Yarlagadda <kyarlagadda@nvidia.com>
Subject: [Patch V10 1/3] spi: Add TPM HW flow flag
Date: Fri, 21 Apr 2023 14:43:07 +0530	[thread overview]
Message-ID: <20230421091309.2672-2-kyarlagadda@nvidia.com> (raw)
In-Reply-To: <20230421091309.2672-1-kyarlagadda@nvidia.com>

TPM specification [1] defines flow control over SPI. Client device can
insert a wait state on MISO when address is transmitted by controller
on MOSI. Detecting the wait state in software is only possible for
full duplex controllers. For controllers that support only half-
duplex, the wait state detection needs to be implemented in hardware.

Add a flag SPI_TPM_HW_FLOW for TPM device to set when software flow
control is not possible and hardware flow control is expected from
SPI controller.

Reference:
[1] https://trustedcomputinggroup.org/resource/pc-client-platform-tpm
-profile-ptp-specification/

Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
---
 include/linux/spi/spi.h | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 873ced6ae4ca..cfe42f8cd7a4 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -184,8 +184,18 @@ struct spi_device {
 	u8			chip_select;
 	u8			bits_per_word;
 	bool			rt;
-#define SPI_NO_TX	BIT(31)		/* No transmit wire */
-#define SPI_NO_RX	BIT(30)		/* No receive wire */
+#define SPI_NO_TX		BIT(31)		/* No transmit wire */
+#define SPI_NO_RX		BIT(30)		/* No receive wire */
+	/*
+	 * TPM specification defines flow control over SPI. Client device
+	 * can insert a wait state on MISO when address is transmitted by
+	 * controller on MOSI. Detecting the wait state in software is only
+	 * possible for full duplex controllers. For controllers that support
+	 * only half-duplex, the wait state detection needs to be implemented
+	 * in hardware. TPM devices would set this flag when hardware flow
+	 * control is expected from SPI controller.
+	 */
+#define SPI_TPM_HW_FLOW		BIT(29)		/* TPM HW flow control */
 	/*
 	 * All bits defined above should be covered by SPI_MODE_KERNEL_MASK.
 	 * The SPI_MODE_KERNEL_MASK has the SPI_MODE_USER_MASK counterpart,
@@ -195,7 +205,7 @@ struct spi_device {
 	 * These bits must not overlap. A static assert check should make sure of that.
 	 * If adding extra bits, make sure to decrease the bit index below as well.
 	 */
-#define SPI_MODE_KERNEL_MASK	(~(BIT(30) - 1))
+#define SPI_MODE_KERNEL_MASK	(~(BIT(29) - 1))
 	u32			mode;
 	int			irq;
 	void			*controller_state;
-- 
2.17.1


  reply	other threads:[~2023-04-21  9:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-21  9:13 [Patch V10 0/3] Tegra TPM driver with HW flow control Krishna Yarlagadda
2023-04-21  9:13 ` Krishna Yarlagadda [this message]
2023-04-21  9:13 ` [Patch V10 2/3] tpm_tis-spi: Add hardware wait polling Krishna Yarlagadda
2023-04-23 15:08   ` Jarkko Sakkinen
2023-04-24 11:56     ` Mark Brown
2023-04-24 13:11       ` Jarkko Sakkinen
2023-04-24 14:46       ` Thierry Reding
2023-04-24 15:18         ` Mark Brown
2023-04-24 15:31           ` Thierry Reding
2023-05-10 15:10             ` Krishna Yarlagadda
2023-05-24 12:43               ` Krishna Yarlagadda
2023-06-01  8:29                 ` Thierry Reding
2023-06-01 11:04                   ` Mark Brown
2023-06-01 12:36                     ` Thierry Reding
2023-06-01 12:40                       ` Mark Brown
2023-06-09 14:19                         ` Jarkko Sakkinen
2023-06-09 14:22                           ` Mark Brown
2023-06-09 15:12                             ` Jarkko Sakkinen
2023-04-21  9:13 ` [Patch V10 3/3] spi: tegra210-quad: Enable TPM " Krishna Yarlagadda
2023-04-21  9:39   ` Jon Hunter
2023-04-21 12:50 ` [Patch V10 0/3] Tegra TPM driver with HW flow control Jerry Snitselaar
2023-04-24 13:21 ` (subset) " 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=20230421091309.2672-2-kyarlagadda@nvidia.com \
    --to=kyarlagadda@nvidia.com \
    --cc=broonie@kernel.org \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=jonathanh@nvidia.com \
    --cc=jsnitsel@redhat.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=ldewangan@nvidia.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=robh+dt@kernel.org \
    --cc=skomatineni@nvidia.com \
    --cc=thierry.reding@gmail.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

all inboxes | Powered by JetHome®