Skip to content

Commit 67a142d

Browse files
kkyarlagaddabroonie
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 <[email protected]> Reviewed-by: Jerry Snitselaar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent be3206e commit 67a142d

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
@@ -184,8 +184,18 @@ struct spi_device {
184184
u8 chip_select;
185185
u8 bits_per_word;
186186
bool rt;
187-
#define SPI_NO_TX BIT(31) /* No transmit wire */
188-
#define SPI_NO_RX BIT(30) /* No receive wire */
187+
#define SPI_NO_TX BIT(31) /* No transmit wire */
188+
#define SPI_NO_RX BIT(30) /* No receive wire */
189+
/*
190+
* TPM specification defines flow control over SPI. Client device
191+
* can insert a wait state on MISO when address is transmitted by
192+
* controller on MOSI. Detecting the wait state in software is only
193+
* possible for full duplex controllers. For controllers that support
194+
* only half-duplex, the wait state detection needs to be implemented
195+
* in hardware. TPM devices would set this flag when hardware flow
196+
* control is expected from SPI controller.
197+
*/
198+
#define SPI_TPM_HW_FLOW BIT(29) /* TPM HW flow control */
189199
/*
190200
* All bits defined above should be covered by SPI_MODE_KERNEL_MASK.
191201
* The SPI_MODE_KERNEL_MASK has the SPI_MODE_USER_MASK counterpart,
@@ -195,7 +205,7 @@ struct spi_device {
195205
* These bits must not overlap. A static assert check should make sure of that.
196206
* If adding extra bits, make sure to decrease the bit index below as well.
197207
*/
198-
#define SPI_MODE_KERNEL_MASK (~(BIT(30) - 1))
208+
#define SPI_MODE_KERNEL_MASK (~(BIT(29) - 1))
199209
u32 mode;
200210
int irq;
201211
void *controller_state;

0 commit comments

Comments
 (0)