Re: [PATCH 3/3] boards: siemens: iot2050: Unify PG1 and PG2/M.2 configurations again

2023-06-15 Thread Jan Kiszka
On 12.06.23 23:17, Simon Glass wrote:
> Hi Jan,
> 
> On Mon, 5 Jun 2023 at 15:40, Jan Kiszka  wrote:
>>
>> From: Jan Kiszka 
>>
>> This avoids having to maintain to defconfigs that are 99% equivalent.
>> The approach is to use binman to generate two flash images,
>> flash-pg1.bin and flash-pg2.bin. With the help of some macros, we can
>> avoid duplicating the common binman image definitions.
>>
>> Suggested-by: Andrew Davis 
>> Signed-off-by: Jan Kiszka 
>> ---
>>  arch/arm/dts/k3-am65-iot2050-boot-image.dtsi  | 299 ++
>>  board/siemens/iot2050/Kconfig |  30 +-
>>  board/siemens/iot2050/board.c |  14 +-
>>  board/siemens/iot2050/config.mk   |   6 +-
>>  ...ot2050_pg1_defconfig => iot2050_defconfig} |   3 +-
>>  configs/iot2050_pg2_defconfig | 150 -
>>  doc/board/siemens/iot2050.rst |  29 +-
>>  tools/iot2050-sign-fw.sh  |   9 +-
>>  8 files changed, 202 insertions(+), 338 deletions(-)
>>  rename configs/{iot2050_pg1_defconfig => iot2050_defconfig} (97%)
>>  delete mode 100644 configs/iot2050_pg2_defconfig
> 
> We need to find another way to do this... the macros are horrible.
> 
> Could you put the common code in another .dtsi file and include it twice?
> 
> Then in the 'main' .dtsi file refer to some anchors to set the properties:
> 
> &u_boot {
>fit,fdt-list = "...";
> };

I can use some preprocessor defines in that template code which need to
be re-defined before the inclusions. Prototype is working already.

> 
> Or do we need a new binman feature to handle this?
> 
> BTW using #ifdef on a particular target is something we should avoid.
> Isn't there another Kconfig (for the feature itself) that you can use?

What are you referring to?

Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux



Re: [PATCH 3/3] boards: siemens: iot2050: Unify PG1 and PG2/M.2 configurations again

2023-06-12 Thread Simon Glass
Hi Jan,

On Mon, 5 Jun 2023 at 15:40, Jan Kiszka  wrote:
>
> From: Jan Kiszka 
>
> This avoids having to maintain to defconfigs that are 99% equivalent.
> The approach is to use binman to generate two flash images,
> flash-pg1.bin and flash-pg2.bin. With the help of some macros, we can
> avoid duplicating the common binman image definitions.
>
> Suggested-by: Andrew Davis 
> Signed-off-by: Jan Kiszka 
> ---
>  arch/arm/dts/k3-am65-iot2050-boot-image.dtsi  | 299 ++
>  board/siemens/iot2050/Kconfig |  30 +-
>  board/siemens/iot2050/board.c |  14 +-
>  board/siemens/iot2050/config.mk   |   6 +-
>  ...ot2050_pg1_defconfig => iot2050_defconfig} |   3 +-
>  configs/iot2050_pg2_defconfig | 150 -
>  doc/board/siemens/iot2050.rst |  29 +-
>  tools/iot2050-sign-fw.sh  |   9 +-
>  8 files changed, 202 insertions(+), 338 deletions(-)
>  rename configs/{iot2050_pg1_defconfig => iot2050_defconfig} (97%)
>  delete mode 100644 configs/iot2050_pg2_defconfig

We need to find another way to do this... the macros are horrible.

Could you put the common code in another .dtsi file and include it twice?

Then in the 'main' .dtsi file refer to some anchors to set the properties:

&u_boot {
   fit,fdt-list = "...";
};

Or do we need a new binman feature to handle this?

BTW using #ifdef on a particular target is something we should avoid.
Isn't there another Kconfig (for the feature itself) that you can use?

