Skip to contentSkip to conversation

tools: binman: ti_board_cfg: Add configurable sw-rev support

PATCH In review Shiva Tripathi 3 participants 3 messages Jun 30 – Jul 14

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: binman: ti_board_cfg: Add configurable sw-rev support

The software revision field in the combined board config binary header was hardcoded to 1, preventing independent control from SBL SWREV configured via ti-secure-rom's sw-rev property.

Add support for the optional 'sw-rev' DTS property in ti_board_config nodes, which sets the SWREV byte in the header. Defaults to 1 for backward compatibility.

---
 tools/binman/etype/ti_board_config.py         |  4 ++-
 tools/binman/ftest.py                         |  5 ++++
 .../vendor/ti_board_cfg_combined_sw_rev.dts   | 26 +++++++++++++++++++
 3 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 tools/binman/test/vendor/ti_board_cfg_combined_sw_rev.dts
tools/binman/etype/ti_board_config.py +3 -1
index 7c6773ac7bc..3f2135f8f33 100644
@@ -38,6 +38,8 @@ class Entry_ti_board_config(Entry_section):
         - config-file: File containing board configuration data in YAML
         - schema-file: File containing board configuration YAML schema against
           which the config file is validated
+        - sw-rev: Software revision for the board config binary header
+          (optional, default 1)
 
     Output files:
         - board config binary: File containing board configuration binary
@@ -80,11 +82,11 @@ class Entry_ti_board_config(Entry_section):
         self._fmt = '<HHHBB'
         self._index = 0
         self._binary_offset = 0
-        self._sw_rev = 1
         self._devgrp = 0
 
     def ReadNode(self):
         super().ReadNode()
+        self._sw_rev = fdt_util.GetInt(self._node, 'sw-rev', 1)
         self._config = fdt_util.GetString(self._node, 'config')
         self._schema = fdt_util.GetString(self._node, 'schema')
         # Depending on whether config file is present in node, we determine
tools/binman/ftest.py +5 -0
index bf98b268ac1..ea2fa6eb83a 100644
@@ -7212,6 +7212,11 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
         configlen_noheader = TI_BOARD_CONFIG_DATA * 4
         self.assertGreater(data, configlen_noheader)
 
+    def testTIBoardConfigCombinedSwRev(self):
+        """Test that sw-rev property is honoured in combined board config"""
+        data = self._DoReadFile('vendor/ti_board_cfg_combined_sw_rev.dts')
+        self.assertEqual(2, data[1])
+
     def testTIBoardConfigNoDataType(self):
         """Test that error is thrown when data type is not supported"""
         with self.assertRaises(ValueError) as e:
tools/binman/test/vendor/ti_board_cfg_combined_sw_rev.dts new file +26 -0
new file mode 100644
index 00000000000..b998d22c2da
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0+
+/dts-v1/;
+
+/ {
+	binman {
+		ti-board-config {
+			sw-rev = <2>;
+			board-cfg {
+				config = "yaml/config.yaml";
+				schema = "yaml/schema.yaml";
+			};
+			sec-cfg {
+				config = "yaml/config.yaml";
+				schema = "yaml/schema.yaml";
+			};
+			rm-cfg {
+				config = "yaml/config.yaml";
+				schema = "yaml/schema.yaml";
+			};
+			pm-cfg {
+				config = "yaml/config.yaml";
+				schema = "yaml/schema.yaml";
+			};
+		};
+	};
+};
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Shiva Tripathi

tools: binman: ti_board_cfg: Add configurable sw-rev support

The software revision field in the combined board config binary header was hardcoded to 1, preventing independent control from SBL SWREV configured via ti-secure-rom's sw-rev property.

Add support for the optional 'sw-rev' DTS property in ti_board_config nodes, which sets the SWREV byte in the header. Defaults to 1 for backward compatibility.

Quoted 6 lines

tools/binman/etype/ti_board_config.py | 4 +++-

 tools/binman/ftest.py                              |  5 +++++
 .../test/vendor/ti_board_cfg_combined_sw_rev.dts   | 26 ++++++++++++++++++++++
 3 files changed, 34 insertions(+), 1 deletion(-)
#2 lore raw
In reply to Shiva Tripathi
Quoted 9 lines · Shiva Tripathi

The software revision field in the combined board config binary header was hardcoded to 1, preventing independent control from SBL SWREV configured via ti-secure-rom's sw-rev property.

Add support for the optional 'sw-rev' DTS property in ti_board_config nodes, which sets the SWREV byte in the header. Defaults to 1 for backward compatibility.

[...]

Applied to u-boot/master, thanks!

[1/1] tools: binman: ti_board_cfg: Add configurable sw-rev support

      commit: ab2266aff3622a1cf1a5e76a0702688b2bb538a5
Signature · 1 line
Tom