[edk2-devel] [PATCH edk2-platforms 3/5] Platform/Secure96Dxe: redefine LS connector CS as platform property

Ard Biesheuvel posted 5 patches 5 years, 6 months ago
[edk2-devel] [PATCH edk2-platforms 3/5] Platform/Secure96Dxe: redefine LS connector CS as platform property
Posted by Ard Biesheuvel 5 years, 6 months ago
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.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Platform/96Boards/Secure96Dxe/Secure96.dts |  2 +-
 Platform/96Boards/Secure96Dxe/Secure96.h   | 11 ++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/Platform/96Boards/Secure96Dxe/Secure96.dts b/Platform/96Boards/Secure96Dxe/Secure96.dts
index d066fcb1933c..0d7d9b3900a4 100644
--- a/Platform/96Boards/Secure96Dxe/Secure96.dts
+++ b/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>;
             };
         };
diff --git a/Platform/96Boards/Secure96Dxe/Secure96.h b/Platform/96Boards/Secure96Dxe/Secure96.h
index c34fc5eea046..1d8bf4159209 100644
--- a/Platform/96Boards/Secure96Dxe/Secure96.h
+++ b/Platform/96Boards/Secure96Dxe/Secure96.h
@@ -1,6 +1,6 @@
 /** @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
 **/
@@ -8,14 +8,19 @@
 #ifndef _SECURE96_H_
 #define _SECURE96_H_
 
+#define __CONCAT(a,b)                   a ## b
+
 #define ATSHA204A_SLAVE_ADDRESS         0x60
 #define ATSHA204A_DT_NODENAME           atsha204a@60
 
 #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    __CONCAT(tpm@,SECURE96_SPI0_CS)
+
+#ifndef SECURE96_SPI0_CS
+#define SECURE96_SPI0_CS                0
+#endif
 
 #ifndef SECURE96_ACPI_GPIO
 #define SECURE96_ACPI_GPIO              "\\_SB.GPIO"
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#41610): https://edk2.groups.io/g/devel/message/41610
Mute This Topic: https://groups.io/mt/31833223/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH edk2-platforms 3/5] Platform/Secure96Dxe: redefine LS connector CS as platform property
Posted by Leif Lindholm 5 years, 6 months ago
On Wed, May 29, 2019 at 02:50:19PM +0200, Ard Biesheuvel wrote:
> 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.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  Platform/96Boards/Secure96Dxe/Secure96.dts |  2 +-
>  Platform/96Boards/Secure96Dxe/Secure96.h   | 11 ++++++++---
>  2 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/Platform/96Boards/Secure96Dxe/Secure96.dts b/Platform/96Boards/Secure96Dxe/Secure96.dts
> index d066fcb1933c..0d7d9b3900a4 100644
> --- a/Platform/96Boards/Secure96Dxe/Secure96.dts
> +++ b/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>;
>              };
>          };
> diff --git a/Platform/96Boards/Secure96Dxe/Secure96.h b/Platform/96Boards/Secure96Dxe/Secure96.h
> index c34fc5eea046..1d8bf4159209 100644
> --- a/Platform/96Boards/Secure96Dxe/Secure96.h
> +++ b/Platform/96Boards/Secure96Dxe/Secure96.h
> @@ -1,6 +1,6 @@
>  /** @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
>  **/
> @@ -8,14 +8,19 @@
>  #ifndef _SECURE96_H_
>  #define _SECURE96_H_
>  
> +#define __CONCAT(a,b)                   a ## b
> +

Urgh. We badly need to properly add some official macros for this.
You could possibly use __CONCATENATE from Base.h.

For new macros, we really should avoid leading _.

/
    Leif

>  #define ATSHA204A_SLAVE_ADDRESS         0x60
>  #define ATSHA204A_DT_NODENAME           atsha204a@60
>  
>  #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    __CONCAT(tpm@,SECURE96_SPI0_CS)
> +
> +#ifndef SECURE96_SPI0_CS
> +#define SECURE96_SPI0_CS                0
> +#endif
>  
>  #ifndef SECURE96_ACPI_GPIO
>  #define SECURE96_ACPI_GPIO              "\\_SB.GPIO"
> -- 
> 2.20.1
> 
> 
> 
> 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#41613): https://edk2.groups.io/g/devel/message/41613
Mute This Topic: https://groups.io/mt/31833223/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH edk2-platforms 3/5] Platform/Secure96Dxe: redefine LS connector CS as platform property
Posted by Ard Biesheuvel 5 years, 6 months ago
On Wed, 29 May 2019 at 15:06, Leif Lindholm <leif.lindholm@linaro.org> wrote:
>
> On Wed, May 29, 2019 at 02:50:19PM +0200, Ard Biesheuvel wrote:
> > 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.
> >
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > ---
> >  Platform/96Boards/Secure96Dxe/Secure96.dts |  2 +-
> >  Platform/96Boards/Secure96Dxe/Secure96.h   | 11 ++++++++---
> >  2 files changed, 9 insertions(+), 4 deletions(-)
> >
> > diff --git a/Platform/96Boards/Secure96Dxe/Secure96.dts b/Platform/96Boards/Secure96Dxe/Secure96.dts
> > index d066fcb1933c..0d7d9b3900a4 100644
> > --- a/Platform/96Boards/Secure96Dxe/Secure96.dts
> > +++ b/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>;
> >              };
> >          };
> > diff --git a/Platform/96Boards/Secure96Dxe/Secure96.h b/Platform/96Boards/Secure96Dxe/Secure96.h
> > index c34fc5eea046..1d8bf4159209 100644
> > --- a/Platform/96Boards/Secure96Dxe/Secure96.h
> > +++ b/Platform/96Boards/Secure96Dxe/Secure96.h
> > @@ -1,6 +1,6 @@
> >  /** @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
> >  **/
> > @@ -8,14 +8,19 @@
> >  #ifndef _SECURE96_H_
> >  #define _SECURE96_H_
> >
> > +#define __CONCAT(a,b)                   a ## b
> > +
>
> Urgh. We badly need to properly add some official macros for this.
> You could possibly use __CONCATENATE from Base.h.
>

