Use the k3_fit_config_match_security_state() helper introduced in the
earlier "arm: k3: select tifsstub via board_fit_config_name_match"
patch to pick the right tifsstub variant on phycore AM62x and AM62Ax
SoMs at FIT config selection time.

The k3-am625-phycore-som-binman.dtsi and
k3-am62a-phycore-som-binman.dtsi FIT images are split into
per-security-state configurations (conf-hs-se, conf-hs-fs), and
board_fit_config_name_match() in each phycore board file forwards to
the shared K3 helper.

Signed-off-by: Aristo Chen <[email protected]>
---
 arch/arm/dts/k3-am625-phycore-som-binman.dtsi | 42 ++++++++++++++-----
 arch/arm/dts/k3-am62a-phycore-som-binman.dtsi | 15 ++++---
 board/phytec/phycore_am62ax/phycore-am62ax.c  |  8 ++++
 board/phytec/phycore_am62x/phycore-am62x.c    |  8 ++++
 4 files changed, 58 insertions(+), 15 deletions(-)

diff --git a/arch/arm/dts/k3-am625-phycore-som-binman.dtsi 
b/arch/arm/dts/k3-am625-phycore-som-binman.dtsi
index 5e777a1f305..e2e0f9a2471 100644
--- a/arch/arm/dts/k3-am625-phycore-som-binman.dtsi
+++ b/arch/arm/dts/k3-am625-phycore-som-binman.dtsi
@@ -309,13 +309,24 @@
                        };
 
                        configurations {
-                               default = "conf-0";
+                               default = "conf-hs-fs";
 
-                               conf-0 {
-                                       description = 
"k3-am625-phyboard-lyra-rdk";
+                               conf-hs-fs {
+                                       description = 
"k3-am625-phyboard-lyra-rdk-hs-fs";
+                                       firmware = "atf";
+                                       loadables = "tee", "tifsstub-fs", "dm", 
"spl";
+                                       fdt = "fdt-0";
+                               };
+                               conf-hs-se {
+                                       description = 
"k3-am625-phyboard-lyra-rdk-hs-se";
+                                       firmware = "atf";
+                                       loadables = "tee", "tifsstub-hs", "dm", 
"spl";
+                                       fdt = "fdt-0";
+                               };
+                               conf-gp {
+                                       description = 
"k3-am625-phyboard-lyra-rdk-gp";
                                        firmware = "atf";
-                                       loadables = "tee", "tifsstub-hs", 
"tifsstub-fs",
-                                                   "tifsstub-gp", "dm", "spl";
+                                       loadables = "tee", "tifsstub-gp", "dm", 
"spl";
                                        fdt = "fdt-0";
                                };
                        };
@@ -547,13 +558,24 @@
                        };
 
                        configurations {
-                               default = "conf-0";
+                               default = "conf-hs-fs";
 
-                               conf-0 {
-                                       description = 
"k3-am625-phyboard-lyra-rdk";
+                               conf-hs-fs {
+                                       description = 
"k3-am625-phyboard-lyra-rdk-hs-fs";
+                                       firmware = "atf";
+                                       loadables = "tee", "tifsstub-fs", "dm", 
"spl";
+                                       fdt = "fdt-0";
+                               };
+                               conf-hs-se {
+                                       description = 
"k3-am625-phyboard-lyra-rdk-hs-se";
+                                       firmware = "atf";
+                                       loadables = "tee", "tifsstub-hs", "dm", 
"spl";
+                                       fdt = "fdt-0";
+                               };
+                               conf-gp {
+                                       description = 
"k3-am625-phyboard-lyra-rdk-gp";
                                        firmware = "atf";
-                                       loadables = "tee", "tifsstub-hs", 
"tifsstub-fs",
-                                                   "tifsstub-gp", "dm", "spl";
+                                       loadables = "tee", "tifsstub-gp", "dm", 
"spl";
                                        fdt = "fdt-0";
                                };
                        };
diff --git a/arch/arm/dts/k3-am62a-phycore-som-binman.dtsi 
b/arch/arm/dts/k3-am62a-phycore-som-binman.dtsi
index 6f82a40908f..cdc9a100a04 100644
--- a/arch/arm/dts/k3-am62a-phycore-som-binman.dtsi
+++ b/arch/arm/dts/k3-am62a-phycore-som-binman.dtsi
@@ -247,13 +247,18 @@
                        };
 
                        configurations {
-                               default = "conf-0";
+                               default = "conf-hs-fs";
 
-                               conf-0 {
-                                       description = 
"k3-am62a7-phyboard-lyra-rdk";
+                               conf-hs-fs {
+                                       description = 
"k3-am62a7-phyboard-lyra-rdk-hs-fs";
+                                       firmware = "atf";
+                                       loadables = "tee", "dm", "spl", 
"tifsstub-fs";
+                                       fdt = "fdt-0";
+                               };
+                               conf-hs-se {
+                                       description = 
"k3-am62a7-phyboard-lyra-rdk-hs-se";
                                        firmware = "atf";
-                                       loadables = "tee", "dm", "spl",
-                                       "tifsstub-hs", "tifsstub-fs";
+                                       loadables = "tee", "dm", "spl", 
"tifsstub-hs";
                                        fdt = "fdt-0";
                                };
                        };
diff --git a/board/phytec/phycore_am62ax/phycore-am62ax.c 
b/board/phytec/phycore_am62ax/phycore-am62ax.c
index 3e1c4102cc1..acd0cecfe6d 100644
--- a/board/phytec/phycore_am62ax/phycore-am62ax.c
+++ b/board/phytec/phycore_am62ax/phycore-am62ax.c
@@ -8,6 +8,7 @@
 #include <asm/io.h>
 #include <spl.h>
 #include <fdt_support.h>
+#include <image.h>
 
 #include "../common/am6_som_detection.h"
 
@@ -57,3 +58,10 @@ void spl_board_init(void)
        dram_init_banksize();
 }
 #endif
+
+#if defined(CONFIG_SPL_LOAD_FIT)
+int board_fit_config_name_match(const char *name)
+{
+       return k3_fit_config_match_security_state(name);
+}
+#endif
diff --git a/board/phytec/phycore_am62x/phycore-am62x.c 
b/board/phytec/phycore_am62x/phycore-am62x.c
index 3cdcbf2ecc9..2d1a893540c 100644
--- a/board/phytec/phycore_am62x/phycore-am62x.c
+++ b/board/phytec/phycore_am62x/phycore-am62x.c
@@ -9,6 +9,7 @@
 #include <spl.h>
 #include <asm/arch/k3-ddr.h>
 #include <fdt_support.h>
+#include <image.h>
 
 #include "phycore-ddr-data.h"
 #include "../common/k3/k3_ddrss_patch.h"
@@ -237,3 +238,10 @@ void spl_board_init(void)
               MCU_CTRL_DEVICE_CLKOUT_32K_CTRL);
 }
 #endif
+
+#if defined(CONFIG_SPL_LOAD_FIT)
+int board_fit_config_name_match(const char *name)
+{
+       return k3_fit_config_match_security_state(name);
+}
+#endif
-- 
2.43.0

Reply via email to