From c2b0f600a1707450ef985e28363893987f36fd8a Mon Sep 17 00:00:00 2001 From: Christophe Ricard Date: Tue, 6 Oct 2015 22:54:43 +0200 Subject: dm: tpm: Remove every compilation switch for TPM driver model 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 Reviewed-by: Tom Rini Acked-by: Simon Glass --- lib/tpm.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'lib') diff --git a/lib/tpm.c b/lib/tpm.c index 5d5f707e37..8a62216274 100644 --- a/lib/tpm.c +++ b/lib/tpm.c @@ -7,7 +7,6 @@ #include #include -#include #include #include #include @@ -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) -- cgit v1.2.1 From 2419cd16a1357a6d0f394b4631ea07b4f9e85ac7 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 3 Oct 2015 06:39:36 -0600 Subject: dm: tpm: Drop CONFIG_DM_TPM Now that all TPM drivers use driver model, we can drop the special driver model CONFIG option. Signed-off-by: Simon Glass Acked-by: Christophe Ricard --- lib/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/Kconfig b/lib/Kconfig index a8f8460d1d..30e84ed315 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -56,6 +56,7 @@ source lib/rsa/Kconfig config TPM bool "Trusted Platform Module (TPM) Support" + depends on DM help This enables support for TPMs which can be used to provide security features for your board. The TPM can be connected via LPC or I2C -- cgit v1.2.1 From 4ea5243a3a2fbc59bbcdd401d75f1744bcd6280f Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Fri, 2 Oct 2015 17:44:06 -0600 Subject: fdt: fix fdtdec_get_pci_addr() for CONFIG_PHYS_64BIT PCI addresses are always represented as 3 cells in DT. (one cell for bus and device, and two cells for a 64-bit addres). This does not vary based on either the physical address size of the CPU, nor any #address-cells property in DT (or more precisely, #address-cells must be set to 3 in any PCIe controller's node). Fix fdtdec_get_pci_addr() to use conversion functions that operate on (fixed) cell-sized data rather than (varying) physical-address-sized data, so that the function works on 64-bit systems. Signed-off-by: Stephen Warren Acked-by: Simon Glass Reviewed-by: Thierry Reding --- lib/fdtdec.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 1a86369934..9db033ae73 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -219,13 +219,13 @@ int fdtdec_get_pci_addr(const void *blob, int node, enum fdt_pci_space type, for (i = 0; i < num; i++) { debug("pci address #%d: %08lx %08lx %08lx\n", i, - (ulong)fdt_addr_to_cpu(cell[0]), - (ulong)fdt_addr_to_cpu(cell[1]), - (ulong)fdt_addr_to_cpu(cell[2])); - if ((fdt_addr_to_cpu(*cell) & type) == type) { - addr->phys_hi = fdt_addr_to_cpu(cell[0]); - addr->phys_mid = fdt_addr_to_cpu(cell[1]); - addr->phys_lo = fdt_addr_to_cpu(cell[2]); + (ulong)fdt32_to_cpu(cell[0]), + (ulong)fdt32_to_cpu(cell[1]), + (ulong)fdt32_to_cpu(cell[2])); + if ((fdt32_to_cpu(*cell) & type) == type) { + addr->phys_hi = fdt32_to_cpu(cell[0]); + addr->phys_mid = fdt32_to_cpu(cell[1]); + addr->phys_lo = fdt32_to_cpu(cell[1]); break; } else { cell += (FDT_PCI_ADDR_CELLS + -- cgit v1.2.1