Move tpm_tis_i2c to tpm_tis_infineon and convert last tpm driver to use DM_TPM
Subsystems (2)
v2 cover Move tpm_tis_i2c to tpm_tis_infineon and convert last tpm driver to use DM_TPM
Hi Simon,
This patch serie move tpm_tis_i2c driver to tpm_tis_infineon. It also convert the latest tpm driver tpm_atmel_twi to DM_TPM.
Apologies again for the delay :(.
Best Regards
Christophe
Changes in v2:
- Change existing users of config to use renamed Kconfig
Christophe Ricard (4):
dm: tpm: Move tpm_tis_i2c to tpm_i2c_infineon
dm: tpm: Add Driver Model support for tpm_atmel_twi driver
dm: tpm: Remove every compilation switch for TPM driver model
dm: tpm: Every TPM drivers should depends on DM_TPM
README | 4 +-
common/cmd_tpm.c | 13 +---
configs/nyan-big_defconfig | 2 +-
configs/peach-pi_defconfig | 2 +-
configs/peach-pit_defconfig | 2 +-
configs/snow_defconfig | 2 +-
configs/spring_defconfig | 2 +-
drivers/tpm/Kconfig | 10 +--
drivers/tpm/Makefile | 2 +-
drivers/tpm/tpm_atmel_twi.c | 74 ++++++++++++++++-------
drivers/tpm/{tpm_tis_i2c.c => tpm_tis_infineon.c} | 5 +-
drivers/tpm/{tpm_tis_i2c.h => tpm_tis_infineon.h} | 0
include/tis.h | 60 ------------------
include/tpm.h | 6 --
lib/tpm.c | 20 +-----
15 files changed, 72 insertions(+), 132 deletions(-)
rename drivers/tpm/{tpm_tis_i2c.c => tpm_tis_infineon.c} (99%)
rename drivers/tpm/{tpm_tis_i2c.h => tpm_tis_infineon.h} (100%)
delete mode 100644 include/tis.hSignature · 1 line
2.1.4
PATCH v2 1/4 dm: tpm: Move tpm_tis_i2c to tpm_i2c_infineon
As there is no TCG specification or recommendation for i2c TPM 1.2, move tpm_tis_i2c driver to tpm_i2c_infineon. Other tpm vendors like Atmel or STMicroelectronics may have a different transport protocol for i2c.
---
Changes in v2:
- Change existing users of config to use renamed Kconfig
README | 4 ++--
configs/nyan-big_defconfig | 2 +-
configs/peach-pi_defconfig | 2 +-
configs/peach-pit_defconfig | 2 +-
configs/snow_defconfig | 2 +-
configs/spring_defconfig | 2 +-
drivers/tpm/Kconfig | 4 ++--
drivers/tpm/Makefile | 2 +-
drivers/tpm/{tpm_tis_i2c.c => tpm_tis_infineon.c} | 4 ++--
drivers/tpm/{tpm_tis_i2c.h => tpm_tis_infineon.h} | 0
10 files changed, 12 insertions(+), 12 deletions(-)
rename drivers/tpm/{tpm_tis_i2c.c => tpm_tis_infineon.c} (99%)
rename drivers/tpm/{tpm_tis_i2c.h => tpm_tis_infineon.h} (100%)README +2 -2
@@ -1490,8 +1490,8 @@ The following options need to be configured: CONFIG_TPM Support TPM devices. - CONFIG_TPM_TIS_I2C - Support for i2c bus TPM devices. Only one device + CONFIG_TPM_TIS_INFINEON + Support for Infineon i2c bus TPM devices. Only one device per system is supported at this time. CONFIG_TPM_TIS_I2C_BURST_LIMITATION
configs/nyan-big_defconfig +1 -1
@@ -18,7 +18,7 @@ CONFIG_CROS_EC=y CONFIG_CROS_EC_SPI=y CONFIG_CROS_EC_KEYB=y CONFIG_DM_TPM=y -CONFIG_TPM_TIS_I2C=y +CONFIG_TPM_TIS_INFINEON=y CONFIG_TEGRA114_SPI=y CONFIG_DISPLAY_PORT=y CONFIG_VIDEO_TEGRA124=y
configs/peach-pi_defconfig +1 -1
@@ -15,7 +15,7 @@ CONFIG_CROS_EC=y CONFIG_CROS_EC_SPI=y CONFIG_CROS_EC_KEYB=y CONFIG_DM_TPM=y -CONFIG_TPM_TIS_I2C=y +CONFIG_TPM_TIS_INFINEON=y CONFIG_DM_I2C=y CONFIG_DM_I2C_COMPAT=y CONFIG_I2C_CROS_EC_TUNNEL=y
configs/peach-pit_defconfig +1 -1
@@ -15,7 +15,7 @@ CONFIG_CROS_EC=y CONFIG_CROS_EC_SPI=y CONFIG_CROS_EC_KEYB=y CONFIG_DM_TPM=y -CONFIG_TPM_TIS_I2C=y +CONFIG_TPM_TIS_INFINEON=y CONFIG_DM_I2C=y CONFIG_DM_I2C_COMPAT=y CONFIG_I2C_CROS_EC_TUNNEL=y
configs/snow_defconfig +1 -1
@@ -20,7 +20,7 @@ CONFIG_DEBUG_UART_S5P=y CONFIG_DEBUG_UART_BASE=0x12c30000 CONFIG_DEBUG_UART_CLOCK=100000000 CONFIG_DM_TPM=y -CONFIG_TPM_TIS_I2C=y +CONFIG_TPM_TIS_INFINEON=y CONFIG_DM_I2C=y CONFIG_DM_I2C_COMPAT=y CONFIG_I2C_CROS_EC_LDO=y
configs/spring_defconfig +1 -1
@@ -20,7 +20,7 @@ CONFIG_DEBUG_UART_S5P=y CONFIG_DEBUG_UART_BASE=0x12c30000 CONFIG_DEBUG_UART_CLOCK=100000000 CONFIG_DM_TPM=y -CONFIG_TPM_TIS_I2C=y +CONFIG_TPM_TIS_INFINEON=y CONFIG_DM_I2C=y CONFIG_DM_I2C_COMPAT=y CONFIG_I2C_CROS_EC_LDO=y
drivers/tpm/Kconfig +2 -2
@@ -31,7 +31,7 @@ config TPM_ATMEL_TWI to the device using the standard TPM Interface Specification (TIS) protocol -config TPM_TIS_I2C +config TPM_TIS_INFINEON bool "Enable support for Infineon SLB9635/45 TPMs on I2C" depends on TPM && DM_I2C help
@@ -42,7 +42,7 @@ config TPM_TIS_I2C config TPM_TIS_I2C_BURST_LIMITATION bool "Enable I2C burst length limitation" - depends on TPM_TIS_I2C + depends on TPM_TIS_INFINEON help Some broken TPMs have a limitation on the number of bytes they can receive in one message. Enable this option to allow you to set this
drivers/tpm/Makefile +1 -1
@@ -6,6 +6,6 @@ obj-$(CONFIG_DM_TPM) += tpm-uclass.o obj-$(CONFIG_TPM_ATMEL_TWI) += tpm_atmel_twi.o -obj-$(CONFIG_TPM_TIS_I2C) += tpm_tis_i2c.o +obj-$(CONFIG_TPM_TIS_INFINEON) += tpm_tis_infineon.o obj-$(CONFIG_TPM_TIS_LPC) += tpm_tis_lpc.o obj-$(CONFIG_TPM_TIS_SANDBOX) += tpm_tis_sandbox.o
drivers/tpm/tpm_tis_infineon.c renamed from drivers/tpm/tpm_tis_i2c.c +2 -2
@@ -31,7 +31,7 @@#include <linux/types.h> #include <linux/unaligned/be_byteshift.h> -#include "tpm_tis_i2c.h" +#include "tpm_tis_infineon.h" #include "tpm_internal.h" DECLARE_GLOBAL_DATA_PTR ;
@@ -614,7 +614,7 @@ static const struct udevice_id tpm_tis_i2c_ids[] = { };U_BOOT_DRIVER (tpm_tis_i2c) = { - .name ="tpm_tis_i2c" , + .name ="tpm_tis_infineon" , .id =UCLASS_TPM , .of_match = tpm_tis_i2c_ids, .ops = &tpm_tis_i2c_ops,
drivers/tpm/tpm_tis_infineon.h renamed from drivers/tpm/tpm_tis_i2c.h +0 -0
Signature · 1 line
2.1.4
PATCH v2 1/4 dm: tpm: Move tpm_tis_i2c to tpm_i2c_infineon
Quoted 5 lines · Christophe Ricard
As there is no TCG specification or recommendation for i2c TPM 1.2, move
tpm_tis_i2cdriver totpm_i2c_infineon. Other tpm vendors like Atmel or STMicroelectronics may have a different transport protocol for i2c.Signed-off-by Christophe Ricard <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150916/9f5f578f/attachment.sig>
PATCH v2 2/4 dm: tpm: Add Driver Model support for tpm_atmel_twi driver
In reply to Christophe Ricardtpm_atmel_twi can fit perfectly to the new UCLASS_TPM class.
---
Changes in v2: None
drivers/tpm/Kconfig | 2 +- drivers/tpm/tpm_atmel_twi.c | 74 ++++++++++++++++++++++++++++++++------------- 2 files changed, 54 insertions(+), 22 deletions(-)
drivers/tpm/Kconfig +1 -1
@@ -24,7 +24,7 @@ config TPM_TIS_SANDBOX config TPM_ATMEL_TWI bool "Enable Atmel TWI TPM device driver" - depends on TPM + depends on TPM && DM_I2C help This driver supports an Atmel TPM device connected on the I2C bus. The usual tpm operations and the 'tpm' command can be used to talk
drivers/tpm/tpm_atmel_twi.c +53 -21
136 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v2 2/4 dm: tpm: Add Driver Model support for tpm_atmel_twi driver
Quoted 3 lines · Christophe Ricard
tpm_atmel_twican fit perfectly to the newUCLASS_TPMclass.Signed-off-by Christophe Ricard <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150916/2f13dd5c/attachment.sig>
PATCH v2 3/4 dm: tpm: Remove every compilation switch for TPM driver model
In reply to Christophe RicardAs every TPM drivers support UCLASS_TPM, we can only rely on DM_TPM functions.
This simplify a bit the code.
---
Changes in v2: None
common/cmd_tpm.c | 13 +-------- drivers/tpm/tpm_tis_infineon.c | 1 - include/tis.h | 60 ------------------------------------------ include/tpm.h | 6 ----- lib/tpm.c | 20 +++----------- 5 files changed, 4 insertions(+), 96 deletions(-) delete mode 100644 include/tis.h
common/cmd_tpm.c +1 -12
@@ -443,7 +443,6 @@ TPM_COMMAND_NO_ARG(tpm_force_clear) TPM_COMMAND_NO_ARG(tpm_physical_enable) TPM_COMMAND_NO_ARG(tpm_physical_disable) -#ifdef CONFIG_DM_TPM static int get_tpm(struct udevice **devp) { int rc;
@@ -476,11 +475,11 @@ static int do_tpm_info(cmd_tbl_t *cmdtp, int flag, int argc,return 0 ; } -#endif static int do_tpm_raw_transfer (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) { +struct udevice *dev;void *command;uint8_t response[1024 ];size_t count, response_length =sizeof (response);
@@ -492,17 +491,11 @@ static int do_tpm_raw_transfer(cmd_tbl_t *cmdtp, int flag,return CMD_RET_FAILURE ; } -#ifdef CONFIG_DM_TPM -struct udevice *dev; - rc =get_tpm (&dev);if (rc)return rc; rc =tpm_xfer (dev, command, count, response, &response_length); -#else - rc =tis_sendrecv (command, count, response, &response_length); -#endif free (command);if (!rc) {puts ("tpm response:\n" );
@@ -657,9 +650,7 @@ TPM_COMMAND_NO_ARG(tpm_end_oiap) U_BOOT_CMD_MKENT(cmd, 0, 1, do_tpm_ ## cmd, "", "")static cmd_tbl_t tpm_commands[] = { -#ifdef CONFIG_DM_TPMU_BOOT_CMD_MKENT (info,0 ,1 , do_tpm_info,"" ,"" ), -#endifU_BOOT_CMD_MKENT (init,0 ,1 , do_tpm_init,"" ,"" ), U_BOOT_CMD_MKENT(startup, 0, 1,
@@ -730,9 +721,7 @@ U_BOOT_CMD(tpm, CONFIG_SYS_MAXARGS, 1, do_tpm,"cmd args...\n" " - Issue TPM command <cmd> with arguments <args...>.\n" "Admin Startup and State Commands:\n" -#ifdef CONFIG_DM_TPM" info - Show information about the TPM\n" -#endif" init\n" " - Put TPM into a state where it waits for 'startup' command.\n" " startup mode\n"
drivers/tpm/tpm_tis_infineon.c +0 -1
@@ -24,7 +24,6 @@#include <dm.h> #include <fdtdec.h> #include <i2c.h> -#include <tis.h> #include <tpm.h> #include <asm-generic/errno.h> #include <linux/compiler.h>
include/tis.h deleted +0 -60
60 lines not on this page · raw message
include/tpm.h +0 -6
@@ -8,8 +8,6 @@#ifndef __TPM_H#define __TPM_H -#include <tis.h> -/* * Here is a partial implementation of TPM commands. Please consult TCG Main * Specification for definitions of TPM commands.
@@ -196,8 +194,6 @@ struct tpm_permanent_flags {u8 disable_full_da_logic_info; } __packed; -#ifdef CONFIG_DM_TPM -/* Max buffer size supported by our tpm */ #define TPM_DEV_BUFSIZE 1260
@@ -375,8 +371,6 @@ int tpm_get_desc(struct udevice *dev, char *buf, int size);int tpm_xfer (struct udevice *dev,const uint8_t *sendbuf,size_t send_size,uint8_t *recvbuf,size_t *recv_size); -#endif /* CONFIG_DM_TPM */ -/** * Initialize TPM device. It must be called before any TPM commands. *
lib/tpm.c +3 -17
@@ -7,7 +7,6 @@#include <common.h> #include <dm.h> -#include <tis.h> #include <tpm.h> #include <asm/unaligned.h> #include <u-boot/sha1.h>
@@ -230,6 +229,8 @@ static uint32_t tpm_return_code(const void *response)static uint32_t tpm_sendrecv_command (const void *command,void *response,size_t *size_ptr) { +struct udevice *dev; +int ret;uint8_t response_buffer[COMMAND_BUFFER_SIZE ];size_t response_length;uint32_t err;
@@ -240,19 +241,13 @@ static uint32_t tpm_sendrecv_command(const void *command, response = response_buffer; response_length =sizeof (response_buffer); } -#ifdef CONFIG_DM_TPM -struct udevice *dev; -int ret; ret =uclass_first_device (UCLASS_TPM , &dev);if (ret)return ret; err =tpm_xfer (dev, command,tpm_command_size (command), response, &response_length); -#else - err =tis_sendrecv (command,tpm_command_size (command), - response, &response_length); -#endif +if (err <0 )return TPM_LIB_ERROR ;if (size_ptr)
@@ -264,21 +259,12 @@ static uint32_t tpm_sendrecv_command(const void *command,int tpm_init (void ) {int err; - -#ifdef CONFIG_DM_TPM struct udevice *dev; err =uclass_first_device (UCLASS_TPM , &dev);if (err)return err;return tpm_open (dev); -#else - err =tis_init (); -if (err) -return err; - -return tis_open (); -#endif }uint32_t tpm_startup (enum tpm_startup_type mode)
Signature · 1 line
2.1.4
PATCH v2 3/4 dm: tpm: Remove every compilation switch for TPM driver model
Quoted 6 lines · Christophe Ricard
As every TPM drivers support
UCLASS_TPM, we can only rely onDM_TPMfunctions.This simplify a bit the code.
Signed-off-by Christophe Ricard <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150916/cc83450f/attachment.sig>
PATCH v2 4/4 dm: tpm: Every TPM drivers should depends on DM_TPM
In reply to Christophe RicardEvery TPM drivers should now depends on DM_TPM and not only TPM.
---
Changes in v2: None
drivers/tpm/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/tpm/Kconfig +3 -3
@@ -24,7 +24,7 @@ config TPM_TIS_SANDBOX config TPM_ATMEL_TWI bool "Enable Atmel TWI TPM device driver" - depends on TPM && DM_I2C + depends on DM_TPM && DM_I2C help This driver supports an Atmel TPM device connected on the I2C bus. The usual tpm operations and the 'tpm' command can be used to talk
@@ -33,7 +33,7 @@ config TPM_ATMEL_TWI config TPM_TIS_INFINEON bool "Enable support for Infineon SLB9635/45 TPMs on I2C" - depends on TPM && DM_I2C + depends on DM_TPM && DM_I2C help This driver supports Infineon TPM devices connected on the I2C bus. The usual tpm operations and the 'tpm' command can be used to talk
@@ -57,7 +57,7 @@ config TPM_TIS_I2C_BURST_LIMITATION_LEN config TPM_TIS_LPC bool "Enable support for Infineon SLB9635/45 TPMs on LPC" - depends on TPM && X86 + depends on DM_TPM && X86 help This driver supports Infineon TPM devices connected on the I2C bus. The usual tpm operations and the 'tpm' command can be used to talk
Signature · 1 line
2.1.4
PATCH v2 4/4 dm: tpm: Every TPM drivers should depends on DM_TPM
Quoted 3 lines · Christophe Ricard
Every TPM drivers should now depends on
DM_TPMand not only TPM.Signed-off-by Christophe Ricard <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150916/488ff80a/attachment.sig>