Browse Source

Platform/Secure96Dxe: redefine LS connector CS as platform property

As opposed to the Secure96's I2C peripherals, whose bus addresses are
properties of the peripherals themselves, the SPI CS address of the
TPM is a property of the platform that incorporates the LS connector.

So tweak the macros that emit the CS values and related properties
to put it under the control of the platform that incorporates the
driver.

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Ard Biesheuvel 5 years ago
parent
commit
d41b7a935d

+ 1 - 1
Platform/96Boards/Secure96Dxe/Secure96.dts

@@ -39,7 +39,7 @@
         __overlay__ {
             INFINEON_SLB9670_DT_NODENAME {
                 compatible = "infineon,slb9670";
-                reg = <INFINEON_SLB9670_SPI_CS>;
+                reg = <SECURE96_SPI0_CS>;
                 spi-max-frequency = <22500000>;
             };
         };

+ 8 - 3
Platform/96Boards/Secure96Dxe/Secure96.h

@@ -1,10 +1,12 @@
 /** @file
 
-  Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>
+  Copyright (c) 2018-2019, Linaro, Ltd. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
+#include <Base.h>
+
 #ifndef _SECURE96_H_
 #define _SECURE96_H_
 
@@ -14,8 +16,11 @@
 #define ATECC508A_SLAVE_ADDRESS         0x51
 #define ATECC508A_DT_NODENAME           atecc508a@51
 
-#define INFINEON_SLB9670_SPI_CS         0x0
-#define INFINEON_SLB9670_DT_NODENAME    tpm@0
+#define INFINEON_SLB9670_DT_NODENAME    __CONCATENATE(tpm@,SECURE96_SPI0_CS)
+
+#ifndef SECURE96_SPI0_CS
+#define SECURE96_SPI0_CS                0
+#endif
 
 #ifndef SECURE96_ACPI_GPIO
 #define SECURE96_ACPI_GPIO              "\\_SB.GPIO"