public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 0/4] Move tpm_tis_i2c to tpm_tis_infineon and convert last tpm driver to use DM_TPM
@ 2015-09-20 20:00 Christophe Ricard
  2015-09-20 20:00 ` [U-Boot] [PATCH v3 1/4] dm: tpm: Move tpm_tis_i2c to tpm_i2c_infineon Christophe Ricard
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Christophe Ricard @ 2015-09-20 20:00 UTC (permalink / raw)
  To: u-boot

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.

In this version i am only adding mention to Tom Rini review

Best Regards
Christophe

Changes in v3:
- Adding mention to Tom Rini review

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.h

-- 
2.1.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v3 1/4] dm: tpm: Move tpm_tis_i2c to tpm_i2c_infineon
  2015-09-20 20:00 [U-Boot] [PATCH v3 0/4] Move tpm_tis_i2c to tpm_tis_infineon and convert last tpm driver to use DM_TPM Christophe Ricard
@ 2015-09-20 20:00 ` Christophe Ricard
  2015-10-03 14:27   ` Simon Glass
  2015-09-20 20:00 ` [U-Boot] [PATCH v3 2/4] dm: tpm: Add Driver Model support for tpm_atmel_twi driver Christophe Ricard
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Christophe Ricard @ 2015-09-20 20:00 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
---

Changes in v3:
- Adding mention to Tom Rini review

 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%)

diff --git a/README b/README
index 1acc355..f8fb46a 100644
--- a/README
+++ b/README
@@ -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
diff --git a/configs/nyan-big_defconfig b/configs/nyan-big_defconfig
index 6464c37..04c6a21 100644
--- a/configs/nyan-big_defconfig
+++ b/configs/nyan-big_defconfig
@@ -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
diff --git a/configs/peach-pi_defconfig b/configs/peach-pi_defconfig
index 56a5185..1a0837e 100644
--- a/configs/peach-pi_defconfig
+++ b/configs/peach-pi_defconfig
@@ -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
diff --git a/configs/peach-pit_defconfig b/configs/peach-pit_defconfig
index 1934bf3..6567226 100644
--- a/configs/peach-pit_defconfig
+++ b/configs/peach-pit_defconfig
@@ -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
diff --git a/configs/snow_defconfig b/configs/snow_defconfig
index 32c7c5d..583a838 100644
--- a/configs/snow_defconfig
+++ b/configs/snow_defconfig
@@ -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
diff --git a/configs/spring_defconfig b/configs/spring_defconfig
index b20bfed..112afa1 100644
--- a/configs/spring_defconfig
+++ b/configs/spring_defconfig
@@ -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
diff --git a/drivers/tpm/Kconfig b/drivers/tpm/Kconfig
index 6bc8fdd..dacb847 100644
--- a/drivers/tpm/Kconfig
+++ b/drivers/tpm/Kconfig
@@ -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
diff --git a/drivers/tpm/Makefile b/drivers/tpm/Makefile
index 0d328f8..5748145 100644
--- a/drivers/tpm/Makefile
+++ b/drivers/tpm/Makefile
@@ -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
diff --git a/drivers/tpm/tpm_tis_i2c.c b/drivers/tpm/tpm_tis_infineon.c
similarity index 99%
rename from drivers/tpm/tpm_tis_i2c.c
rename to drivers/tpm/tpm_tis_infineon.c
index 9afe46c..88eb786 100644
--- a/drivers/tpm/tpm_tis_i2c.c
+++ b/drivers/tpm/tpm_tis_infineon.c
@@ -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,
diff --git a/drivers/tpm/tpm_tis_i2c.h b/drivers/tpm/tpm_tis_infineon.h
similarity index 100%
rename from drivers/tpm/tpm_tis_i2c.h
rename to drivers/tpm/tpm_tis_infineon.h
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v3 2/4] dm: tpm: Add Driver Model support for tpm_atmel_twi driver
  2015-09-20 20:00 [U-Boot] [PATCH v3 0/4] Move tpm_tis_i2c to tpm_tis_infineon and convert last tpm driver to use DM_TPM Christophe Ricard
  2015-09-20 20:00 ` [U-Boot] [PATCH v3 1/4] dm: tpm: Move tpm_tis_i2c to tpm_i2c_infineon Christophe Ricard
@ 2015-09-20 20:00 ` Christophe Ricard
  2015-10-03 14:27   ` Simon Glass
  2015-09-20 20:00 ` [U-Boot] [PATCH v3 3/4] dm: tpm: Remove every compilation switch for TPM driver model Christophe Ricard
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Christophe Ricard @ 2015-09-20 20:00 UTC (permalink / raw)
  To: u-boot

