linux/drivers/char/tpm/tpm_tis_spi_main.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2015 Infineon Technologies AG
 * Copyright (C) 2016 STMicroelectronics SAS
 *
 * Authors:
 * Peter Huewe <[email protected]>
 * Christophe Ricard <[email protected]>
 *
 * Maintained by: <[email protected]>
 *
 * Device driver for TCG/TCPA TPM (trusted platform module).
 * Specifications at www.trustedcomputinggroup.org
 *
 * This device driver implements the TPM interface as defined in
 * the TCG TPM Interface Spec version 1.3, revision 27 via _raw/native
 * SPI access_.
 *
 * It is based on the original tpm_tis device driver from Leendert van
 * Dorn and Kyleen Hall and Jarko Sakkinnen.
 */

#include <linux/acpi.h>
#include <linux/completion.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>

#include <linux/of.h>
#include <linux/spi/spi.h>
#include <linux/tpm.h>

#include "tpm.h"
#include "tpm_tis_core.h"
#include "tpm_tis_spi.h"

#define MAX_SPI_FRAMESIZE
#define SPI_HDRSIZE

/*
 * TCG SPI flow control is documented in section 6.4 of the spec[1]. In short,
 * keep trying to read from the device until MISO goes high indicating the
 * wait state has ended.
 *
 * [1] https://trustedcomputinggroup.org/resource/pc-client-platform-tpm-profile-ptp-specification/
 */
static int tpm_tis_spi_flow_control(struct tpm_tis_spi_phy *phy,
				    struct spi_transfer *spi_xfer)
{}

/*
 * Half duplex controller with support for TPM wait state detection like
 * Tegra QSPI need CMD, ADDR & DATA sent in single message to manage HW flow
 * control. Each phase sent in different transfer for controller to idenity
 * phase.
 */
static int tpm_tis_spi_transfer_half(struct tpm_tis_data *data,	u32 addr,
				     u16 len, u8 *in, const u8 *out)
{}

static int tpm_tis_spi_transfer_full(struct tpm_tis_data *data, u32 addr,
				     u16 len, u8 *in, const u8 *out)
{}

int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
			 u8 *in, const u8 *out)
{}

static int tpm_tis_spi_read_bytes(struct tpm_tis_data *data, u32 addr,
				  u16 len, u8 *result, enum tpm_tis_io_mode io_mode)
{}

static int tpm_tis_spi_write_bytes(struct tpm_tis_data *data, u32 addr,
				   u16 len, const u8 *value, enum tpm_tis_io_mode io_mode)
{}

int tpm_tis_spi_init(struct spi_device *spi, struct tpm_tis_spi_phy *phy,
		     int irq, const struct tpm_tis_phy_ops *phy_ops)
{}

static const struct tpm_tis_phy_ops tpm_spi_phy_ops =;

static int tpm_tis_spi_probe(struct spi_device *dev)
{}

tpm_tis_spi_probe_func;

static int tpm_tis_spi_driver_probe(struct spi_device *spi)
{}

static SIMPLE_DEV_PM_OPS(tpm_tis_pm, tpm_pm_suspend, tpm_tis_spi_resume);

static void tpm_tis_spi_remove(struct spi_device *dev)
{}

static const struct spi_device_id tpm_tis_spi_id[] =;
MODULE_DEVICE_TABLE(spi, tpm_tis_spi_id);

static const struct of_device_id of_tis_spi_match[] __maybe_unused =;
MODULE_DEVICE_TABLE(of, of_tis_spi_match);

static const struct acpi_device_id acpi_tis_spi_match[] __maybe_unused =;
MODULE_DEVICE_TABLE(acpi, acpi_tis_spi_match);

static struct spi_driver tpm_tis_spi_driver =;
module_spi_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();