boards: siemens: iot2050: Unify PG1 and PG2/M.2 configurations again
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 a template dtsi, we
can avoid duplicating the common binman image definitions.
Suggested-by: Andrew Davis <afd@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
diff --git a/board/siemens/iot2050/Kconfig b/board/siemens/iot2050/Kconfig
index e66b242..a6170aa 100644
--- a/board/siemens/iot2050/Kconfig
+++ b/board/siemens/iot2050/Kconfig
@@ -1,40 +1,22 @@
# SPDX-License-Identifier: GPL-2.0+
#
-# Copyright (c) Siemens AG, 2018-2022
+# Copyright (c) Siemens AG, 2018-2023
#
# Authors:
# Le Jin <le.jin@siemens.com>
# Jan Kiszka <jan.kiszka@siemens.com>
-choice
- prompt "Siemens SIMATIC IOT2050 boards"
- optional
-
-config TARGET_IOT2050_A53_PG1
- bool "IOT2050 PG1 running on A53"
- select IOT2050_A53_COMMON
- help
- This builds U-Boot for the Product Generation 1 (PG1) of the IOT2050
- devices.
-
-config TARGET_IOT2050_A53_PG2
- bool "IOT2050 PG2 running on A53"
- select IOT2050_A53_COMMON
- help
- This builds U-Boot for the Product Generation 2 (PG2) of the IOT2050
- devices.
-
-endchoice
-
-config IOT2050_A53_COMMON
- bool
+config TARGET_IOT2050_A53
+ bool "IOT2050 running on A53"
select ARM64
select SOC_K3_AM654
select BOARD_LATE_INIT
select SYS_DISABLE_DCACHE_OPS
select BINMAN
+ help
+ This builds U-Boot for the IOT2050 devices.
-if IOT2050_A53_COMMON
+if TARGET_IOT2050_A53
config SYS_BOARD
default "iot2050"
diff --git a/board/siemens/iot2050/MAINTAINERS b/board/siemens/iot2050/MAINTAINERS
index aa21de2..1b52535 100644
--- a/board/siemens/iot2050/MAINTAINERS
+++ b/board/siemens/iot2050/MAINTAINERS
@@ -4,7 +4,6 @@
S: Maintained
F: board/siemens/iot2050/
F: include/configs/iot2050.h
-F: configs/iot2050_pg1_defconfig
-F: configs/iot2050_pg2_defconfig
+F: configs/iot2050_defconfig
F: arch/arm/dts/iot2050-*
F: doc/board/siemens/iot2050.rst
diff --git a/board/siemens/iot2050/board.c b/board/siemens/iot2050/board.c
index 2653e10..15f5310 100644
--- a/board/siemens/iot2050/board.c
+++ b/board/siemens/iot2050/board.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Board specific initialization for IOT2050
- * Copyright (c) Siemens AG, 2018-2022
+ * Copyright (c) Siemens AG, 2018-2023
*
* Authors:
* Le Jin <le.jin@siemens.com>
@@ -147,23 +147,30 @@
dm_gpio_set_value(&gpio, value);
}
-static bool board_is_m2(void)
+static bool board_is_advanced(void)
{
struct iot2050_info *info = IOT2050_INFO_DATA;
- return IS_ENABLED(CONFIG_TARGET_IOT2050_A53_PG2) &&
- info->magic == IOT2050_INFO_MAGIC &&
- strcmp((char *)info->name, "IOT2050-ADVANCED-M2") == 0;
+ return info->magic == IOT2050_INFO_MAGIC &&
+ strstr((char *)info->name, "IOT2050-ADVANCED") != NULL;
}
-static bool board_is_advanced(void)
+static bool board_is_sr1(void)
{
struct iot2050_info *info = IOT2050_INFO_DATA;
return info->magic == IOT2050_INFO_MAGIC &&
- strstr((char *)info->name, "IOT2050-ADVANCED") != NULL;
+ strstr((char *)info->name, "-PG2") != NULL;
}
+static bool board_is_m2(void)
+{
+ struct iot2050_info *info = IOT2050_INFO_DATA;
+
+ return !board_is_sr1() && info->magic == IOT2050_INFO_MAGIC &&
+ strcmp((char *)info->name, "IOT2050-ADVANCED-M2") == 0;
+}
+
static void remove_mmc1_target(void)
{
char *boot_targets = strdup(env_get("boot_targets"));
@@ -210,14 +217,14 @@
}
if (board_is_advanced()) {
- if (IS_ENABLED(CONFIG_TARGET_IOT2050_A53_PG1))
+ if (board_is_sr1())
fdtfile = "ti/k3-am6548-iot2050-advanced.dtb";
else if(board_is_m2())
fdtfile = "ti/k3-am6548-iot2050-advanced-m2.dtb";
else
fdtfile = "ti/k3-am6548-iot2050-advanced-pg2.dtb";
} else {
- if (IS_ENABLED(CONFIG_TARGET_IOT2050_A53_PG1))
+ if (board_is_sr1())
fdtfile = "ti/k3-am6528-iot2050-basic.dtb";
else
fdtfile = "ti/k3-am6528-iot2050-basic-pg2.dtb";