Skip to content

Commit f076d8a

Browse files
kkyarlagaddajamieNguyenNVIDIA
authored andcommitted
spi: Add TPM HW flow flag
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> Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com> Link: https://lore.kernel.org/r/20230421091309.2672-2-kyarlagadda@nvidia.com Acked-by: Krishna Yarlagadda <kyarlagadda@nvidia.com> Acked-by: Jamie Nguyen <jamien@nvidia.com> (cherry picked from commit 67a142d) Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 5dd62c4 commit f076d8a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

include/linux/spi/spi.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,18 @@ struct spi_device {
181181
u8 chip_select;
182182
u8 bits_per_word;
183183
bool rt;
184-
#define SPI_NO_TX BIT(31) /* No transmit wire */
185-
#define SPI_NO_RX BIT(30) /* No receive wire */
184+
#define SPI_NO_TX BIT(31) /* No transmit wire */
185+
#define SPI_NO_RX BIT(30) /* No receive wire */
186+
/*
187+
* TPM specification defines flow control over SPI. Client device
188+
* can insert a wait state on MISO when address is transmitted by
189+
* controller on MOSI. Detecting the wait state in software is only
190+
* possible for full duplex controllers. For controllers that support
191+
* only half-duplex, the wait state detection needs to be implemented
192+
* in hardware. TPM devices would set this flag when hardware flow
193+
* control is expected from SPI controller.
194+
*/
195+
#define SPI_TPM_HW_FLOW BIT(29) /* TPM HW flow control */
186196
/*
187197
* All bits defined above should be covered by SPI_MODE_KERNEL_MASK.
188198
* The SPI_MODE_KERNEL_MASK has the SPI_MODE_USER_MASK counterpart,
@@ -192,7 +202,7 @@ struct spi_device {
192202
* These bits must not overlap. A static assert check should make sure of that.
193203
* If adding extra bits, make sure to decrease the bit index below as well.
194204
*/
195-
#define SPI_MODE_KERNEL_MASK (~(BIT(30) - 1))
205+
#define SPI_MODE_KERNEL_MASK (~(BIT(29) - 1))
196206
u32 mode;
197207
int irq;
198208
void *controller_state;

0 commit comments

Comments
 (0)