]> Git Repo - linux.git/commitdiff
spi: Add TPM HW flow flag
authorKrishna Yarlagadda <[email protected]>
Fri, 21 Apr 2023 09:13:07 +0000 (14:43 +0530)
committerMark Brown <[email protected]>
Fri, 21 Apr 2023 13:37:03 +0000 (14:37 +0100)
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]>
include/linux/spi/spi.h

index 873ced6ae4ca606fbd3936c9f30e5a55a697c652..cfe42f8cd7a4f6037b30dcdd50bf588b31368540 100644 (file)
@@ -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;
This page took 0.058738 seconds and 4 git commands to generate.