• Krishna Yarlagadda's avatar
    tpm_tis_spi: Add hardware wait polling · a86a42ac
    Krishna Yarlagadda authored
    TPM devices may insert wait state on last clock cycle of ADDR phase.
    For SPI controllers that support full-duplex transfers, this can be
    detected using software by reading the MISO line. For SPI controllers
    that only support half-duplex transfers, such as the Tegra QSPI, it is
    not possible to detect the wait signal from software. The QSPI
    controller in Tegra234 and Tegra241 implement hardware detection of the
    wait signal which can be enabled in the controller for TPM devices.
    
    The current TPM TIS driver only supports software detection of the wait
    signal. To support SPI controllers that use hardware to detect the wait
    signal, add the function tpm_tis_spi_transfer_half() and move the
    existing code for software based detection into a function called
    tpm_tis_spi_transfer_full(). SPI controllers that only support
    half-duplex transfers will always call tpm_tis_spi_transfer_half()
    because they cannot support software based detection. The bit
    SPI_TPM_HW_FLOW is set to indicate to the SPI controller that hardware
    detection is required and it is the responsibility of the SPI controller
    driver to determine if this is supported or not.
    
    For hardware flow control, CMD-ADDR-DATA messages are combined into a
    single message where as for software flow control exiting method of
    CMD-ADDR in a message and DATA in another is followed.
    
    [jarkko: Fixed the function names to match the code change, and the tag
    in the short summary.]
    Signed-off-by: default avatarKrishna Yarlagadda <kyarlagadda@nvidia.com>
    Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
    a86a42ac
tpm_tis_spi_main.c 9.04 KB