Regards,
Simon


[PATCH 3/3] boards: siemens: iot2050: Unify PG1 and PG2/M.2 configurations again

2023-06-05 Thread Jan Kiszka
From: Jan Kiszka 

This avoids having to maintain to defconfigs that are 99% equivalent.
The approach is to use binman to generate two flash images,
flash-pg1.bin and flash-pg2.bin. With the help of some macros, we can
avoid duplicating the common binman image definitions.

Suggested-by: Andrew Davis 
Signed-off-by: Jan Kiszka 
---
 arch/arm/dts/k3-am65-iot2050-boot-image.dtsi  | 299 ++
 board/siemens/iot2050/Kconfig |  30 +-
 board/siemens/iot2050/board.c |  14 +-
 board/siemens/iot2050/config.mk   |   6 +-
 ...ot2050_pg1_defconfig => iot2050_defconfig} |   3 +-
 configs/iot2050_pg2_defconfig | 150 -
 doc/board/siemens/iot2050.rst |  29 +-
 tools/iot2050-sign-fw.sh  |   9 +-
 8 files changed, 202 insertions(+), 338 deletions(-)
 rename configs/{iot2050_pg1_defconfig => iot2050_defconfig} (97%)
 delete mode 100644 configs/iot2050_pg2_defconfig

diff --git a/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi 
b/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi
index 03ccc543293..1ea3fa85120 100644
--- a/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi
+++ b/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (c) Siemens AG, 2020-2022
+ * Copyright (c) Siemens AG, 2020-2023
  *
  * Authors:
  *   Jan Kiszka 
@@ -8,158 +8,177 @@
  */
 
 #include 
+#include 
 
-/ {
-   binman {
-   filename = "flash.bin";
-   pad-byte = <0xff>;
-   size = <0x8c>;
-   allow-repack;
-
-   blob-ext@0x00 {
-   offset = <0x00>;
-#ifdef CONFIG_TARGET_IOT2050_A53_PG1
-   filename = "seboot_pg1.bin";
+#ifdef CONFIG_WDT_K3_RTI_FW_FILE
+#define IOT2050_WDT_FIRMWARE_LOADABLE  "k3-rti-wdt-firmware"
+#define IOT2050_WDT_FIRMWARE   \
+   k3-rti-wdt-firmware {   \
+   type = "firmware";  \
+   load = <0x8200>;\
+   arch = "arm";   \
+   compression = "none";   \
+   blob-ext {  \
+   filename = CONFIG_WDT_K3_RTI_FW_FILE;   \
+   missing-msg = IOT2050_WDT_FIRMWARE_LOADABLE;\
+   };  \
+   hash {  \
+   algo = "sha256";\
+   };  \
+   };
 #else
-   filename = "seboot_pg2.bin";
+#define IOT2050_WDT_FIRMWARE_LOADABLE
+#define IOT2050_WDT_FIRMWARE
 #endif
-   missing-msg = "iot2050-seboot";
-   };
-
-   blob@0x18 {
-   offset = <0x18>;
-   filename = "tispl.bin";
-   };
-
-   fit@0x38 {
-   description = "U-Boot for IOT2050";
-   fit,fdt-list = "of-list";
-   offset = <0x38>;
-   images {
-   u-boot {
-   description = "U-Boot";
-   type = "standalone";
-   arch = "arm64";
-   os = "u-boot";
-   compression = "none";
-   load = <0x8080>;
-   entry = <0x8080>;
-   u-boot-nodtb {
-   };
-   hash {
-   algo = "sha256";
-   };
-   };
 
-   @fdt-SEQ {
-   description = "fdt-NAME";
-   type = "flat_dt";
-   arch = "arm64";
-   compression = "none";
-   hash {
-   algo = "sha256";
-   };
-   };
-
-#ifdef CONFIG_TARGET_IOT2050_A53_PG2
-   bkey-usb3-overlay {
-   description = "M.2-bkey-usb3-overlay";
-   type = "blob";
-   load = <0x8210>;
-   arch = "arm64";