tpm_atmel_twi can fit perfectly to the new UCLASS_TPM class.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
---

Changes in v3: None

 drivers/tpm/Kconfig         |  2 +-
 drivers/tpm/tpm_atmel_twi.c | 74 ++++++++++++++++++++++++++++++++-------------
 2 files changed, 54 insertions(+), 22 deletions(-)

diff --git a/drivers/tpm/Kconfig b/drivers/tpm/Kconfig
index dacb847..ff2cdbe 100644
--- a/drivers/tpm/Kconfig
+++ b/drivers/tpm/Kconfig
@@ -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
diff --git a/drivers/tpm/tpm_atmel_twi.c b/drivers/tpm/tpm_atmel_twi.c
index 205d7a5..361291d 100644
--- a/drivers/tpm/tpm_atmel_twi.c
+++ b/drivers/tpm/tpm_atmel_twi.c
@@ -7,51 +7,56 @@
  */
 
 #include <common.h>
+#include <dm.h>
 #include <tpm.h>
 #include <i2c.h>
 #include <asm/unaligned.h>
 
+#include "tpm_internal.h"
+
 #define ATMEL_TPM_TIMEOUT_MS 5000 /* sufficient for anything but
 				     generating/exporting keys */
 
 /*
- * tis_init()
- *
- * Initialize the TPM device. Returns 0 on success or -1 on
- * failure (in case device probing did not succeed).
- */
-int tis_init(void)
-{
-	return 0;
-}
-
-/*
- * tis_open()
+ * tpm_atmel_twi_open()
  *
  * Requests access to locality 0 for the caller. After all commands have been
  * completed the caller is supposed to call tis_close().
  *
  * Returns 0 on success, -1 on failure.
  */
-int tis_open(void)
+static int tpm_atmel_twi_open(struct udevice *dev)
 {
 	return 0;
 }
 
 /*
- * tis_close()
+ * tpm_atmel_twi_close()
  *
  * terminate the currect session with the TPM by releasing the locked
  * locality. Returns 0 on success of -1 on failure (in case lock
  * removal did not succeed).
  */
-int tis_close(void)
+static int tpm_atmel_twi_close(struct udevice *dev)
+{
+	return 0;
+}
+
+/*
+ * tpm_atmel_twi_get_desc()
+ *
+ * @dev:        Device to check
+ * @buf:        Buffer to put the string
+ * @size:       Maximum size of buffer
+ * @return length of string, or -ENOSPC it no space
+ */
+static int tpm_atmel_twi_get_desc(struct udevice *dev, char *buf, int size)
 {
 	return 0;
 }
 
 /*
- * tis_sendrecv()
+ * tpm_atmel_twi_xfer()
  *
  * Send the requested data to the TPM and then try to get its response
  *
@@ -63,8 +68,9 @@ int tis_close(void)
  * Returns 0 on success (and places the number of response bytes at recv_len)
  * or -1 on failure.
  */