OK, I'll use that instead.

> For new macros, we really should avoid leading _.
>

True.

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#41614): https://edk2.groups.io/g/devel/message/41614
Mute This Topic: https://groups.io/mt/31833223/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH edk2-platforms 3/5] Platform/Secure96Dxe: redefine LS connector CS as platform property
Posted by Leif Lindholm 5 years, 6 months ago
On Wed, May 29, 2019 at 03:14:48PM +0200, Ard Biesheuvel wrote:
> On Wed, 29 May 2019 at 15:06, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> >
> > On Wed, May 29, 2019 at 02:50:19PM +0200, Ard Biesheuvel wrote:
> > > 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.
> > >
> > > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > > ---
> > >  Platform/96Boards/Secure96Dxe/Secure96.dts |  2 +-
> > >  Platform/96Boards/Secure96Dxe/Secure96.h   | 11 ++++++++---
> > >  2 files changed, 9 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/Platform/96Boards/Secure96Dxe/Secure96.dts b/Platform/96Boards/Secure96Dxe/Secure96.dts
> > > index d066fcb1933c..0d7d9b3900a4 100644
> > > --- a/Platform/96Boards/Secure96Dxe/Secure96.dts
> > > +++ b/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>;
> > >              };
> > >          };
> > > diff --git a/Platform/96Boards/Secure96Dxe/Secure96.h b/Platform/96Boards/Secure96Dxe/Secure96.h
> > > index c34fc5eea046..1d8bf4159209 100644
> > > --- a/Platform/96Boards/Secure96Dxe/Secure96.h
> > > +++ b/Platform/96Boards/Secure96Dxe/Secure96.h
> > > @@ -1,6 +1,6 @@
> > >  /** @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
> > >  **/
> > > @@ -8,14 +8,19 @@
> > >  #ifndef _SECURE96_H_
> > >  #define _SECURE96_H_
> > >
> > > +#define __CONCAT(a,b)                   a ## b
> > > +
> >
> > Urgh. We badly need to properly add some official macros for this.
> > You could possibly use __CONCATENATE from Base.h.
> >
> 
> OK, I'll use that instead.

With that, for 1-4/5:
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>


> > For new macros, we really should avoid leading _.
> >
> 
> True.
> 
> 
> 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#41620): https://edk2.groups.io/g/devel/message/41620
Mute This Topic: https://groups.io/mt/31833223/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH edk2-platforms 3/5] Platform/Secure96Dxe: redefine LS connector CS as platform property
Posted by Ard Biesheuvel 5 years, 6 months ago
On Wed, 29 May 2019 at 16:43, Leif Lindholm <leif.lindholm@linaro.org> wrote:
>
> On Wed, May 29, 2019 at 03:14:48PM +0200, Ard Biesheuvel wrote:
> > On Wed, 29 May 2019 at 15:06, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> > >
> > > On Wed, May 29, 2019 at 02:50:19PM +0200, Ard Biesheuvel wrote:
> > > > 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.
> > > >
> > > > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > > > ---
> > > >  Platform/96Boards/Secure96Dxe/Secure96.dts |  2 +-
> > > >  Platform/96Boards/Secure96Dxe/Secure96.h   | 11 ++++++++---
> > > >  2 files changed, 9 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/Platform/96Boards/Secure96Dxe/Secure96.dts b/Platform/96Boards/Secure96Dxe/Secure96.dts
> > > > index d066fcb1933c..0d7d9b3900a4 100644
> > > > --- a/Platform/96Boards/Secure96Dxe/Secure96.dts
> > > > +++ b/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>;
> > > >              };
> > > >          };
> > > > diff --git a/Platform/96Boards/Secure96Dxe/Secure96.h b/Platform/96Boards/Secure96Dxe/Secure96.h
> > > > index c34fc5eea046..1d8bf4159209 100644
> > > > --- a/Platform/96Boards/Secure96Dxe/Secure96.h
> > > > +++ b/Platform/96Boards/Secure96Dxe/Secure96.h
> > > > @@ -1,6 +1,6 @@
> > > >  /** @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
> > > >  **/
> > > > @@ -8,14 +8,19 @@
> > > >  #ifndef _SECURE96_H_
> > > >  #define _SECURE96_H_
> > > >
> > > > +#define __CONCAT(a,b)                   a ## b
> > > > +
> > >
> > > Urgh. We badly need to properly add some official macros for this.
> > > You could possibly use __CONCATENATE from Base.h.
> > >
> >
> > OK, I'll use that instead.
>
> With that, for 1-4/5:
> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
>


Thanks

Pushed as c587c76bec49..f36ee841e0ec

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#41644): https://edk2.groups.io/g/devel/message/41644
Mute This Topic: https://groups.io/mt/31833223/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-