-int tis_sendrecv(const uint8_t *sendbuf, size_t send_size, uint8_t *recvbuf,
-			size_t *recv_len)
+static int tpm_atmel_twi_xfer(struct udevice *dev,
+			      const uint8_t *sendbuf, size_t send_size,
+			      uint8_t *recvbuf, size_t *recv_len)
 {
 	int res;
 	unsigned long start;
@@ -75,14 +81,15 @@ int tis_sendrecv(const uint8_t *sendbuf, size_t send_size, uint8_t *recvbuf,
 	print_buffer(0, (void *)sendbuf, 1, send_size, 0);
 #endif
 
-	res = i2c_write(0x29, 0, 0, (uchar *)sendbuf, send_size);
+	res = dm_i2c_write(dev, 0, (uchar *)sendbuf, send_size);
 	if (res) {
 		printf("i2c_write returned %d\n", res);
 		return -1;
 	}
 
 	start = get_timer(0);
-	while ((res = i2c_read(0x29, 0, 0, recvbuf, 10))) {
+	while ((res = dm_i2c_read(dev, 0, recvbuf, TPM_HEADER_SIZE))) {
+		/* TODO Use TIS_TIMEOUT from tpm_tis_infineon.h */
 		if (get_timer(start) > ATMEL_TPM_TIMEOUT_MS) {
 			puts("tpm timed out\n");
 			return -1;
@@ -92,7 +99,7 @@ int tis_sendrecv(const uint8_t *sendbuf, size_t send_size, uint8_t *recvbuf,
 	if (!res) {
 		*recv_len = get_unaligned_be32(recvbuf + 2);
 		if (*recv_len > 10)
-			res = i2c_read(0x29, 0, 0, recvbuf, *recv_len);
+			res = dm_i2c_read(dev, 0, recvbuf, *recv_len);
 	}
 	if (res) {
 		printf("i2c_read returned %d (rlen=%d)\n", res, *recv_len);
@@ -110,3 +117,28 @@ int tis_sendrecv(const uint8_t *sendbuf, size_t send_size, uint8_t *recvbuf,
 
 	return res;
 }
+
+static int tpm_atmel_twi_probe(struct udevice *dev)
+{
+	return 0;
+}
+
+static const struct udevice_id tpm_atmel_twi_ids[] = {
+	{ .compatible = "atmel,at97sc3204t"},
+	{ }
+};
+
+static const struct tpm_ops tpm_atmel_twi_ops = {
+	.open = tpm_atmel_twi_open,
+	.close = tpm_atmel_twi_close,
+	.xfer = tpm_atmel_twi_xfer,
+	.get_desc = tpm_atmel_twi_get_desc,
+};
+
+U_BOOT_DRIVER(tpm_atmel_twi) = {
+	.name = "tpm_atmel_twi",
+	.id = UCLASS_TPM,
+	.of_match = tpm_atmel_twi_ids,
+	.ops = &tpm_atmel_twi_ops,
+	.probe = tpm_atmel_twi_probe,
+};
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v3 3/4] dm: tpm: Remove every compilation switch for TPM driver model
  2015-09-20 20:00 [U-Boot] [PATCH v3 0/4] Move tpm_tis_i2c to tpm_tis_infineon and convert last tpm driver to use DM_TPM Christophe Ricard
  2015-09-20 20:00 ` [U-Boot] [PATCH v3 1/4] dm: tpm: Move tpm_tis_i2c to tpm_i2c_infineon Christophe Ricard
  2015-09-20 20:00 ` [U-Boot] [PATCH v3 2/4] dm: tpm: Add Driver Model support for tpm_atmel_twi driver Christophe Ricard
@ 2015-09-20 20:00 ` Christophe Ricard
  2015-10-03 14:27   ` Simon Glass
  2015-09-20 20:00 ` [U-Boot] [PATCH v3 4/4] dm: tpm: Every TPM drivers should depends on DM_TPM Christophe Ricard
  2015-09-27 20:11 ` [U-Boot] [PATCH v3 0/4] Move tpm_tis_i2c to tpm_tis_infineon and convert last tpm driver to use DM_TPM Christophe Ricard
  4 siblings, 1 reply; 15+ messages in thread
From: Christophe Ricard @ 2015-09-20 20:00 UTC (permalink / raw)
  To: u-boot

As every TPM drivers support UCLASS_TPM, we can only rely on DM_TPM
functions.

This simplify a bit the code.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
---

Changes in v3: 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

diff --git a/common/cmd_tpm.c b/common/cmd_tpm.c
index 97501cc..add6bfb 100644
--- a/common/cmd_tpm.c
+++ b/common/cmd_tpm.c
@@ -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_TPM
 	U_BOOT_CMD_MKENT(info, 0, 1, do_tpm_info, "", ""),
-#endif
 	U_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"
diff --git a/drivers/tpm/tpm_tis_infineon.c b/drivers/tpm/tpm_tis_infineon.c
index 88eb786..f57c328 100644
--- a/drivers/tpm/tpm_tis_infineon.c
+++ b/drivers/tpm/tpm_tis_infineon.c
@@ -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>
diff --git a/include/tis.h b/include/tis.h
deleted file mode 100644
index 1985d9e..0000000
--- a/include/tis.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2011 The Chromium OS Authors.
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#ifndef __TIS_H
-#define __TIS_H
-
-#ifndef CONFIG_DM_TPM
-
-#include <common.h>
-
-/* Low-level interface to access TPM */
-
-/*
- * tis_init()
- *
- * Initialize the TPM device. Returns 0 on success or -1 on
- * failure (in case device probing did not succeed).
- */
-int tis_init(void);
-
-/*
- * tis_open()
- *
- * Requests access to locality 0 for the caller. After all commands have been
- * completed the caller is supposed to call tis_close().
- *
- * Returns 0 on success, -1 on failure.
- */
-int tis_open(void);
-
-/*
- * tis_close()
- *
- * terminate the currect session with the TPM by releasing the locked
- * locality. Returns 0 on success of -1 on failure (in case lock
- * removal did not succeed).
- */
-int tis_close(void);
-
-/*
- * tis_sendrecv()
- *
- * Send the requested data to the TPM and then try to get its response
- *
- * @sendbuf - buffer of the data to send
- * @send_size size of the data to send
- * @recvbuf - memory to save the response to
- * @recv_len - pointer to the size of the response buffer
- *
- * Returns 0 on success (and places the number of response bytes at recv_len)
- * or -1 on failure.
- */
-int tis_sendrecv(const uint8_t *sendbuf, size_t send_size, uint8_t *recvbuf,
-			size_t *recv_len);
-#endif
-
-#endif /* __TIS_H */
diff --git a/include/tpm.h b/include/tpm.h
index 086b672..9a6585d 100644
--- a/include/tpm.h
+++ b/include/tpm.h
@@ -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.
  *
diff --git a/lib/tpm.c b/lib/tpm.c
index 5d5f707..8a62216 100644
--- a/lib/tpm.c
+++ b/lib/tpm.c
@@ -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)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v3 4/4] dm: tpm: Every TPM drivers should depends on DM_TPM
  2015-09-20 20:00 [U-Boot] [PATCH v3 0/4] Move tpm_tis_i2c to tpm_tis_infineon and convert last tpm driver to use DM_TPM Christophe Ricard
                   ` (2 preceding siblings ...)
  2015-09-20 20:00 ` [U-Boot] [PATCH v3 3/4] dm: tpm: Remove every compilation switch for TPM driver model Christophe Ricard
@ 2015-09-20 20:00 ` Christophe Ricard
  2015-10-03 14:27   ` Simon Glass
  2015-09-27 20:11 ` [U-Boot] [PATCH v3 0/4] Move tpm_tis_i2c to tpm_tis_infineon and convert last tpm driver to use DM_TPM Christophe Ricard
  4 siblings, 1 reply; 15+ messages in thread
From: Christophe Ricard @ 2015-09-20 20:00 UTC (permalink / raw)
  To: u-boot

Every TPM drivers should now depends on DM_TPM and not only TPM.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
---

Changes in v3: None

 drivers/tpm/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tpm/Kconfig b/drivers/tpm/Kconfig
index ff2cdbe..3ab652c 100644
--- a/drivers/tpm/Kconfig
+++ b/drivers/tpm/Kconfig
@@ -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
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v3 0/4] Move tpm_tis_i2c to tpm_tis_infineon and convert last tpm driver to use DM_TPM
  2015-09-20 20:00 [U-Boot] [PATCH v3 0/4] Move tpm_tis_i2c to tpm_tis_infineon and convert last tpm driver to use DM_TPM Christophe Ricard
                   ` (3 preceding siblings ...)
  2015-09-20 20:00 ` [U-Boot] [PATCH v3 4/4] dm: tpm: Every TPM drivers should depends on DM_TPM Christophe Ricard
@ 2015-09-27 20:11 ` Christophe Ricard
  2015-09-28 13:32   ` Simon Glass
  4 siblings, 1 reply; 15+ messages in thread
From: Christophe Ricard @ 2015-09-27 20:11 UTC (permalink / raw)
  To: u-boot

Hi Simon,

Any news on this patch serie ?

Best Regards
Christophe

On 20/09/2015 22:00, Christophe Ricard wrote:
> 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.
>
> In this version i am only adding mention to Tom Rini review
>
> Best Regards
> Christophe
>
> Changes in v3:
> - Adding mention to Tom Rini review
>
> 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.h
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v3 0/4] Move tpm_tis_i2c to tpm_tis_infineon and convert last tpm driver to use DM_TPM
  2015-09-27 20:11 ` [U-Boot] [PATCH v3 0/4] Move tpm_tis_i2c to tpm_tis_infineon and convert last tpm driver to use DM_TPM Christophe Ricard
@ 2015-09-28 13:32   ` Simon Glass
  0 siblings, 0 replies; 15+ messages in thread
From: Simon Glass @ 2015-09-28 13:32 UTC (permalink / raw)
  To: u-boot

Hi Christophe,

On 27 September 2015 at 14:11, Christophe Ricard
<christophe.ricard@gmail.com> wrote:
> Hi Simon,
>
> Any news on this patch serie ?
>

I think we need to wait until the merge window opens in a few weeks to apply it.

> Best Regards
> Christophe
>
>
> On 20/09/2015 22:00, Christophe Ricard wrote:
>>
>> 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.
>>
>> In this version i am only adding mention to Tom Rini review
>>
>> Best Regards
>> Christophe
>>
>> Changes in v3:
>> - Adding mention to Tom Rini review
>>
>> 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.h
>>
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v3 1/4] dm: tpm: Move tpm_tis_i2c to tpm_i2c_infineon
  2015-09-20 20:00 ` [U-Boot] [PATCH v3 1/4] dm: tpm: Move tpm_tis_i2c to tpm_i2c_infineon Christophe Ricard
@ 2015-10-03 14:27   ` Simon Glass
  0 siblings, 0 replies; 15+ messages in thread
From: Simon Glass @ 2015-10-03 14:27 UTC (permalink / raw)
  To: u-boot

On 20 September 2015 at 21:00, Christophe Ricard
<christophe.ricard@gmail.com> wrote:
> 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.
>
> Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> ---
>
> Changes in v3:
> - Adding mention to Tom Rini review
>
>  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%)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v3 2/4] dm: tpm: Add Driver Model support for tpm_atmel_twi driver
  2015-09-20 20:00 ` [U-Boot] [PATCH v3 2/4] dm: tpm: Add Driver Model support for tpm_atmel_twi driver Christophe Ricard
@ 2015-10-03 14:27   ` Simon Glass
  2015-10-04 16:25     ` Simon Glass
  0 siblings, 1 reply; 15+ messages in thread
From: Simon Glass @ 2015-10-03 14:27 UTC (permalink / raw)
  To: u-boot

On 20 September 2015 at 21:00, Christophe Ricard
<christophe.ricard@gmail.com> wrote:
> tpm_atmel_twi can fit perfectly to the new UCLASS_TPM class.
>
> Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> ---
>
> Changes in v3: None
>
>  drivers/tpm/Kconfig         |  2 +-
>  drivers/tpm/tpm_atmel_twi.c | 74 ++++++++++++++++++++++++++++++++-------------
>  2 files changed, 54 insertions(+), 22 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v3 3/4] dm: tpm: Remove every compilation switch for TPM driver model
  2015-09-20 20:00 ` [U-Boot] [PATCH v3 3/4] dm: tpm: Remove every compilation switch for TPM driver model Christophe Ricard
@ 2015-10-03 14:27   ` Simon Glass
  2015-10-04 16:25     ` Simon Glass
  0 siblings, 1 reply; 15+ messages in thread
From: Simon Glass @ 2015-10-03 14:27 UTC (permalink / raw)
  To: u-boot

On 20 September 2015 at 21:00, Christophe Ricard
<christophe.ricard@gmail.com> wrote:
> As every TPM drivers support UCLASS_TPM, we can only rely on DM_TPM
> functions.
>
> This simplify a bit the code.
>
> Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> ---
>
> Changes in v3: 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

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v3 4/4] dm: tpm: Every TPM drivers should depends on DM_TPM
  2015-09-20 20:00 ` [U-Boot] [PATCH v3 4/4] dm: tpm: Every TPM drivers should depends on DM_TPM Christophe Ricard
@ 2015-10-03 14:27   ` Simon Glass
  0 siblings, 0 replies; 15+ messages in thread
From: Simon Glass @ 2015-10-03 14:27 UTC (permalink / raw)
  To: u-boot

On 20 September 2015 at 21:00, Christophe Ricard
<christophe.ricard@gmail.com> wrote:
> Every TPM drivers should now depends on DM_TPM and not only TPM.
>
> Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> ---
>
> Changes in v3: None
>
>  drivers/tpm/Kconfig | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v3 3/4] dm: tpm: Remove every compilation switch for TPM driver model
  2015-10-03 14:27   ` Simon Glass
@ 2015-10-04 16:25     ` Simon Glass
  0 siblings, 0 replies; 15+ messages in thread
From: Simon Glass @ 2015-10-04 16:25 UTC (permalink / raw)
  To: u-boot

Hi Christophe,

On 3 October 2015 at 15:27, Simon Glass <sjg@chromium.org> wrote:
> On 20 September 2015 at 21:00, Christophe Ricard
> <christophe.ricard@gmail.com> wrote:
>> As every TPM drivers support UCLASS_TPM, we can only rely on DM_TPM
>> functions.
>>
>> This simplify a bit the code.
>>
>> Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
>> Reviewed-by: Tom Rini <trini@konsulko.com>
>> ---
>>
>> Changes in v3: 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
>
> Acked-by: Simon Glass <sjg@chromium.org>

I get errors with this patch:

04: dm: tpm: Remove every compilation switch for TPM driver model
       x86:  +   coreboot-x86 chromebook_link chromebox_panther
-build/../common/cmd_tpm.c:504: undefined reference to `tis_sendrecv'
-build/../lib/tpm.c:253: undefined reference to `tis_sendrecv'
-build/../lib/tpm.c:276: undefined reference to `tis_init'
-build/../lib/tpm.c:280: undefined reference to `tis_open'
+common/built-in.o: In function `get_tpm':
+build/../common/cmd_tpm.c:450: undefined reference to `uclass_first_device'
+common/built-in.o: In function `do_tpm_info':
+build/../common/cmd_tpm.c:469: undefined reference to `tpm_get_desc'
+build/../common/cmd_tpm.c:498: undefined reference to `tpm_xfer'
+build/../lib/tpm.c:245: undefined reference to `uclass_first_device'
+build/../lib/tpm.c:248: undefined reference to `tpm_xfer'
+build/../lib/tpm.c:264: undefined reference to `uclass_first_device'
+build/../lib/tpm.c:267: undefined reference to `tpm_open'
+../drivers/tpm/tpm_tis_lpc.c:19:17: fatal error: tis.h: No such file
or directory
+ #include <tis.h>
+compilation terminated.
+make[3]: *** [drivers/tpm/tpm_tis_lpc.o] Error 1
+make[2]: *** [drivers/tpm] Error 2
+make[1]: *** [drivers] Error 2

Regards,
Simon

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v3 2/4] dm: tpm: Add Driver Model support for tpm_atmel_twi driver
  2015-10-03 14:27   ` Simon Glass
@ 2015-10-04 16:25     ` Simon Glass
  2015-10-06 15:18       ` Christophe Ricard
  0 siblings, 1 reply; 15+ messages in thread
From: Simon Glass @ 2015-10-04 16:25 UTC (permalink / raw)
  To: u-boot

Hi Christophe,

On 3 October 2015 at 15:27, Simon Glass <sjg@chromium.org> wrote:
> On 20 September 2015 at 21:00, Christophe Ricard
> <christophe.ricard@gmail.com> wrote:
>> tpm_atmel_twi can fit perfectly to the new UCLASS_TPM class.
>>
>> Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
>> Reviewed-by: Tom Rini <trini@konsulko.com>
>> ---
>>
>> Changes in v3: None
>>
>>  drivers/tpm/Kconfig         |  2 +-
>>  drivers/tpm/tpm_atmel_twi.c | 74 ++++++++++++++++++++++++++++++++-------------
>>  2 files changed, 54 insertions(+), 22 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

I get errors with this patch:

03: dm: tpm: Add Driver Model support for tpm_atmel_twi driver
   powerpc:  +   controlcenterd_36BIT_SDCARD
controlcenterd_36BIT_SDCARD_DEVELOP controlcenterd_TRAILBLAZER
controlcenterd_TRAILBLAZER_DEVELOP
+common/built-in.o: In function `do_tpm_raw_transfer':
+build/../common/cmd_tpm.c:504: undefined reference to `tis_sendrecv'
+lib/built-in.o: In function `tpm_sendrecv_command':
+build/../lib/tpm.c:253: undefined reference to `tis_sendrecv'
+lib/built-in.o: In function `tpm_init':
+build/../lib/tpm.c:276: undefined reference to `tis_init'
+build/../lib/tpm.c:280: undefined reference to `tis_open'

Regards,
Simon

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v3 2/4] dm: tpm: Add Driver Model support for tpm_atmel_twi driver
  2015-10-04 16:25     ` Simon Glass
@ 2015-10-06 15:18       ` Christophe Ricard
  2015-10-06 15:21         ` Simon Glass
  0 siblings, 1 reply; 15+ messages in thread
From: Christophe Ricard @ 2015-10-06 15:18 UTC (permalink / raw)
  To: u-boot

Hi Simon,

This error is coming from the fact that no driver model is available for
powerpc and the config file mention in the error log
(controlcenterd_36BIT_SDCARD, controlcenterd_36BIT_SDCARD_DEVELOP,
controlcenterd_TRAILBLAZER, controlcenterd_TRAILBLAZER_DEVELOP).

Do you think converting atmel driver to dm_tpm without dm_i2c dependency is
acceptable as a first step ? It would help to clean the TPM driver model.

Do you think it make sense to convert powerpc i2c driver to i2c_dm ?

Best Regards
Christophe

2015-10-04 18:25 GMT+02:00 Simon Glass <sjg@chromium.org>:

> Hi Christophe,
>
> On 3 October 2015 at 15:27, Simon Glass <sjg@chromium.org> wrote:
> > On 20 September 2015 at 21:00, Christophe Ricard
> > <christophe.ricard@gmail.com> wrote:
> >> tpm_atmel_twi can fit perfectly to the new UCLASS_TPM class.
> >>
> >> Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
> >> Reviewed-by: Tom Rini <trini@konsulko.com>
> >> ---
> >>
> >> Changes in v3: None
> >>
> >>  drivers/tpm/Kconfig         |  2 +-
> >>  drivers/tpm/tpm_atmel_twi.c | 74
> ++++++++++++++++++++++++++++++++-------------
> >>  2 files changed, 54 insertions(+), 22 deletions(-)
> >
> > Acked-by: Simon Glass <sjg@chromium.org>
>
> I get errors with this patch:
>
> 03: dm: tpm: Add Driver Model support for tpm_atmel_twi driver
>    powerpc:  +   controlcenterd_36BIT_SDCARD
> controlcenterd_36BIT_SDCARD_DEVELOP controlcenterd_TRAILBLAZER
> controlcenterd_TRAILBLAZER_DEVELOP
> +common/built-in.o: In function `do_tpm_raw_transfer':
> +build/../common/cmd_tpm.c:504: undefined reference to `tis_sendrecv'
> +lib/built-in.o: In function `tpm_sendrecv_command':
> +build/../lib/tpm.c:253: undefined reference to `tis_sendrecv'
> +lib/built-in.o: In function `tpm_init':
> +build/../lib/tpm.c:276: undefined reference to `tis_init'
> +build/../lib/tpm.c:280: undefined reference to `tis_open'
>
> Regards,
> Simon
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v3 2/4] dm: tpm: Add Driver Model support for tpm_atmel_twi driver
  2015-10-06 15:18       ` Christophe Ricard
@ 2015-10-06 15:21         ` Simon Glass
  0 siblings, 0 replies; 15+ messages in thread
From: Simon Glass @ 2015-10-06 15:21 UTC (permalink / raw)
  To: u-boot

Hi Christophe,

On 6 October 2015 at 16:18, Christophe Ricard
<christophe.ricard@gmail.com> wrote:
> Hi Simon,
>
> This error is coming from the fact that no driver model is available for
> powerpc and the config file mention in the error log
> (controlcenterd_36BIT_SDCARD, controlcenterd_36BIT_SDCARD_DEVELOP,
> controlcenterd_TRAILBLAZER, controlcenterd_TRAILBLAZER_DEVELOP).
>
> Do you think converting atmel driver to dm_tpm without dm_i2c dependency is
> acceptable as a first step ? It would help to clean the TPM driver model.
>
> Do you think it make sense to convert powerpc i2c driver to i2c_dm ?

Yes that seems like the best idea.

Regards,
Simon

>
> Best Regards
> Christophe
>
> 2015-10-04 18:25 GMT+02:00 Simon Glass <sjg@chromium.org>:
>>
>> Hi Christophe,
>>
>> On 3 October 2015 at 15:27, Simon Glass <sjg@chromium.org> wrote:
>> > On 20 September 2015 at 21:00, Christophe Ricard
>> > <christophe.ricard@gmail.com> wrote:
>> >> tpm_atmel_twi can fit perfectly to the new UCLASS_TPM class.
>> >>
>> >> Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
>> >> Reviewed-by: Tom Rini <trini@konsulko.com>
>> >> ---
>> >>
>> >> Changes in v3: None
>> >>
>> >>  drivers/tpm/Kconfig         |  2 +-
>> >>  drivers/tpm/tpm_atmel_twi.c | 74
>> >> ++++++++++++++++++++++++++++++++-------------
>> >>  2 files changed, 54 insertions(+), 22 deletions(-)
>> >
>> > Acked-by: Simon Glass <sjg@chromium.org>
>>
>> I get errors with this patch:
>>
>> 03: dm: tpm: Add Driver Model support for tpm_atmel_twi driver
>>    powerpc:  +   controlcenterd_36BIT_SDCARD
>> controlcenterd_36BIT_SDCARD_DEVELOP controlcenterd_TRAILBLAZER
>> controlcenterd_TRAILBLAZER_DEVELOP
>> +common/built-in.o: In function `do_tpm_raw_transfer':
>> +build/../common/cmd_tpm.c:504: undefined reference to `tis_sendrecv'
>> +lib/built-in.o: In function `tpm_sendrecv_command':
>> +build/../lib/tpm.c:253: undefined reference to `tis_sendrecv'
>> +lib/built-in.o: In function `tpm_init':
>> +build/../lib/tpm.c:276: undefined reference to `tis_init'
>> +build/../lib/tpm.c:280: undefined reference to `tis_open'
>>
>> Regards,
>> Simon
>
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-10-06 15:21 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-20 20:00 [U-Boot] [PATCH v3 0/4] Move tpm_tis_i2c to tpm_tis_infineon and convert last tpm driver to use DM_TPM Christophe Ricard
2015-09-20 20:00 ` [U-Boot] [PATCH v3 1/4] dm: tpm: Move tpm_tis_i2c to tpm_i2c_infineon Christophe Ricard
2015-10-03 14:27   ` Simon Glass
2015-09-20 20:00 ` [U-Boot] [PATCH v3 2/4] dm: tpm: Add Driver Model support for tpm_atmel_twi driver Christophe Ricard
2015-10-03 14:27   ` Simon Glass
2015-10-04 16:25     ` Simon Glass
2015-10-06 15:18       ` Christophe Ricard
2015-10-06 15:21         ` Simon Glass
2015-09-20 20:00 ` [U-Boot] [PATCH v3 3/4] dm: tpm: Remove every compilation switch for TPM driver model Christophe Ricard
2015-10-03 14:27   ` Simon Glass
2015-10-04 16:25     ` Simon Glass
2015-09-20 20:00 ` [U-Boot] [PATCH v3 4/4] dm: tpm: Every TPM drivers should depends on DM_TPM Christophe Ricard
2015-10-03 14:27   ` Simon Glass
2015-09-27 20:11 ` [U-Boot] [PATCH v3 0/4] Move tpm_tis_i2c to tpm_tis_infineon and convert last tpm driver to use DM_TPM Christophe Ricard
2015-09-28 13:32   ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox