Re: [PATCH v2] binman: bintool: Add support for tool directories

2023-02-21 Thread Neha Malcom Francis

Hi Simon

On 22/02/23 01:05, Simon Glass wrote:

Hi Neha,

On Fri, 17 Feb 2023 at 04:46, Neha Malcom Francis  wrote:


Currently, bintool supports external compilable tools as single
executable files. Adding support for git repos that can be used to run
non-compilable scripting tools that cannot otherwise be present in
binman.

Signed-off-by: Neha Malcom Francis 
---
Changes in v2:
 - added parameter to obtain path to download the directory
   optionally, enables flexibility to avoid using
   DOWNLOAD_DESTDIR
 - added test to bintool_test.py
 - s/FETCH_NO_BUILD/FETCH_SOURCE
 - code reformatting


This looks better but I see have some questions and nits.



  tools/binman/bintool.py| 45 --
  tools/binman/bintool_test.py   | 22 +
  tools/binman/btool/_testing.py |  5 
  tools/patman/tools.py  |  2 +-
  4 files changed, 66 insertions(+), 8 deletions(-)

diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index 8fda13ff01..04c951fa0b 100644
--- a/tools/binman/bintool.py
+++ b/tools/binman/bintool.py
@@ -32,12 +32,13 @@ FORMAT = '%-16.16s %-12.12s %-26.26s %s'
  modules = {}

  # Possible ways of fetching a tool (FETCH_COUNT is number of ways)
-FETCH_ANY, FETCH_BIN, FETCH_BUILD, FETCH_COUNT = range(4)
+FETCH_ANY, FETCH_BIN, FETCH_BUILD, FETCH_SOURCE, FETCH_COUNT = range(5)

  FETCH_NAMES = {
  FETCH_ANY: 'any method',
  FETCH_BIN: 'binary download',
-FETCH_BUILD: 'build from source'
+FETCH_BUILD: 'build from source',
+FETCH_SOURCE: 'download source without building'


Would this be a script? Should we say 'download script without building' ?



Addressed this in a further below comment.


  }

  # Status of tool fetching
@@ -201,12 +202,13 @@ class Bintool:
  print(f'- trying method: {FETCH_NAMES[try_method]}')
  result = try_fetch(try_method)
  if result:
+method = try_method
  break
  else:
  result = try_fetch(method)
  if not result:
  return FAIL
-if result is not True:
+if result is not True and method != FETCH_SOURCE:
  fname, tmpdir = result
  dest = os.path.join(DOWNLOAD_DESTDIR, self.name)
  print(f"- writing to '{dest}'")
@@ -261,7 +263,7 @@ class Bintool:
  show_status(col.RED, 'Failures', status[FAIL])
  return not status[FAIL]

-def run_cmd_result(self, *args, binary=False, raise_on_error=True):
+def run_cmd_result(self, *args, binary=False, raise_on_error=True, 
add_name=True):


Please update function comment for new param


  """Run the bintool using command-line arguments

  Args:
@@ -278,7 +280,10 @@ class Bintool:
  if self.name in self.missing_list:
  return None
  name = os.path.expanduser(self.name)  # Expand paths containing ~
-all_args = (name,) + args
+if add_name:
+all_args = (name,) + args
+else:
+all_args = args
  env = tools.get_env_with_path()
  tout.detail(f"bintool: {' '.join(all_args)}")
  result = command.run_pipe(
@@ -304,7 +309,7 @@ class Bintool:
  tout.debug(result.stderr)
  return result

-def run_cmd(self, *args, binary=False):
+def run_cmd(self, *args, binary=False, add_name=True):


Please update function comment for new param


  """Run the bintool using command-line arguments

  Args:
@@ -315,7 +320,7 @@ class Bintool:
  Returns:
  str or bytes: Resulting stdout from the bintool
  """
-result = self.run_cmd_result(*args, binary=binary)
+result = self.run_cmd_result(*args, binary=binary, add_name=add_name)
  if result:
  return result.stdout

@@ -354,6 +359,32 @@ class Bintool:
  return None
  return fname, tmpdir

+@classmethod
+def fetch_from_git(cls, git_repo, name, toolpath=DOWNLOAD_DESTDIR):
+"""Fetch a bintool git repo
+
+This clones the repo and returns
+
+Args:
+git_repo (str): URL of git repo
+name (str): Bintool name assigned as tool directory name


missing toolpath arg



Will make the above changes

+
+Returns:
+str: Directory of fetched repo
+or None on error
+"""
+dir = os.path.join(toolpath, name)
+if os.path.exists(dir):
+print(f"- Repo {dir} already exists")
+return None
+os.mkdir(dir)
+print(f"- clone git repo '{git_repo}' to '{dir}'")
+tools.run('

Re: [PATCH v2] binman: bintool: Add support for tool directories

2023-02-24 Thread Neha Malcom Francis

Hi Simon

On 23/02/23 02:50, Simon Glass wrote:

Hi Neha,

On Tue, 21 Feb 2023 at 21:30, Neha Malcom Francis  wrote:


Hi Simon

On 22/02/23 01:05, Simon Glass wrote:

Hi Neha,

On Fri, 17 Feb 2023 at 04:46, Neha Malcom Francis  wrote:


Currently, bintool supports external compilable tools as single
executable files. Adding support for git repos that can be used to run
non-compilable scripting tools that cannot otherwise be present in
binman.

Signed-off-by: Neha Malcom Francis 
---
Changes in v2:
  - added parameter to obtain path to download the directory
optionally, enables flexibility to avoid using
DOWNLOAD_DESTDIR
  - added test to bintool_test.py
  - s/FETCH_NO_BUILD/FETCH_SOURCE
  - code reformatting


This looks better but I see have some questions and nits.



   tools/binman/bintool.py| 45 --
   tools/binman/bintool_test.py   | 22 +
   tools/binman/btool/_testing.py |  5 
   tools/patman/tools.py  |  2 +-
   4 files changed, 66 insertions(+), 8 deletions(-)

diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index 8fda13ff01..04c951fa0b 100644
--- a/tools/binman/bintool.py
+++ b/tools/binman/bintool.py
@@ -32,12 +32,13 @@ FORMAT = '%-16.16s %-12.12s %-26.26s %s'
   modules = {}

   # Possible ways of fetching a tool (FETCH_COUNT is number of ways)
-FETCH_ANY, FETCH_BIN, FETCH_BUILD, FETCH_COUNT = range(4)
+FETCH_ANY, FETCH_BIN, FETCH_BUILD, FETCH_SOURCE, FETCH_COUNT = range(5)

   FETCH_NAMES = {
   FETCH_ANY: 'any method',
   FETCH_BIN: 'binary download',
-FETCH_BUILD: 'build from source'
+FETCH_BUILD: 'build from source',
+FETCH_SOURCE: 'download source without building'


Would this be a script? Should we say 'download script without building' ?



Addressed this in a further below comment.


   }

   # Status of tool fetching
@@ -201,12 +202,13 @@ class Bintool:
   print(f'- trying method: {FETCH_NAMES[try_method]}')
   result = try_fetch(try_method)
   if result:
+method = try_method
   break
   else:
   result = try_fetch(method)
   if not result:
   return FAIL
-if result is not True:
+if result is not True and method != FETCH_SOURCE:
   fname, tmpdir = result
   dest = os.path.join(DOWNLOAD_DESTDIR, self.name)
   print(f"- writing to '{dest}'")
@@ -261,7 +263,7 @@ class Bintool:
   show_status(col.RED, 'Failures', status[FAIL])
   return not status[FAIL]

-def run_cmd_result(self, *args, binary=False, raise_on_error=True):
+def run_cmd_result(self, *args, binary=False, raise_on_error=True, 
add_name=True):


Please update function comment for new param


   """Run the bintool using command-line arguments

   Args:
@@ -278,7 +280,10 @@ class Bintool:
   if self.name in self.missing_list:
   return None
   name = os.path.expanduser(self.name)  # Expand paths containing ~
-all_args = (name,) + args
+if add_name:
+all_args = (name,) + args
+else:
+all_args = args
   env = tools.get_env_with_path()
   tout.detail(f"bintool: {' '.join(all_args)}")
   result = command.run_pipe(
@@ -304,7 +309,7 @@ class Bintool:
   tout.debug(result.stderr)
   return result

-def run_cmd(self, *args, binary=False):
+def run_cmd(self, *args, binary=False, add_name=True):


Please update function comment for new param


   """Run the bintool using command-line arguments

   Args:
@@ -315,7 +320,7 @@ class Bintool:
   Returns:
   str or bytes: Resulting stdout from the bintool
   """
-result = self.run_cmd_result(*args, binary=binary)
+result = self.run_cmd_result(*args, binary=binary, add_name=add_name)
   if result:
   return result.stdout

@@ -354,6 +359,32 @@ class Bintool:
   return None
   return fname, tmpdir

+@classmethod
+def fetch_from_git(cls, git_repo, name, toolpath=DOWNLOAD_DESTDIR):
+"""Fetch a bintool git repo
+
+This clones the repo and returns
+
+Args:
+git_repo (str): URL of git repo
+name (str): Bintool name assigned as tool directory name


missing toolpath arg



Will make the above changes

+
+Returns:
+str: Directory of fetched repo
+or None on error
+"""
+dir = os.path.join(toolpath, name)
+if os.path.exists(dir):
+print(f"- Repo {dir} already exists&quo

[PATCH v3] binman: bintool: Add support for tool directories

2023-02-24 Thread Neha Malcom Francis
Currently, bintool supports external compilable tools as single
executable files. Adding support for git repos that can be used to run
non-compilable scripting tools that cannot otherwise be present in
binman.

Signed-off-by: Neha Malcom Francis 
---
Changes in v3:
- moved back to using DOWNLOAD_DIR as community is making
  relevant changes
- extended coverage for bintool_test.py
- added function comment for new parameter

Changes in v2:
- added parameter to obtain path to download the directory
  optionally, enables flexibility to avoid using
  DOWNLOAD_DESTDIR
- added test to bintool_test.py
- s/FETCH_NO_BUILD/FETCH_SOURCE
- code reformatting

 tools/binman/bintool.py| 47 +-
 tools/binman/bintool_test.py   | 43 +++
 tools/binman/btool/_testing.py |  4 +++
 tools/patman/tools.py  |  2 +-
 4 files changed, 88 insertions(+), 8 deletions(-)

diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index 8fda13ff01..33f563c46f 100644
--- a/tools/binman/bintool.py
+++ b/tools/binman/bintool.py
@@ -32,12 +32,13 @@ FORMAT = '%-16.16s %-12.12s %-26.26s %s'
 modules = {}
 
 # Possible ways of fetching a tool (FETCH_COUNT is number of ways)
-FETCH_ANY, FETCH_BIN, FETCH_BUILD, FETCH_COUNT = range(4)
+FETCH_ANY, FETCH_BIN, FETCH_BUILD, FETCH_SOURCE, FETCH_COUNT = range(5)
 
 FETCH_NAMES = {
 FETCH_ANY: 'any method',
 FETCH_BIN: 'binary download',
-FETCH_BUILD: 'build from source'
+FETCH_BUILD: 'build from source',
+FETCH_SOURCE: 'download source without building'
 }
 
 # Status of tool fetching
@@ -201,12 +202,13 @@ class Bintool:
 print(f'- trying method: {FETCH_NAMES[try_method]}')
 result = try_fetch(try_method)
 if result:
+method = try_method
 break
 else:
 result = try_fetch(method)
 if not result:
 return FAIL
-if result is not True:
+if result is not True and method != FETCH_SOURCE:
 fname, tmpdir = result
 dest = os.path.join(DOWNLOAD_DESTDIR, self.name)
 print(f"- writing to '{dest}'")
@@ -261,7 +263,7 @@ class Bintool:
 show_status(col.RED, 'Failures', status[FAIL])
 return not status[FAIL]
 
-def run_cmd_result(self, *args, binary=False, raise_on_error=True):
+def run_cmd_result(self, *args, binary=False, raise_on_error=True, 
add_name=True):
 """Run the bintool using command-line arguments
 
 Args:
@@ -270,6 +272,7 @@ class Bintool:
 binary (bool): True to return output as bytes instead of str
 raise_on_error (bool): True to raise a ValueError exception if the
 tool returns a non-zero return code
+add_name (bool): True to add bintool name to the beginning of 
command
 
 Returns:
 CommandResult: Resulting output from the bintool, or None if the
@@ -278,7 +281,10 @@ class Bintool:
 if self.name in self.missing_list:
 return None
 name = os.path.expanduser(self.name)  # Expand paths containing ~
-all_args = (name,) + args
+if add_name:
+all_args = (name,) + args
+else:
+all_args = args
 env = tools.get_env_with_path()
 tout.detail(f"bintool: {' '.join(all_args)}")
 result = command.run_pipe(
@@ -304,18 +310,19 @@ class Bintool:
 tout.debug(result.stderr)
 return result
 
-def run_cmd(self, *args, binary=False):
+def run_cmd(self, *args, binary=False, add_name=True):
 """Run the bintool using command-line arguments
 
 Args:
 args (list of str): Arguments to provide, in addition to the 
bintool
 name
 binary (bool): True to return output as bytes instead of str
+add_name (bool): True to add bintool name to the beginning of 
command
 
 Returns:
 str or bytes: Resulting stdout from the bintool
 """
-result = self.run_cmd_result(*args, binary=binary)
+result = self.run_cmd_result(*args, binary=binary, add_name=add_name)
 if result:
 return result.stdout
 
@@ -354,6 +361,32 @@ class Bintool:
 return None
 return fname, tmpdir
 
+@classmethod
+def fetch_from_git(cls, git_repo, name):
+"""Fetch a bintool git repo
+
+This clones the repo and returns
+
+Args:
+git_repo (str): URL of git repo
+name (str): Bintool name assigned as tool directory name
+
+Returns:
+str: Directory of fetched repo
+or No

[RFC PATCH] binman: bintool: etype: Add support for ti-secure entry

2023-02-24 Thread Neha Malcom Francis
core-secdev-k3 is the TI security development package provided for K3
platform devices. This tool helps sign bootloader images with the x509
ceritificate header.

Signed-off-by: Neha Malcom Francis 
---
This patch depends on 
https://patchwork.ozlabs.org/project/uboot/patch/20230224115101.563729-1-n-fran...@ti.com/
and on ongoing development in 
https://git.ti.com/cgit/security-development-tools/core-secdev-k3

 tools/binman/btool/tisecuretool.py|  72 +++
 tools/binman/etype/ti_secure.py   | 114 ++
 tools/binman/ftest.py |  36 ++
 tools/binman/test/278_ti_secure_rom.dts   |  11 ++
 tools/binman/test/279_ti_secure.dts   |  11 ++
 .../binman/test/280_ti_secure_nofilename.dts  |  10 ++
 tools/binman/test/281_ti_secure_combined.dts  |  12 ++
 7 files changed, 266 insertions(+)
 create mode 100644 tools/binman/btool/tisecuretool.py
 create mode 100644 tools/binman/etype/ti_secure.py
 create mode 100644 tools/binman/test/278_ti_secure_rom.dts
 create mode 100644 tools/binman/test/279_ti_secure.dts
 create mode 100644 tools/binman/test/280_ti_secure_nofilename.dts
 create mode 100644 tools/binman/test/281_ti_secure_combined.dts

diff --git a/tools/binman/btool/tisecuretool.py 
b/tools/binman/btool/tisecuretool.py
new file mode 100644
index 00..5102bb1f7d
--- /dev/null
+++ b/tools/binman/btool/tisecuretool.py
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2022 Texas Instruments Incorporated - https://www.ti.com/
+# Written by Neha Malcom Francis 
+#
+"""Bintool implementation for TI security development tools
+
+tisecuretool helps add x509 certification for bootloader images for K3 
platform devices
+
+Source code:
+https://git.ti.com/cgit/security-development-tools/core-secdev-k3/""";
+
+import os
+
+from binman import bintool
+from patman import tout
+from patman import tools
+
+class Bintooltisecuretool(bintool.Bintool):
+"""Signing tool for TI bootloaders"""
+name = 'tisecuretool'
+def __init__(self, name):
+super().__init__(name, 'TI secure tool')
+
+def sign_binary_secure(self, fname, out_fname):
+"""Create a signed binary
+
+Args:
+fname (str): Filename to sign
+out_fname (str): Output filename
+
+Returns:
+str: Tool output
+or None
+"""
+tool_path = self.get_path()
+script_path = os.path.join(tool_path, 'scripts/secure-binary-image.sh')
+args = [
+'sh',
+script_path,
+fname,
+out_fname
+]
+output = self.run_cmd(*args, add_name=False)
+return output
+
+def sign_binary_rom(self, args):
+"""Create a signed binary that is booted by ROM
+
+Args:
+fname (str): Filename to sign
+out_fname (str): Output filename"""
+tool_path = self.get_path()
+script_path = os.path.join(tool_path, 
'scripts/secure-rom-boot-image.sh')
+#args.insert(0, script_path)
+args.insert(0, script_path)
+output = self.run_cmd(*args, add_name=False)
+return output
+
+def fetch(self, method):
+"""Fetch handler for TI secure tool
+
+This builds the tool from source
+
+Returns:
+True if the file was fetched, None if a method other than 
FETCH_SOURCE
+was requested
+"""
+if method != bintool.FETCH_SOURCE:
+return None
+result = self.fetch_from_git(
+'git://git.ti.com/security-development-tools/core-secdev-k3.git', 
'tisecuretool')
+return result
diff --git a/tools/binman/etype/ti_secure.py b/tools/binman/etype/ti_secure.py
new file mode 100644
index 000000..26f81ff8e8
--- /dev/null
+++ b/tools/binman/etype/ti_secure.py
@@ -0,0 +1,114 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2022 Texas Instruments Incorporated - https://www.ti.com/
+# Written by Neha Malcom Francis 
+#
+# Entry-type module for signed binaries for TI K3 platform
+#
+
+from binman.etype.blob import Entry_blob
+from binman import bintool
+
+from dtoc import fdt_util
+from patman import terminal
+from patman import tools
+from patman import tout
+
+class Entry_ti_secure(Entry_blob):
+"""An entry which contains a signed x509 binary for signing TI
+General Purpose as well as High-Security devices.
+
+Properties / Entry arguments:
+   - filename: filename of binary file to be secured
+
+Output files:
+- filename_x509 - output file generated by secure x509 signing script 
(which
+used as entry contents)
+"""
+def __init__(self, section, etype, node):
+   

Re: [RFC PATCH] binman: bintool: etype: Add support for ti-secure entry

2023-02-28 Thread Neha Malcom Francis

Hi Simon,

On 28/02/23 06:05, Simon Glass wrote:

Hi Neha,

On Fri, 24 Feb 2023 at 05:03, Neha Malcom Francis  wrote:


core-secdev-k3 is the TI security development package provided for K3
platform devices. This tool helps sign bootloader images with the x509
ceritificate header.

Signed-off-by: Neha Malcom Francis 
---
This patch depends on 
https://patchwork.ozlabs.org/project/uboot/patch/20230224115101.563729-1-n-fran...@ti.com/
and on ongoing development in 
https://git.ti.com/cgit/security-development-tools/core-secdev-k3

  tools/binman/btool/tisecuretool.py|  72 +++
  tools/binman/etype/ti_secure.py   | 114 ++
  tools/binman/ftest.py |  36 ++
  tools/binman/test/278_ti_secure_rom.dts   |  11 ++
  tools/binman/test/279_ti_secure.dts   |  11 ++
  .../binman/test/280_ti_secure_nofilename.dts  |  10 ++
  tools/binman/test/281_ti_secure_combined.dts  |  12 ++
  7 files changed, 266 insertions(+)
  create mode 100644 tools/binman/btool/tisecuretool.py
  create mode 100644 tools/binman/etype/ti_secure.py
  create mode 100644 tools/binman/test/278_ti_secure_rom.dts
  create mode 100644 tools/binman/test/279_ti_secure.dts
  create mode 100644 tools/binman/test/280_ti_secure_nofilename.dts
  create mode 100644 tools/binman/test/281_ti_secure_combined.dts


Now that I see what you are doing, this it not quite the right way.

See this hack-up of how you can call the openssl thing. Basically you
should not have a shell script in the way, but instead make your
bintool do it.

https://github.com/sjg20/u-boot/commit/03c0d74f81106570b18d8e4fe7a3355bfeb0d5da#r100378804

I suppose we can have an openssl bintool that others build on top of?

Regards,
Simon




That is possible, maybe ti-secure extends from x509_cert etype so as to 
support the TI specific certificate extensions. I'll start working on this.


However the patches I've sent support external production flow where 
signing need not necessarily be carried out from U-Boot. An external 
repo that acts as what is core-secdev-k3 here, would be the repo 
responsible for signing.


Could we find a way to combine both so as to support production flow 
mandating an external agency, as well as a completely within U-Boot flow 
using bintool? i.e. we modify ti-secure etype to be able to support both 
external git repo/executable script signing as well as default signing 
using openssl bintool.




diff --git a/tools/binman/btool/tisecuretool.py 
b/tools/binman/btool/tisecuretool.py
new file mode 100644
index 00..5102bb1f7d
--- /dev/null
+++ b/tools/binman/btool/tisecuretool.py
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2022 Texas Instruments Incorporated - https://www.ti.com/
+# Written by Neha Malcom Francis 
+#
+"""Bintool implementation for TI security development tools
+
+tisecuretool helps add x509 certification for bootloader images for K3 
platform devices
+
+Source code:
+https://git.ti.com/cgit/security-development-tools/core-secdev-k3/""";
+
+import os
+
+from binman import bintool
+from patman import tout
+from patman import tools
+
+class Bintooltisecuretool(bintool.Bintool):
+"""Signing tool for TI bootloaders"""
+name = 'tisecuretool'
+def __init__(self, name):
+super().__init__(name, 'TI secure tool')
+
+def sign_binary_secure(self, fname, out_fname):
+"""Create a signed binary
+
+Args:
+fname (str): Filename to sign
+out_fname (str): Output filename
+
+Returns:
+str: Tool output
+or None
+"""
+tool_path = self.get_path()
+script_path = os.path.join(tool_path, 'scripts/secure-binary-image.sh')
+args = [
+'sh',
+script_path,
+fname,
+out_fname
+]
+output = self.run_cmd(*args, add_name=False)
+return output
+
+def sign_binary_rom(self, args):
+"""Create a signed binary that is booted by ROM
+
+Args:
+fname (str): Filename to sign
+out_fname (str): Output filename"""
+tool_path = self.get_path()
+script_path = os.path.join(tool_path, 
'scripts/secure-rom-boot-image.sh')
+#args.insert(0, script_path)
+args.insert(0, script_path)
+output = self.run_cmd(*args, add_name=False)
+return output
+
+def fetch(self, method):
+"""Fetch handler for TI secure tool
+
+This builds the tool from source
+
+Returns:
+True if the file was fetched, None if a method other than 
FETCH_SOURCE
+was requested
+"""
+if method != bintool.FETCH_SOURCE:
+return None
+resu

Re: [PATCH v2 2/6] configs: j721s2: merge HS and non-HS defconfigs

2023-03-02 Thread Neha Malcom Francis
=y
-CONFIG_SPL_SPI=y
-CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x41c76000
-# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
-CONFIG_SPL_LOAD_FIT=y
-CONFIG_SPL_LOAD_FIT_ADDRESS=0x8008
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
-CONFIG_USE_BOOTCOMMAND=y
-# CONFIG_DISPLAY_CPUINFO is not set
-CONFIG_SPL_SIZE_LIMIT_SUBTRACT_GD=y
-CONFIG_SPL_SIZE_LIMIT_SUBTRACT_MALLOC=y
-CONFIG_SPL_MAX_SIZE=0xc
-CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x41c76000
-CONFIG_SPL_BSS_MAX_SIZE=0xa000
-CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
-CONFIG_SPL_BOARD_INIT=y
-CONFIG_SPL_SYS_MALLOC_SIMPLE=y
-CONFIG_SPL_STACK_R=y
-CONFIG_SPL_SEPARATE_BSS=y
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x8400
-CONFIG_SYS_SPL_MALLOC_SIZE=0x100
-CONFIG_SPL_EARLY_BSS=y
-CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
-CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
-CONFIG_SPL_DMA=y
-CONFIG_SPL_ENV_SUPPORT=y
-CONFIG_SPL_FS_EXT4=y
-CONFIG_SPL_I2C=y
-CONFIG_SPL_DM_MAILBOX=y
-CONFIG_SPL_MTD_SUPPORT=y
-CONFIG_SPL_DM_SPI_FLASH=y
-CONFIG_SPL_NOR_SUPPORT=y
-CONFIG_SPL_DM_RESET=y
-CONFIG_SPL_POWER_DOMAIN=y
-CONFIG_SPL_RAM_SUPPORT=y
-CONFIG_SPL_RAM_DEVICE=y
-CONFIG_SPL_REMOTEPROC=y
-# CONFIG_SPL_SPI_FLASH_TINY is not set
-CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y
-CONFIG_SPL_SPI_LOAD=y
-CONFIG_SYS_SPI_U_BOOT_OFFS=0x8
-CONFIG_SPL_THERMAL=y
-CONFIG_SPL_USB_GADGET=y
-CONFIG_SPL_DFU=y
-CONFIG_SPL_YMODEM_SUPPORT=y
-CONFIG_HUSH_PARSER=y
-CONFIG_SYS_MAXARGS=64
-CONFIG_SYS_BOOTM_LEN=0x400
-CONFIG_CMD_DFU=y
-# CONFIG_CMD_FLASH is not set
-CONFIG_CMD_GPT=y
-CONFIG_CMD_MMC=y
-CONFIG_CMD_REMOTEPROC=y
-# CONFIG_CMD_SETEXPR is not set
-CONFIG_CMD_TIME=y
-CONFIG_CMD_FAT=y
-CONFIG_OF_CONTROL=y
-CONFIG_SPL_OF_CONTROL=y
-CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_SPL_DM=y
-CONFIG_SPL_DM_SEQ_ALIAS=y
-CONFIG_REGMAP=y
-CONFIG_SPL_REGMAP=y
-CONFIG_SYSCON=y
-CONFIG_SPL_SYSCON=y
-CONFIG_SPL_OF_TRANSLATE=y
-CONFIG_CLK=y
-CONFIG_SPL_CLK=y
-CONFIG_SPL_CLK_CCF=y
-CONFIG_SPL_CLK_K3_PLL=y
-CONFIG_SPL_CLK_K3=y
-CONFIG_SYS_DFU_DATA_BUF_SIZE=0x4
-CONFIG_DMA_CHANNELS=y
-CONFIG_TI_K3_NAVSS_UDMA=y
-CONFIG_TI_SCI_PROTOCOL=y
-CONFIG_DA8XX_GPIO=y
-CONFIG_DM_PCA953X=y
-CONFIG_DM_I2C=y
-CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
-CONFIG_SYS_I2C_OMAP24XX=y
-CONFIG_DM_MAILBOX=y
-CONFIG_K3_SEC_PROXY=y
-CONFIG_FS_LOADER=y
-CONFIG_SPL_FS_LOADER=y
-CONFIG_SUPPORT_EMMC_BOOT=y
-CONFIG_SPL_MMC_HS400_SUPPORT=y
-CONFIG_MMC_SDHCI=y
-CONFIG_SPL_MMC_SDHCI_ADMA=y
-CONFIG_MMC_SDHCI_AM654=y
-CONFIG_MTD=y
-CONFIG_DM_MTD=y
-CONFIG_MTD_NOR_FLASH=y
-CONFIG_FLASH_SHOW_PROGRESS=0
-CONFIG_CFI_FLASH=y
-CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
-CONFIG_FLASH_CFI_MTD=y
-CONFIG_SYS_FLASH_CFI=y
-CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
-CONFIG_DM_SPI_FLASH=y
-CONFIG_SPI_FLASH_SFDP_SUPPORT=y
-CONFIG_SPI_FLASH_SOFT_RESET=y
-CONFIG_SPI_FLASH_SOFT_RESET_ON_BOOT=y
-CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_SPI_FLASH_STMICRO=y
-CONFIG_SPI_FLASH_MT35XU=y
-CONFIG_PINCTRL=y
-# CONFIG_PINCTRL_GENERIC is not set
-CONFIG_SPL_PINCTRL=y
-# CONFIG_SPL_PINCTRL_GENERIC is not set
-CONFIG_PINCTRL_SINGLE=y
-CONFIG_POWER_DOMAIN=y
-CONFIG_TI_POWER_DOMAIN=y
-CONFIG_K3_SYSTEM_CONTROLLER=y
-CONFIG_REMOTEPROC_TI_K3_ARM64=y
-CONFIG_DM_RESET=y
-CONFIG_RESET_TI_SCI=y
-CONFIG_DM_SERIAL=y
-CONFIG_SOC_DEVICE=y
-CONFIG_SOC_DEVICE_TI_K3=y
-CONFIG_SOC_TI=y
-CONFIG_SPI=y
-CONFIG_DM_SPI=y
-CONFIG_CADENCE_QSPI=y
-CONFIG_HAS_CQSPI_REF_CLK=y
-CONFIG_CQSPI_REF_CLK=1
-CONFIG_SYSRESET=y
-CONFIG_SPL_SYSRESET=y
-CONFIG_SYSRESET_TI_SCI=y
-CONFIG_DM_THERMAL=y
-CONFIG_TIMER=y
-CONFIG_SPL_TIMER=y
-CONFIG_OMAP_TIMER=y
-CONFIG_USB=y
-CONFIG_DM_USB_GADGET=y
-CONFIG_SPL_DM_USB_GADGET=y
-CONFIG_USB_CDNS3=y
-CONFIG_USB_CDNS3_GADGET=y
-CONFIG_SPL_USB_CDNS3_GADGET=y
-CONFIG_USB_GADGET=y
-CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
-CONFIG_USB_GADGET_VENDOR_NUM=0x0451
-CONFIG_USB_GADGET_PRODUCT_NUM=0x6168
-CONFIG_USB_GADGET_DOWNLOAD=y
-CONFIG_FS_EXT4=y
-CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
-CONFIG_PANIC_HANG=y
-CONFIG_LIB_RATIONAL=y
-CONFIG_SPL_LIB_RATIONAL=y


NACK, failed on boot test with j721s2-hs

--
Thanking You
Neha Malcom Francis


[PATCH] board: ti: Kconfig: Correct invalid Kconfig syntax

2023-03-03 Thread Neha Malcom Francis
Kconfig does not support using 'select' to select a 'choice'. A choice
can be configured by either setting the choice symbol to 'y' in a
configuration file or by setting a 'default' of the choice.

In board/ti/*/Kconfig the SOC_K3_* choice is already set to 'y' in their
corresponding configs/*_defconfig file. So remove selecting it.

Signed-off-by: Neha Malcom Francis 
---
 board/ti/am62ax/Kconfig | 2 --
 board/ti/am62x/Kconfig  | 2 --
 board/ti/am64x/Kconfig  | 2 --
 board/ti/am65x/Kconfig  | 2 --
 board/ti/j721e/Kconfig  | 4 
 board/ti/j721s2/Kconfig | 2 --
 6 files changed, 14 deletions(-)

diff --git a/board/ti/am62ax/Kconfig b/board/ti/am62ax/Kconfig
index 2c18cd49b5..9b868e4553 100644
--- a/board/ti/am62ax/Kconfig
+++ b/board/ti/am62ax/Kconfig
@@ -10,7 +10,6 @@ choice
 config TARGET_AM62A7_A53_EVM
bool "TI K3 based AM62A7 EVM running on A53"
select ARM64
-   select SOC_K3_AM62A7
imply BOARD
imply SPL_BOARD
imply TI_I2C_BOARD_DETECT
@@ -20,7 +19,6 @@ config TARGET_AM62A7_R5_EVM
select CPU_V7R
select SYS_THUMB_BUILD
select K3_LOAD_SYSFW
-   select SOC_K3_AM62A7
select RAM
select SPL_RAM
select K3_DDRSS
diff --git a/board/ti/am62x/Kconfig b/board/ti/am62x/Kconfig
index 87fed44df1..5e8dfa3cc4 100644
--- a/board/ti/am62x/Kconfig
+++ b/board/ti/am62x/Kconfig
@@ -10,14 +10,12 @@ choice
 config TARGET_AM625_A53_EVM
bool "TI K3 based AM625 EVM running on A53"
select ARM64
-   select SOC_K3_AM625
 
 config TARGET_AM625_R5_EVM
bool "TI K3 based AM625 EVM running on R5"
select CPU_V7R
select SYS_THUMB_BUILD
select K3_LOAD_SYSFW
-   select SOC_K3_AM625
select RAM
select SPL_RAM
select K3_DDRSS
diff --git a/board/ti/am64x/Kconfig b/board/ti/am64x/Kconfig
index 8036947e34..afb54f8cda 100644
--- a/board/ti/am64x/Kconfig
+++ b/board/ti/am64x/Kconfig
@@ -9,7 +9,6 @@ choice
 config TARGET_AM642_A53_EVM
bool "TI K3 based AM642 EVM running on A53"
select ARM64
-   select SOC_K3_AM642
imply BOARD
imply SPL_BOARD
imply TI_I2C_BOARD_DETECT
@@ -19,7 +18,6 @@ config TARGET_AM642_R5_EVM
select CPU_V7R
select SYS_THUMB_BUILD
select K3_LOAD_SYSFW
-   select SOC_K3_AM642
select RAM
select SPL_RAM
select K3_DDRSS
diff --git a/board/ti/am65x/Kconfig b/board/ti/am65x/Kconfig
index 4765b13ba0..220dd0234c 100644
--- a/board/ti/am65x/Kconfig
+++ b/board/ti/am65x/Kconfig
@@ -10,7 +10,6 @@ choice
 config TARGET_AM654_A53_EVM
bool "TI K3 based AM654 EVM running on A53"
select ARM64
-   select SOC_K3_AM654
select SYS_DISABLE_DCACHE_OPS
select BOARD_LATE_INIT
imply TI_I2C_BOARD_DETECT
@@ -19,7 +18,6 @@ config TARGET_AM654_R5_EVM
bool "TI K3 based AM654 EVM running on R5"
select CPU_V7R
select SYS_THUMB_BUILD
-   select SOC_K3_AM654
select K3_LOAD_SYSFW
select K3_AM654_DDRSS
imply SYS_K3_SPL_ATF
diff --git a/board/ti/j721e/Kconfig b/board/ti/j721e/Kconfig
index d19d30d59e..ca8273954a 100644
--- a/board/ti/j721e/Kconfig
+++ b/board/ti/j721e/Kconfig
@@ -10,7 +10,6 @@ choice
 config TARGET_J721E_A72_EVM
bool "TI K3 based J721E EVM running on A72"
select ARM64
-   select SOC_K3_J721E
select BOARD_LATE_INIT
imply TI_I2C_BOARD_DETECT
select SYS_DISABLE_DCACHE_OPS
@@ -19,7 +18,6 @@ config TARGET_J721E_R5_EVM
bool "TI K3 based J721E EVM running on R5"
select CPU_V7R
select SYS_THUMB_BUILD
-   select SOC_K3_J721E
select K3_LOAD_SYSFW
select RAM
select SPL_RAM
@@ -30,7 +28,6 @@ config TARGET_J721E_R5_EVM
 config TARGET_J7200_A72_EVM
bool "TI K3 based J7200 EVM running on A72"
select ARM64
-   select SOC_K3_J721E
select BOARD_LATE_INIT
imply TI_I2C_BOARD_DETECT
select SYS_DISABLE_DCACHE_OPS
@@ -39,7 +36,6 @@ config TARGET_J7200_R5_EVM
bool "TI K3 based J7200 EVM running on R5"
select CPU_V7R
select SYS_THUMB_BUILD
-   select SOC_K3_J721E
select K3_LOAD_SYSFW
select RAM
select SPL_RAM
diff --git a/board/ti/j721s2/Kconfig b/board/ti/j721s2/Kconfig
index 6141798333..067c56a470 100644
--- a/board/ti/j721s2/Kconfig
+++ b/board/ti/j721s2/Kconfig
@@ -10,7 +10,6 @@ choice
 config TARGET_J721S2_A72_EVM
bool "TI K3 based J721S2 EVM running on A72"
select ARM64
-   select SOC_K3_J721S2
select BOARD_LATE_INIT
imply TI_I2C_BOARD_DETECT
select SYS_DISABLE_DCACHE_OPS
@@ -19,7 +18,6 @@ config TARGET_J721S2_R5_EVM
bool "TI K3 based J721S2 EVM running on R5"
select CPU_V7R
select SYS_THUMB_BUILD
-   select SOC_K3_J721S2
select K3_LOAD_SYSFW
select RAM
select SPL_RAM
-- 
2.34.1



Re: [RFC PATCH] binman: bintool: etype: Add support for ti-secure entry

2023-03-09 Thread Neha Malcom Francis

Hi Andrew, Simon

On 01/03/23 22:41, Andrew Davis wrote:

On 2/28/23 9:10 AM, Simon Glass wrote:

Hi Neha,

On Tue, 28 Feb 2023 at 02:50, Neha Malcom Francis  
wrote:


Hi Simon,

On 28/02/23 06:05, Simon Glass wrote:

Hi Neha,

On Fri, 24 Feb 2023 at 05:03, Neha Malcom Francis  
wrote:


core-secdev-k3 is the TI security development package provided for K3
platform devices. This tool helps sign bootloader images with the x509
ceritificate header.

Signed-off-by: Neha Malcom Francis 
---
This patch depends on 
https://patchwork.ozlabs.org/project/uboot/patch/20230224115101.563729-1-n-fran...@ti.com/
and on ongoing development in 
https://git.ti.com/cgit/security-development-tools/core-secdev-k3


   tools/binman/btool/tisecuretool.py    |  72 +++
   tools/binman/etype/ti_secure.py   | 114 
++

   tools/binman/ftest.py |  36 ++
   tools/binman/test/278_ti_secure_rom.dts   |  11 ++
   tools/binman/test/279_ti_secure.dts   |  11 ++
   .../binman/test/280_ti_secure_nofilename.dts  |  10 ++
   tools/binman/test/281_ti_secure_combined.dts  |  12 ++
   7 files changed, 266 insertions(+)
   create mode 100644 tools/binman/btool/tisecuretool.py
   create mode 100644 tools/binman/etype/ti_secure.py
   create mode 100644 tools/binman/test/278_ti_secure_rom.dts
   create mode 100644 tools/binman/test/279_ti_secure.dts
   create mode 100644 tools/binman/test/280_ti_secure_nofilename.dts
   create mode 100644 tools/binman/test/281_ti_secure_combined.dts


Now that I see what you are doing, this it not quite the right way.

See this hack-up of how you can call the openssl thing. Basically you
should not have a shell script in the way, but instead make your
bintool do it.

https://github.com/sjg20/u-boot/commit/03c0d74f81106570b18d8e4fe7a3355bfeb0d5da#r100378804

I suppose we can have an openssl bintool that others build on top of?

Regards,
Simon




That is possible, maybe ti-secure extends from x509_cert etype so as to
support the TI specific certificate extensions. I'll start working on 
this.


However the patches I've sent support external production flow where
signing need not necessarily be carried out from U-Boot. An external
repo that acts as what is core-secdev-k3 here, would be the repo
responsible for signing.

Could we find a way to combine both so as to support production flow
mandating an external agency, as well as a completely within U-Boot flow
using bintool? i.e. we modify ti-secure etype to be able to support both
external git repo/executable script signing as well as default signing
using openssl bintool.


Yes that seems important.

One option is to have binman emit some instructions on how to sign the
image, perhaps a simple data format similar to an fdtmap, with a basic
shell script plus whatever the etype provides. Then the signer can
follow the instructions or run the script.

Another option is to run binman on the signer and have it do the
signing. Would that work?



I'd like to keep the dependencies needed on the signing server as
minimal as possible. We do require the "u-boot-tools" package on
the key servers if folks want to re-package signed FIT images, so
if binman could be reasonably packaged in that package someday
it could be an option.

For now, if binman could generate the x509 file and leave it with the
other boot artifacts then if one needs to re-sign with real keys they
will only need to have openssl sign that cert and append to the image
on the key server, that is simple enough document.

The more difficult part is in re-packaging these signed images.
Our security tools already have a tool to disasemble a FIT image,
sign the components, then re-assemble it[0]. This would work for
u-boot.img and the kernel FIT images, but we would need something
new for re-assembling boot3.bin and tispl.bin. The first boot files
(boot3.bin) is also more complex that simple FIT images in that it
has several variations in format and content based on device family
and type.

The ideal case would be we do not need to pull in the TI security tools
package at all and we could drop this patch. The tools would then only be
needed by folks wanting to sign their images using an external key
server.

If we could have binman learn how to generate/template x509 certs and
have it sign them with openssl, plus add the TI dummy[1] and degenerate[2]
keys to the u-boot source repo, then we would not need TI security
tools any more here.

This might be a longer term goal though, and I think we are already
trying to do too much all at once as is. Perhaps we could take
this current solution posted here with the intent to remove it in
the near future. Thoughts?

Andrew

[0] 
https://git.ti.com/cgit/security-development-tools/core-secdev-k3/tree/scripts/fit-image-secure.sh
[1] 
https://git.ti.com/cgit/security-development-tools/core-secdev-k3/tree/keys/custMpk.pem
[2] 
https://git.ti.com/cgit/security-develop

Re: [RFC PATCH] binman: bintool: etype: Add support for ti-secure entry

2023-03-13 Thread Neha Malcom Francis

Hi Simon

On 11/03/23 02:19, Simon Glass wrote:

Hi,

On Thu, 9 Mar 2023 at 21:35, Neha Malcom Francis  wrote:


Hi Andrew, Simon

On 01/03/23 22:41, Andrew Davis wrote:

On 2/28/23 9:10 AM, Simon Glass wrote:

Hi Neha,

On Tue, 28 Feb 2023 at 02:50, Neha Malcom Francis 
wrote:


Hi Simon,

On 28/02/23 06:05, Simon Glass wrote:

Hi Neha,

On Fri, 24 Feb 2023 at 05:03, Neha Malcom Francis 
wrote:


core-secdev-k3 is the TI security development package provided for K3
platform devices. This tool helps sign bootloader images with the x509
ceritificate header.

Signed-off-by: Neha Malcom Francis 
---
This patch depends on
https://patchwork.ozlabs.org/project/uboot/patch/20230224115101.563729-1-n-fran...@ti.com/
and on ongoing development in
https://git.ti.com/cgit/security-development-tools/core-secdev-k3

tools/binman/btool/tisecuretool.py|  72 +++
tools/binman/etype/ti_secure.py   | 114
++
tools/binman/ftest.py |  36 ++
tools/binman/test/278_ti_secure_rom.dts   |  11 ++
tools/binman/test/279_ti_secure.dts   |  11 ++
.../binman/test/280_ti_secure_nofilename.dts  |  10 ++
tools/binman/test/281_ti_secure_combined.dts  |  12 ++
7 files changed, 266 insertions(+)
create mode 100644 tools/binman/btool/tisecuretool.py
create mode 100644 tools/binman/etype/ti_secure.py
create mode 100644 tools/binman/test/278_ti_secure_rom.dts
create mode 100644 tools/binman/test/279_ti_secure.dts
create mode 100644 tools/binman/test/280_ti_secure_nofilename.dts
create mode 100644 tools/binman/test/281_ti_secure_combined.dts


Now that I see what you are doing, this it not quite the right way.

See this hack-up of how you can call the openssl thing. Basically you
should not have a shell script in the way, but instead make your
bintool do it.

https://github.com/sjg20/u-boot/commit/03c0d74f81106570b18d8e4fe7a3355bfeb0d5da#r100378804

I suppose we can have an openssl bintool that others build on top of?

Regards,
Simon




That is possible, maybe ti-secure extends from x509_cert etype so as to
support the TI specific certificate extensions. I'll start working on
this.

However the patches I've sent support external production flow where
signing need not necessarily be carried out from U-Boot. An external
repo that acts as what is core-secdev-k3 here, would be the repo
responsible for signing.

Could we find a way to combine both so as to support production flow
mandating an external agency, as well as a completely within U-Boot flow
using bintool? i.e. we modify ti-secure etype to be able to support both
external git repo/executable script signing as well as default signing
using openssl bintool.


Yes that seems important.

One option is to have binman emit some instructions on how to sign the
image, perhaps a simple data format similar to an fdtmap, with a basic
shell script plus whatever the etype provides. Then the signer can
follow the instructions or run the script.

Another option is to run binman on the signer and have it do the
signing. Would that work?



I'd like to keep the dependencies needed on the signing server as
minimal as possible. We do require the "u-boot-tools" package on
the key servers if folks want to re-package signed FIT images, so
if binman could be reasonably packaged in that package someday
it could be an option.


At present binman is packaged as binary-manager (with 'pip install').
Is that good enough? We could add it to u-boot-tools, perhaps, but I
have found that packing Python things together with non-Python things
seems to be tricky. We gave up with libfdt and ended up using a
separate package for pylibfdt.



For now, if binman could generate the x509 file and leave it with the
other boot artifacts then if one needs to re-sign with real keys they
will only need to have openssl sign that cert and append to the image
on the key server, that is simple enough document.


I sent a patch to add x509 cert using the openssl tool[1]. If there is
more needed, can you take a look or let me know what is missing?



I had looked at the patch and I think it should support custom 
certificates as well. I think an x509 etype should be able to produce a 
general certificate like what you have done, as well as have the 
capability to add more extensions, change parameters etc. I am thinking 
of a template and dict sort of method where you pass your custom 
template as well as a dict/config file containing 
parameter:parameter-valye pairs for the etype to fill in, does that 
sound okay? Then in use cases like ours where there's more done we could 
extend this etype and use that parse-and-replace mechanism for our 
certificate.




The more difficult part is in re-packaging these signed images.
Our security tools already have a tool to disasemble a FIT image,
sign the components, then re-assemble it[0]. This would work for
u-boot.img

Re: [PATCH v3] binman: bintool: Add support for tool directories

2023-03-13 Thread Neha Malcom Francis

Hi Simon

On 11/03/23 07:17, Simon Glass wrote:

Hi Neha,

On Fri, 24 Feb 2023 at 03:51, Neha Malcom Francis  wrote:


Currently, bintool supports external compilable tools as single
executable files. Adding support for git repos that can be used to run
non-compilable scripting tools that cannot otherwise be present in
binman.

Signed-off-by: Neha Malcom Francis 
---
Changes in v3:
 - moved back to using DOWNLOAD_DIR as community is making
   relevant changes
 - extended coverage for bintool_test.py
 - added function comment for new parameter

Changes in v2:
 - added parameter to obtain path to download the directory
   optionally, enables flexibility to avoid using
   DOWNLOAD_DESTDIR
 - added test to bintool_test.py
 - s/FETCH_NO_BUILD/FETCH_SOURCE
 - code reformatting

  tools/binman/bintool.py| 47 +-
  tools/binman/bintool_test.py   | 43 +++
  tools/binman/btool/_testing.py |  4 +++
  tools/patman/tools.py  |  2 +-
  4 files changed, 88 insertions(+), 8 deletions(-)


I am OK with doing this but worried that it will be used for shell
scripts, which we are trying to avoid.

The code looks OK for now. Perhaps we can revisit this when we have a
use case? I also think we should have each tool individually shown in
the list, rather than having them be 'hidden' behind a btool.



I get the intention, let me know your reply to our thread [1] and we can 
work on it from there.



Regards,
Simon


[1] 
https://patchwork.ozlabs.org/project/uboot/patch/20230224120340.587786-1-n-fran...@ti.com/


--
Thanking You
Neha Malcom Francis


[PATCH 2/3] include: configs: j721s2_evm: Change to using .env

2023-03-14 Thread Neha Malcom Francis
Move to using .env file for setting up environment variables for J721S2.

Signed-off-by: Neha Malcom Francis 
---
 board/ti/j721s2/Kconfig  |   6 ++
 board/ti/j721s2/j721s2.env   |  53 
 include/configs/j721s2_evm.h | 118 +--
 3 files changed, 60 insertions(+), 117 deletions(-)
 create mode 100644 board/ti/j721s2/j721s2.env

diff --git a/board/ti/j721s2/Kconfig b/board/ti/j721s2/Kconfig
index 6141798333..70972d1227 100644
--- a/board/ti/j721s2/Kconfig
+++ b/board/ti/j721s2/Kconfig
@@ -40,6 +40,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "j721s2_evm"
 
+config ENV_SOURCE_FILE
+   default "j721s2"
+
 source "board/ti/common/Kconfig"
 
 endif
@@ -55,6 +58,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "j721s2_evm"
 
+config ENV_SOURCE_FILE
+   default "j721s2"
+
 source "board/ti/common/Kconfig"
 
 endif
diff --git a/board/ti/j721s2/j721s2.env b/board/ti/j721s2/j721s2.env
new file mode 100644
index 00..1eb5549b4c
--- /dev/null
+++ b/board/ti/j721s2/j721s2.env
@@ -0,0 +1,53 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+default_device_tree=k3-j721s2-common-proc-board.dtb
+findfdt=
+   setenv name_fdt ${default_device_tree};
+   if test $board_name = j721s2; then  \
+   setenv name_fdt k3-j721s2-common-proc-board.dtb; fi;
+   if test $board_name = am68-sk; then
+   setenv name_fdt k3-am68-sk-base-board.dtb; fi;
+   setenv fdtfile ${name_fdt}
+name_kern=Image
+console=ttyS2,115200n8
+args_all=setenv optargs earlycon=ns16550a,mmio32,0x0288
+   ${mtdparts}
+run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}
+
+boot=mmc
+mmcdev=1
+bootpart=1:2
+bootdir=/boot
+#if CONFIG_SYS_K3_SPL_ATF
+#if CONFIG_TARGET_J721S2_R5_EVM
+addr_mcur5f0_0load=0x8900
+name_mcur5f0_0fw=/lib/firmware/j7-mcu-r5f0_0-fw
+#endif
+#endif
+rd_spec=-
+init_mmc=run args_all args_mmc
+get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${name_fdt}
+get_overlay_mmc=
+   fdt address ${fdtaddr};
+   fdt resize 0x10;
+   for overlay in $name_overlays;
+   do;
+   load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} &&
+   fdt apply ${dtboaddr};
+   done;
+partitions=uuid_disk=${uuid_gpt_disk};
+   name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}
+get_kern_mmc=load mmc ${bootpart} ${loadaddr}
+   ${bootdir}/${name_kern}
+get_fit_mmc=load mmc ${bootpart} ${addr_fit}
+   ${bootdir}/${name_fit}
+partitions=uuid_disk=${uuid_gpt_disk};
+   name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}
+
+rproc_fw_binaries= 2 /lib/firmware/j721s2-main-r5f0_0-fw 3 
/lib/firmware/j721s2-main-r5f0_1-fw 4 /lib/firmware/j721s2-main-r5f1_0-fw 5 
/lib/firmware/j721s2-main-r5f1_1-fw 6 /lib/firmware/j721s2-c71_0-fw 7 
/lib/firmware/j721s2-c71_1-fw
+
+
diff --git a/include/configs/j721s2_evm.h b/include/configs/j721s2_evm.h
index bfada9eebc..2fa93b7961 100644
--- a/include/configs/j721s2_evm.h
+++ b/include/configs/j721s2_evm.h
@@ -11,10 +11,6 @@
 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
 
 /* DDR Configuration */
 #define CFG_SYS_SDRAM_BASE10x88000
@@ -27,120 +23,8 @@
 #define CFG_SYS_UBOOT_BASE 0x5008
 #endif
 
-/* U-Boot general configuration */
-#define EXTRA_ENV_J721S2_BOARD_SETTINGS
\
-   "default_device_tree=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0"  \
-   "findfdt="  \
-   "setenv name_fdt ${default_device_tree};"   \
-   "if test $board_name = j721s2; then "   \
-   "setenv name_fdt k3-j721s2-common-proc-board.dtb; fi;" \
-   "if test $board_name = am68-sk; then "  \
-   "setenv name_fdt k3-am68-sk-base-board.dtb; fi;"\
-   "setenv fdtfile ${name_fdt}\0"  \
-   "name_kern=Image\0" \
-   "console=ttyS2,115200n8\0"  \
-   "args_all=setenv optargs earlycon=ns16550a,mmio32,0x0288 "  \
-   "${mtdparts}\0" \
-   "run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}\0"
-
-#define PARTS_DEFAULT \
-   /* Linux partitions */ \
-   "uuid_disk=${uuid_gpt_disk};" \
-   "name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}\0"
-
-#ifdef CONFIG_SYS_K3_SPL_ATF
-#if defined(CONFIG_TARGET_J721S2_R5_EVM)
-#define EXTRA_ENV_R5_SPL_RPROC_FW_ARGS_MMC \
-   "addr_mcur5f0_0load=0x8900\0"

[PATCH 1/3] include: environment: ti: Use .env for environment variables

2023-03-14 Thread Neha Malcom Francis
Add K3 common environment variables to .env. We retain the old-style C
environment .h files to maintain compatibility with other K3 boards that
have not moved to using .env yet.

Signed-off-by: Neha Malcom Francis 
---
 include/environment/ti/dfu.env | 54 +++
 include/environment/ti/k3_dfu.env  | 30 +++
 include/environment/ti/k3_rproc.env| 28 ++
 include/environment/ti/mmc.env | 61 ++
 include/environment/ti/nand.env| 14 +
 include/environment/ti/ti_armv7_common.env | 26 +
 include/environment/ti/ufs.env | 22 
 7 files changed, 235 insertions(+)
 create mode 100644 include/environment/ti/dfu.env
 create mode 100644 include/environment/ti/k3_dfu.env
 create mode 100644 include/environment/ti/k3_rproc.env
 create mode 100644 include/environment/ti/mmc.env
 create mode 100644 include/environment/ti/nand.env
 create mode 100644 include/environment/ti/ti_armv7_common.env
 create mode 100644 include/environment/ti/ufs.env

diff --git a/include/environment/ti/dfu.env b/include/environment/ti/dfu.env
new file mode 100644
index 00..2358f22a73
--- /dev/null
+++ b/include/environment/ti/dfu.env
@@ -0,0 +1,54 @@
+dfu_alt_info_mmc=
+   boot part 0 1;
+   rootfs part 0 2;
+   MLO fat 0 1;
+   MLO.raw raw 0x100 0x200;
+   u-boot.img.raw raw 0x300 0x1000;
+   u-env.raw raw 0x1300 0x200;
+   spl-os-args.raw raw 0x1500 0x200;
+   spl-os-image.raw raw 0x1700 0x6900;
+   spl-os-args fat 0 1;
+   spl-os-image fat 0 1;
+   u-boot.img fat 0 1;
+   uEnv.txt fat 0 1
+
+dfu_alt_info_emmc=
+   rawemmc raw 0 3751936;
+   boot part 1 1;
+   rootfs part 1 2;
+   MLO fat 1 1;
+   MLO.raw raw 0x100 0x200;
+   u-boot.img.raw raw 0x300 0x1000;
+   u-env.raw raw 0x1300 0x200;
+   spl-os-args.raw raw 0x1500 0x200;
+   spl-os-image.raw raw 0x1700 0x6900;
+   spl-os-args fat 1 1;
+   spl-os-image fat 1 1;
+   u-boot.img fat 1 1;
+   uEnv.txt fat 1 1
+
+#if CONFIG_MTD_RAW_NAND
+dfu_alt_info_nand=
+   SPL part 0 1;
+   SPL.backup1 part 0 2;
+   SPL.backup2 part 0 3;
+   SPL.backup3 part 0 4;
+   u-boot part 0 5;
+   u-boot-spl-os part 0 6;
+   kernel part 0 8;
+   rootfs part 0 9
+#endif
+
+dfu_alt_info_ram=
+   kernel ram 0x8020 0x400;
+   fdt ram 0x80f8 0x8;
+   ramdisk ram 0x8100 0x400
+
+dfu_alt_info_qspi=
+   u-boot.bin raw 0x0 0x08;
+   u-boot.backup raw 0x08 0x08;
+   u-boot-spl-os raw 0x10 0x01;
+   u-boot-env raw 0x11 0x01;
+   u-boot-env.backup raw 0x12 0x01;
+   kernel raw 0x13 0x80
+
diff --git a/include/environment/ti/k3_dfu.env 
b/include/environment/ti/k3_dfu.env
new file mode 100644
index 00..201529636c
--- /dev/null
+++ b/include/environment/ti/k3_dfu.env
@@ -0,0 +1,30 @@
+dfu_alt_info_mmc=
+   boot part 1 1;
+   rootfs part 1 2;
+   tiboot3.bin fat 1 1;
+   tispl.bin fat 1 1;
+   u-boot.img fat 1 1;
+   uEnv.txt fat 1 1;
+   sysfw.itb fat 1 1
+
+dfu_alt_info_emmc=
+   rawemmc raw 0 0x80 mmcpart 1;
+   rootfs part 0 1 mmcpart 0;
+   tiboot3.bin.raw raw 0x0 0x400 mmcpart 1;
+   tispl.bin.raw raw 0x400 0x1000 mmcpart 1;
+   u-boot.img.raw raw 0x1400 0x2000 mmcpart 1;
+   u-env.raw raw 0x3400 0x100 mmcpart 1;
+   sysfw.itb.raw raw 0x3600 0x800 mmcpart 1
+
+dfu_alt_info_ospi=
+   tiboot3.bin raw 0x0 0x08;
+   tispl.bin raw 0x08 0x20;
+   u-boot.img raw 0x28 0x40;
+   u-boot-env raw 0x68 0x02;
+   sysfw.itb raw 0x6c 0x10;
+   rootfs raw 0x80 0x380
+
+dfu_alt_info_ram=
+   tispl.bin ram 0x8008 0x20;
+   u-boot.img ram 0x8100 0x40
+
diff --git a/include/environment/ti/k3_rproc.env 
b/include/environment/ti/k3_rproc.env
new file mode 100644
index 00..ed19ff4a52
--- /dev/null
+++ b/include/environment/ti/k3_rproc.env
@@ -0,0 +1,28 @@
+#if CONFIG_CMD_REMOTEPROC
+dorprocboot=0
+boot_rprocs=
+   if test ${dorprocboot} -eq 1 && test ${boot} = mmc; then
+   rproc init;
+   run boot_rprocs_mmc;
+   fi;
+rproc_load_and_boot_one=
+   if load mmc ${bootpart} $loadaddr ${rproc_fw}; then
+   if rproc load ${rproc_id} ${loadaddr} ${filesize}; then
+   rproc start ${rproc_id}
+   fi;
+   fi
+boot_rprocs_mmc=
+   env set rproc_id;
+   env set rproc_fw;
+   for i in ${rproc_fw_binaries} ; do
+   if test -z ${rproc_id} ; then
+   env set rproc_id $i;
+   else
+   env set rproc_fw $i;
+   run rproc_load_and_boot_one;
+   env set rproc_id;
+   env set 

[PATCH 3/3] include: configs: j721e_evm: Change to using .env

2023-03-14 Thread Neha Malcom Francis
Move to using .env file for setting up environment variables for J721E
and J7200.

Signed-off-by: Neha Malcom Francis 
---
 board/ti/j721e/Kconfig  |  12 
 board/ti/j721e/j721e.env|  79 +
 include/configs/j721e_evm.h | 134 
 3 files changed, 91 insertions(+), 134 deletions(-)
 create mode 100644 board/ti/j721e/j721e.env

diff --git a/board/ti/j721e/Kconfig b/board/ti/j721e/Kconfig
index d19d30d59e..d5e12183f0 100644
--- a/board/ti/j721e/Kconfig
+++ b/board/ti/j721e/Kconfig
@@ -60,6 +60,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "j721e_evm"
 
+config ENV_SOURCE_FILE
+   default "j721e"
+
 source "board/ti/common/Kconfig"
 
 endif
@@ -75,6 +78,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "j721e_evm"
 
+config ENV_SOURCE_FILE
+   default "j721e"
+
 source "board/ti/common/Kconfig"
 
 endif
@@ -90,6 +96,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "j721e_evm"
 
+config ENV_SOURCE_FILE
+   default "j721e"
+
 source "board/ti/common/Kconfig"
 
 endif
@@ -105,6 +114,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "j721e_evm"
 
+config ENV_SOURCE_FILE
+   default "j721e"
+
 source "board/ti/common/Kconfig"
 
 endif
diff --git a/board/ti/j721e/j721e.env b/board/ti/j721e/j721e.env
new file mode 100644
index 00..e52de5ed1c
--- /dev/null
+++ b/board/ti/j721e/j721e.env
@@ -0,0 +1,79 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+default_device_tree=k3-j721e-common-proc-board.dtb
+findfdt=
+   setenv name_fdt ${default_device_tree};
+   if test $board_name = j721e; then
+   setenv name_fdt k3-j721e-common-proc-board.dtb; fi;
+   if test $board_name = j721e-eaik || test $board_name = j721e-sk; then
+   setenv name_fdt k3-j721e-sk.dtb; fi;
+   setenv fdtfile ${name_fdt}
+name_kern=Image
+console=ttyS2,115200n8
+args_all=setenv optargs earlycon=ns16550a,mmio32,0x0280
+   ${mtdparts}
+run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}
+
+#if CONFIG_SYS_K3_SPL_ATF
+#if CONFIG_TARGET_J721E_R5_EVM
+addr_mcur5f0_0load=0x8900
+name_mcur5f0_0fw=/lib/firmware/j7-mcu-r5f0_0-fw
+#elif CONFIG_TARGET_J7200_R5_EVM
+addr_mcur5f0_0load=0x8900
+name_mcur5f0_0fw=/lib/firmware/j7200-mcu-r5f0_0-fw
+#endif
+#endif
+
+boot=mmc
+mmcdev=1
+bootpart=1:2
+bootdir=/boot
+rd_spec=-
+init_mmc=run args_all args_mmc
+get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${name_fdt}
+get_overlay_mmc=
+   fdt address ${fdtaddr};
+   fdt resize 0x10;
+   for overlay in $name_overlays;
+   do;
+   load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} &&
+   fdt apply ${dtboaddr};
+   done;
+partitions=uuid_disk=${uuid_gpt_disk};
+   name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}
+get_kern_mmc=load mmc ${bootpart} ${loadaddr}
+   ${bootdir}/${name_kern}
+get_fit_mmc=load mmc ${bootpart} ${addr_fit}
+   ${bootdir}/${name_fit}
+
+#if CONFIG_TARGET_J7200_A72_EVM
+do_main_cpsw0_qsgmii_phyinit=1
+init_main_cpsw0_qsgmii_phy=gpio set gpio@22_17;
+   gpio clear gpio@22_16
+main_cpsw0_qsgmii_phyinit=
+   if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1 && test ${dorprocboot} 
-eq 1 && test ${boot} = mmc; then
+   run init_main_cpsw0_qsgmii_phy;
+   fi;
+#elif CONFIG_TARGET_J721E_A72_EVM
+init_main_cpsw0_qsgmii_phy=gpio set gpio@22_17;
+   gpio clear gpio@22_16
+main_cpsw0_qsgmii_phyinit=
+   if test $board_name = J721EX-PM1-SOM || test $board_name = 
J721EX-PM2-SOM || test $board_name = j721e; then
+   do_main_cpsw0_qsgmii_phyinit=1; else
+   do_main_cpsw0_qsgmii_phyinit=0; fi;
+   if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1 && test ${dorprocboot} 
-eq 1 && test ${boot} = mmc; then
+   run init_main_cpsw0_qsgmii_phy; \
+   fi;
+#endif
+
+#if CONFIG_TARGET_J721E_A72_EVM
+rproc_fw_binaries=2 /lib/firmware/j7-main-r5f0_0-fw 3 
/lib/firmware/j7-main-r5f0_1-fw 4 /lib/firmware/j7-main-r5f1_0-fw 5 
/lib/firmware/j7-main-r5f1_1-fw 6 /lib/firmware/j7-c66_0-fw 7 
/lib/firmware/j7-c66_1-fw 8 /lib/firmware/j7-c71_0-fw
+#endif
+
+#if CONFIG_TARGET_J7200_A72_EVM
+rproc_fw_binaries=2 /lib/firmware/j7200-main-r5f0_0-fw 3 
/lib/firmware/j7200-main-r5f0_1-fw
+#endif
diff --git a/include/configs/j721e_evm.h b/include/configs/j721e_evm.h
index 48b1cea6e3..de92cd48fb 100644
--- a/include/configs/j721e_evm.h
+++ b/include/configs/j721e_evm.h
@@ -10,10 +10,6 @@
 #define __CONFIG_J721E_EVM_H
 
 #include 
-#include 
-#include 
-#include 
-#include 
 
 /* DDR Configuration */
 #define CFG_SYS_SDRAM_BASE10x88000
@@ -28,127 +24,6 @@
 #define CFG_SYS_UBOOT_BASE 0x5008
 #endif
 
-/* HyperFlash related configuration */
-
-/* U-Boot gene

Re: [PATCH 1/3] include: environment: ti: Use .env for environment variables

2023-03-14 Thread Neha Malcom Francis

Hi Tom,

On 14/03/23 22:17, Tom Rini wrote:

On Tue, Mar 14, 2023 at 04:07:50PM +0530, Neha Malcom Francis wrote:


Add K3 common environment variables to .env. We retain the old-style C
environment .h files to maintain compatibility with other K3 boards that
have not moved to using .env yet.

Signed-off-by: Neha Malcom Francis 


Thanks for starting this off, a few comments:


+#if CONFIG_MTD_RAW_NAND
+dfu_alt_info_nand=
+   SPL part 0 1;
+   SPL.backup1 part 0 2;
+   SPL.backup2 part 0 3;
+   SPL.backup3 part 0 4;
+   u-boot part 0 5;
+   u-boot-spl-os part 0 6;
+   kernel part 0 8;
+   rootfs part 0 9
+#endif


We don't guard any of the other dfu_alt_innfo_xxx options, so I don't
think we need to here either.  If it's a concern about having the
variables when we don't have the support, perhaps a slightly different
structure of the files makes sense? All of the NAND variables in a
nand.env, emmc in emmc.env, etc.


diff --git a/include/environment/ti/k3_rproc.env 
b/include/environment/ti/k3_rproc.env
new file mode 100644
index 00..ed19ff4a52
--- /dev/null
+++ b/include/environment/ti/k3_rproc.env
@@ -0,0 +1,28 @@
+#if CONFIG_CMD_REMOTEPROC


We should guard including this file or not based on REMOTEPROC, not the
contents.


+#define CFG_SYS_SDRAM_BASE 0x8000


I don't see this used anywhere else, please drop it.  Everything else
seems fine, thanks!



Thanks for the comments, I'll send v2 soon!

--
Thanking You
Neha Malcom Francis


Re: [PATCH 1/3] include: environment: ti: Use .env for environment variables

2023-03-14 Thread Neha Malcom Francis

Hi Tom,

On 15/03/23 09:35, Neha Malcom Francis wrote:

Hi Tom,

On 14/03/23 22:17, Tom Rini wrote:

On Tue, Mar 14, 2023 at 04:07:50PM +0530, Neha Malcom Francis wrote:


Add K3 common environment variables to .env. We retain the old-style C
environment .h files to maintain compatibility with other K3 boards that
have not moved to using .env yet.

Signed-off-by: Neha Malcom Francis 


Thanks for starting this off, a few comments:


+#if CONFIG_MTD_RAW_NAND
+dfu_alt_info_nand=
+    SPL part 0 1;
+    SPL.backup1 part 0 2;
+    SPL.backup2 part 0 3;
+    SPL.backup3 part 0 4;
+    u-boot part 0 5;
+    u-boot-spl-os part 0 6;
+    kernel part 0 8;
+    rootfs part 0 9
+#endif


We don't guard any of the other dfu_alt_innfo_xxx options, so I don't
think we need to here either.  If it's a concern about having the
variables when we don't have the support, perhaps a slightly different
structure of the files makes sense? All of the NAND variables in a
nand.env, emmc in emmc.env, etc.



Left out this reply in the earlier email, but I will drop the addition 
of this file altogether in this patch series as none of the K3 boards 
use it. If extending to the older boards later, we can do like you 
suggest with separate files for each.


diff --git a/include/environment/ti/k3_rproc.env 
b/include/environment/ti/k3_rproc.env

new file mode 100644
index 00..ed19ff4a52
--- /dev/null
+++ b/include/environment/ti/k3_rproc.env
@@ -0,0 +1,28 @@
+#if CONFIG_CMD_REMOTEPROC


We should guard including this file or not based on REMOTEPROC, not the
contents.


+#define CFG_SYS_SDRAM_BASE    0x8000


I don't see this used anywhere else, please drop it.  Everything else
seems fine, thanks!



Thanks for the comments, I'll send v2 soon!



--
Thanking You
Neha Malcom Francis


[PATCH v2 1/3] include: environment: ti: Use .env for environment variables

2023-03-14 Thread Neha Malcom Francis
Add K3 common environment variables to .env. We retain the old-style C
environment .h files to maintain compatibility with other K3 boards that
have not moved to using .env yet.

Signed-off-by: Neha Malcom Francis 
---
Changes in v2:
- removed addition of dfu.env as none of the K3 boards use it
- removed CONFIG_CMD_REMOTEPROC guard
- removed CFG_SYS_SDRAM_BASE

 include/environment/ti/k3_dfu.env  | 30 +++
 include/environment/ti/k3_rproc.env| 26 +
 include/environment/ti/mmc.env | 61 ++
 include/environment/ti/nand.env| 14 +
 include/environment/ti/ti_armv7_common.env | 24 +
 include/environment/ti/ufs.env | 22 
 6 files changed, 177 insertions(+)
 create mode 100644 include/environment/ti/k3_dfu.env
 create mode 100644 include/environment/ti/k3_rproc.env
 create mode 100644 include/environment/ti/mmc.env
 create mode 100644 include/environment/ti/nand.env
 create mode 100644 include/environment/ti/ti_armv7_common.env
 create mode 100644 include/environment/ti/ufs.env

diff --git a/include/environment/ti/k3_dfu.env 
b/include/environment/ti/k3_dfu.env
new file mode 100644
index 00..201529636c
--- /dev/null
+++ b/include/environment/ti/k3_dfu.env
@@ -0,0 +1,30 @@
+dfu_alt_info_mmc=
+   boot part 1 1;
+   rootfs part 1 2;
+   tiboot3.bin fat 1 1;
+   tispl.bin fat 1 1;
+   u-boot.img fat 1 1;
+   uEnv.txt fat 1 1;
+   sysfw.itb fat 1 1
+
+dfu_alt_info_emmc=
+   rawemmc raw 0 0x80 mmcpart 1;
+   rootfs part 0 1 mmcpart 0;
+   tiboot3.bin.raw raw 0x0 0x400 mmcpart 1;
+   tispl.bin.raw raw 0x400 0x1000 mmcpart 1;
+   u-boot.img.raw raw 0x1400 0x2000 mmcpart 1;
+   u-env.raw raw 0x3400 0x100 mmcpart 1;
+   sysfw.itb.raw raw 0x3600 0x800 mmcpart 1
+
+dfu_alt_info_ospi=
+   tiboot3.bin raw 0x0 0x08;
+   tispl.bin raw 0x08 0x20;
+   u-boot.img raw 0x28 0x40;
+   u-boot-env raw 0x68 0x02;
+   sysfw.itb raw 0x6c 0x10;
+   rootfs raw 0x80 0x380
+
+dfu_alt_info_ram=
+   tispl.bin ram 0x8008 0x20;
+   u-boot.img ram 0x8100 0x40
+
diff --git a/include/environment/ti/k3_rproc.env 
b/include/environment/ti/k3_rproc.env
new file mode 100644
index 00..21dad7b241
--- /dev/null
+++ b/include/environment/ti/k3_rproc.env
@@ -0,0 +1,26 @@
+dorprocboot=0
+boot_rprocs=
+   if test ${dorprocboot} -eq 1 && test ${boot} = mmc; then
+   rproc init;
+   run boot_rprocs_mmc;
+   fi;
+rproc_load_and_boot_one=
+   if load mmc ${bootpart} $loadaddr ${rproc_fw}; then
+   if rproc load ${rproc_id} ${loadaddr} ${filesize}; then
+   rproc start ${rproc_id}
+   fi;
+   fi
+boot_rprocs_mmc=
+   env set rproc_id;
+   env set rproc_fw;
+   for i in ${rproc_fw_binaries} ; do
+   if test -z ${rproc_id} ; then
+   env set rproc_id $i;
+   else
+   env set rproc_fw $i;
+   run rproc_load_and_boot_one;
+   env set rproc_id;
+   env set rproc_fw;
+   fi;
+   done
+
diff --git a/include/environment/ti/mmc.env b/include/environment/ti/mmc.env
new file mode 100644
index 00..5677d057d8
--- /dev/null
+++ b/include/environment/ti/mmc.env
@@ -0,0 +1,61 @@
+mmcdev=0
+mmcrootfstype=ext4 rootwait
+finduuid=part uuid ${boot} ${bootpart} uuid
+args_mmc=run finduuid;setenv bootargs console=${console}
+   ${optargs}
+   root=PARTUUID=${uuid} rw
+   rootfstype=${mmcrootfstype}
+loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr
+bootscript=echo Running bootscript from mmc${mmcdev} ...;
+   source ${loadaddr}
+bootenvfile=uEnv.txt
+importbootenv=echo Importing environment from mmc${mmcdev} ...;
+   env import -t ${loadaddr} ${filesize}
+loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
+loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
+loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
+envboot=mmc dev ${mmcdev};
+   if mmc rescan; then
+   echo SD/MMC found on device ${mmcdev};
+   if run loadbootscript; then
+   run bootscript;
+   else
+   if run loadbootenv; then
+   echo Loaded env from ${bootenvfile};
+   run importbootenv;
+   fi;
+   if test -n $uenvcmd; then
+   echo Running uenvcmd ...;
+   run uenvcmd;
+   fi;
+   fi;
+   fi;
+mmcloados=
+   if test ${boot_fdt} = yes || test ${boot_fdt} = try; then
+   if run loadf

[PATCH v2 2/3] include: configs: j721s2_evm: Change to using .env

2023-03-14 Thread Neha Malcom Francis
Move to using .env file for setting up environment variables for J721S2.

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Tom Rini 
---
Changes in v2:
- Added CONFIG_CMD_REMOTEPROC guard to including k3_rproc.env
- Retained Reviewed-by tag

 board/ti/j721s2/Kconfig  |   6 ++
 board/ti/j721s2/j721s2.env   |  56 +
 include/configs/j721s2_evm.h | 118 +--
 3 files changed, 63 insertions(+), 117 deletions(-)
 create mode 100644 board/ti/j721s2/j721s2.env

diff --git a/board/ti/j721s2/Kconfig b/board/ti/j721s2/Kconfig
index 6141798333..70972d1227 100644
--- a/board/ti/j721s2/Kconfig
+++ b/board/ti/j721s2/Kconfig
@@ -40,6 +40,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "j721s2_evm"
 
+config ENV_SOURCE_FILE
+   default "j721s2"
+
 source "board/ti/common/Kconfig"
 
 endif
@@ -55,6 +58,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "j721s2_evm"
 
+config ENV_SOURCE_FILE
+   default "j721s2"
+
 source "board/ti/common/Kconfig"
 
 endif
diff --git a/board/ti/j721s2/j721s2.env b/board/ti/j721s2/j721s2.env
new file mode 100644
index 00..2152f8849f
--- /dev/null
+++ b/board/ti/j721s2/j721s2.env
@@ -0,0 +1,56 @@
+#include 
+#include 
+#include 
+#include 
+
+#if CONFIG_CMD_REMOTEPROC
+#include 
+#endif
+
+default_device_tree=k3-j721s2-common-proc-board.dtb
+findfdt=
+   setenv name_fdt ${default_device_tree};
+   if test $board_name = j721s2; then  \
+   setenv name_fdt k3-j721s2-common-proc-board.dtb; fi;
+   if test $board_name = am68-sk; then
+   setenv name_fdt k3-am68-sk-base-board.dtb; fi;
+   setenv fdtfile ${name_fdt}
+name_kern=Image
+console=ttyS2,115200n8
+args_all=setenv optargs earlycon=ns16550a,mmio32,0x0288
+   ${mtdparts}
+run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}
+
+boot=mmc
+mmcdev=1
+bootpart=1:2
+bootdir=/boot
+#if CONFIG_SYS_K3_SPL_ATF
+#if CONFIG_TARGET_J721S2_R5_EVM
+addr_mcur5f0_0load=0x8900
+name_mcur5f0_0fw=/lib/firmware/j7-mcu-r5f0_0-fw
+#endif
+#endif
+rd_spec=-
+init_mmc=run args_all args_mmc
+get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${name_fdt}
+get_overlay_mmc=
+   fdt address ${fdtaddr};
+   fdt resize 0x10;
+   for overlay in $name_overlays;
+   do;
+   load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} &&
+   fdt apply ${dtboaddr};
+   done;
+partitions=uuid_disk=${uuid_gpt_disk};
+   name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}
+get_kern_mmc=load mmc ${bootpart} ${loadaddr}
+   ${bootdir}/${name_kern}
+get_fit_mmc=load mmc ${bootpart} ${addr_fit}
+   ${bootdir}/${name_fit}
+partitions=uuid_disk=${uuid_gpt_disk};
+   name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}
+
+rproc_fw_binaries= 2 /lib/firmware/j721s2-main-r5f0_0-fw 3 
/lib/firmware/j721s2-main-r5f0_1-fw 4 /lib/firmware/j721s2-main-r5f1_0-fw 5 
/lib/firmware/j721s2-main-r5f1_1-fw 6 /lib/firmware/j721s2-c71_0-fw 7 
/lib/firmware/j721s2-c71_1-fw
+
+
diff --git a/include/configs/j721s2_evm.h b/include/configs/j721s2_evm.h
index bfada9eebc..2fa93b7961 100644
--- a/include/configs/j721s2_evm.h
+++ b/include/configs/j721s2_evm.h
@@ -11,10 +11,6 @@
 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
 
 /* DDR Configuration */
 #define CFG_SYS_SDRAM_BASE10x88000
@@ -27,120 +23,8 @@
 #define CFG_SYS_UBOOT_BASE 0x5008
 #endif
 
-/* U-Boot general configuration */
-#define EXTRA_ENV_J721S2_BOARD_SETTINGS
\
-   "default_device_tree=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0"  \
-   "findfdt="  \
-   "setenv name_fdt ${default_device_tree};"   \
-   "if test $board_name = j721s2; then "   \
-   "setenv name_fdt k3-j721s2-common-proc-board.dtb; fi;" \
-   "if test $board_name = am68-sk; then "  \
-   "setenv name_fdt k3-am68-sk-base-board.dtb; fi;"\
-   "setenv fdtfile ${name_fdt}\0"  \
-   "name_kern=Image\0" \
-   "console=ttyS2,115200n8\0"  \
-   "args_all=setenv optargs earlycon=ns16550a,mmio32,0x0288 "  \
-   "${mtdparts}\0" \
-   "run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}\0"
-
-#define PARTS_DEFAULT \
-   /* Linux partitions */ \
-   "uuid_disk=${uuid_gpt_disk};" \
-   "name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}\0"
-
-#ifdef CONFIG_SYS_K3_SPL_ATF
-#if defined(CONFIG_

[PATCH v2 3/3] include: configs: j721e_evm: Change to using .env

2023-03-14 Thread Neha Malcom Francis
Move to using .env file for setting up environment variables for J721E
and J7200.

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Tom Rini 
---
Changes in v2:
- Added CONFIG_CMD_REMOTEPROC guard to including k3_rproc.env
- Retained Reviewed-by tag

 board/ti/j721e/Kconfig  |  12 
 board/ti/j721e/j721e.env|  82 ++
 include/configs/j721e_evm.h | 134 
 3 files changed, 94 insertions(+), 134 deletions(-)
 create mode 100644 board/ti/j721e/j721e.env

diff --git a/board/ti/j721e/Kconfig b/board/ti/j721e/Kconfig
index d19d30d59e..d5e12183f0 100644
--- a/board/ti/j721e/Kconfig
+++ b/board/ti/j721e/Kconfig
@@ -60,6 +60,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "j721e_evm"
 
+config ENV_SOURCE_FILE
+   default "j721e"
+
 source "board/ti/common/Kconfig"
 
 endif
@@ -75,6 +78,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "j721e_evm"
 
+config ENV_SOURCE_FILE
+   default "j721e"
+
 source "board/ti/common/Kconfig"
 
 endif
@@ -90,6 +96,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "j721e_evm"
 
+config ENV_SOURCE_FILE
+   default "j721e"
+
 source "board/ti/common/Kconfig"
 
 endif
@@ -105,6 +114,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "j721e_evm"
 
+config ENV_SOURCE_FILE
+   default "j721e"
+
 source "board/ti/common/Kconfig"
 
 endif
diff --git a/board/ti/j721e/j721e.env b/board/ti/j721e/j721e.env
new file mode 100644
index 00..446395adfa
--- /dev/null
+++ b/board/ti/j721e/j721e.env
@@ -0,0 +1,82 @@
+#include 
+#include 
+#include 
+#include 
+
+#if CONFIG_CMD_REMOTEPROC
+#include 
+#endif
+
+default_device_tree=k3-j721e-common-proc-board.dtb
+findfdt=
+   setenv name_fdt ${default_device_tree};
+   if test $board_name = j721e; then
+   setenv name_fdt k3-j721e-common-proc-board.dtb; fi;
+   if test $board_name = j721e-eaik || test $board_name = j721e-sk; then
+   setenv name_fdt k3-j721e-sk.dtb; fi;
+   setenv fdtfile ${name_fdt}
+name_kern=Image
+console=ttyS2,115200n8
+args_all=setenv optargs earlycon=ns16550a,mmio32,0x0280
+   ${mtdparts}
+run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}
+
+#if CONFIG_SYS_K3_SPL_ATF
+#if CONFIG_TARGET_J721E_R5_EVM
+addr_mcur5f0_0load=0x8900
+name_mcur5f0_0fw=/lib/firmware/j7-mcu-r5f0_0-fw
+#elif CONFIG_TARGET_J7200_R5_EVM
+addr_mcur5f0_0load=0x8900
+name_mcur5f0_0fw=/lib/firmware/j7200-mcu-r5f0_0-fw
+#endif
+#endif
+
+boot=mmc
+mmcdev=1
+bootpart=1:2
+bootdir=/boot
+rd_spec=-
+init_mmc=run args_all args_mmc
+get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${name_fdt}
+get_overlay_mmc=
+   fdt address ${fdtaddr};
+   fdt resize 0x10;
+   for overlay in $name_overlays;
+   do;
+   load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} &&
+   fdt apply ${dtboaddr};
+   done;
+partitions=uuid_disk=${uuid_gpt_disk};
+   name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}
+get_kern_mmc=load mmc ${bootpart} ${loadaddr}
+   ${bootdir}/${name_kern}
+get_fit_mmc=load mmc ${bootpart} ${addr_fit}
+   ${bootdir}/${name_fit}
+
+#if CONFIG_TARGET_J7200_A72_EVM
+do_main_cpsw0_qsgmii_phyinit=1
+init_main_cpsw0_qsgmii_phy=gpio set gpio@22_17;
+   gpio clear gpio@22_16
+main_cpsw0_qsgmii_phyinit=
+   if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1 && test ${dorprocboot} 
-eq 1 && test ${boot} = mmc; then
+   run init_main_cpsw0_qsgmii_phy;
+   fi;
+#elif CONFIG_TARGET_J721E_A72_EVM
+init_main_cpsw0_qsgmii_phy=gpio set gpio@22_17;
+   gpio clear gpio@22_16
+main_cpsw0_qsgmii_phyinit=
+   if test $board_name = J721EX-PM1-SOM || test $board_name = 
J721EX-PM2-SOM || test $board_name = j721e; then
+   do_main_cpsw0_qsgmii_phyinit=1; else
+   do_main_cpsw0_qsgmii_phyinit=0; fi;
+   if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1 && test ${dorprocboot} 
-eq 1 && test ${boot} = mmc; then
+   run init_main_cpsw0_qsgmii_phy; \
+   fi;
+#endif
+
+#if CONFIG_TARGET_J721E_A72_EVM
+rproc_fw_binaries=2 /lib/firmware/j7-main-r5f0_0-fw 3 
/lib/firmware/j7-main-r5f0_1-fw 4 /lib/firmware/j7-main-r5f1_0-fw 5 
/lib/firmware/j7-main-r5f1_1-fw 6 /lib/firmware/j7-c66_0-fw 7 
/lib/firmware/j7-c66_1-fw 8 /lib/firmware/j7-c71_0-fw
+#endif
+
+#if CONFIG_TARGET_J7200_A72_EVM
+rproc_fw_binaries=2 /lib/firmware/j7200-main-r5f0_0-fw 3 
/lib/firmware/j7200-main-r5f0_1-fw
+#endif
diff --git a/include/configs/j721e_evm.h b/include/configs/j721e_evm.h
index 48b1cea6e3..de92cd48fb 100644
--- a/include/configs/j721e_evm.h
+++ b/include/configs/j721e_evm.h
@@ -10,10 +10,6 @@
 #define __CONFIG_J721E_EVM_H
 
 #include 
-#include 
-#include 
-#include 
-#include 
 
 /* DDR Configuration */
 #define 

[PATCH v5 00/23] Migration to using binman for bootloader

2023-07-07 Thread Neha Malcom Francis
This series aims to eliminate the use of additional custom repositories
such as k3-image-gen (K3 Image Generation) repo and core-secdev-k3 (K3
Security Development Tools) that was plumbed into the U-Boot build flow
to generate boot images for TI K3 platform devices. And instead, we move
towards using binman that aligns better with the community standard build
flow.

This series uses binman for all K3 platforms supported on U-Boot currently;
both HS (High Security, both SE and FS) and GP (General Purpose) devices.

Background on using k3-image-gen:
* TI K3 devices require a SYSFW (System Firmware) image consisting
of a signed system firmware image and board configuration binaries,
this is needed to bring up system firmware during U-Boot R5 SPL
startup.
* Board configuration data contain board-specific information
such as resource management, power management and security.

Background on using core-secdev-k3:
* Contains resources to sign x509 certificates for HS devices

Series intends to use binman to take over the packaging and signing for
the R5 bootloader images tiboot3.bin (and sysfw.itb, for non-combined
boot flow) instead of k3-image-gen.

Series also packages the A72/A53 bootloader images (tispl.bin and
u-boot.img) using ATF, OPTEE and DM (Device Manager)

Changes in v5:
- updated all board configurations to latest
- changed output binary filenames
- fixed multiple certificate generation leading to packaging
  inconsistency in ti-secure*.py
- added patch to overwrite symlink if exists, patch 21/23
  ("binman: Overwrite symlink if it already exists")

Changes in v4:
- added support for iot2050
- documentation fixes
- move to using self.Raise in ti-board-config etype
- introduced common k3-binman.dtsi (further reduction in code
  duplication can be targeted, this as first step)

Changes in v3:
- added support for HS-FS devices
- added support for AM68-sk
- added back dropped documentation patch
- changed prefix for SYSFW and DM files to expected directory
  name
- extended test coverage to 100%
- documentation fixes
- corrected formatting changes

Changes in v2:
- removed all external scripts
- created ti-board-config etype to support generation of board
  config binaries
- created ti-secure and ti-secure-rom etypes to handle signing
  instead of using external TI_SECURE_DEV_PKG
- updated openssl btool to support x509 certificate generation
- dropped Makefile changes to obtain external binary components,
  moving to using BINMAN_INDIRS to achieve the same

CI/CD passes 100% (with series rebased on -master, current series based
on -next) [1]

v1: 
https://patchwork.ozlabs.org/project/uboot/cover/20230120101903.179959-1-n-fran...@ti.com/
v2: 
https://patchwork.ozlabs.org/project/uboot/cover/20230404121342.446935-1-n-fran...@ti.com/
v3: 
https://patchwork.ozlabs.org/project/uboot/cover/20230421123203.1315330-1-n-fran...@ti.com/
 
v4: 
https://patchwork.ozlabs.org/project/uboot/cover/20230518142713.184164-1-n-fran...@ti.com/

[1] https://github.com/u-boot/u-boot/pull/341

Andrew Davis (1):
  binman: Overwrite symlink if it already exists

Neha Malcom Francis (20):
  binman: ti-board-config: Add support for TI board config binaries
  binman: ti-secure: Add support for TI signing
  arm: dts: k3: Add support for packaging sysfw.itb and tiboot3.bin
  j721e: schema: yaml: Add general schema and J721E board config files
  j721e: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin,
u-boot.img
  j7200: yaml: Add J7200 board config files
  j7200: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img
  am65x: yaml: Add AM65x board config files
  am65: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin,
u-boot.img
  am64x: yaml: Add board configs for AM64x
  am64x: dts: binman: Package tiboot3.bin, tispl.bin u-boot.img
  j721s2: yaml: Add board configs for J721S2
  j721s2: dts: binman: Package tiboot3.bin, tispl.bin and u-boot.img
  am62: yaml: Add board configs for AM62
  am625: dts: binman: Package tiboot3.bin, tispl.bin and u-boot.img
  am62a: yaml: Add board configs for AM62ax
  am62a: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img
  arm: k3-am65x-iot2050: Use binman for tispl.bin for iot2050
  k3: tools: config.mk: Update makefile and remove scripts
  doc: board: ti: Update documentation for binman flow

Tom Rini (2):
  buildman: Create a requirements.txt file
  CI: Make use of buildman requirements.txt

 .azure-pipelines.yml  |4 +
 .gitlab-ci.yml|4 +
 arch/arm/dts/k3-am625-r5-sk.dts   |1 +
 arch/arm/dts/k3-am625-sk-binman.dtsi  |  463 +++
 arch/arm/dts/k3-am625-sk-u-boot.dtsi  |2 +
 arch/arm/dts/k3-am62a-sk-b

[PATCH v5 01/23] binman: ti-board-config: Add support for TI board config binaries

2023-07-07 Thread Neha Malcom Francis
The ti-board-config entry loads and validates a given YAML config file
against a given schema, and generates the board config binary. K3
devices require these binaries to be packed into the final system
firmware images.

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
---
 tools/binman/entries.rst  |  48 
 tools/binman/etype/ti_board_config.py | 259 ++
 tools/binman/ftest.py |  20 ++
 tools/binman/test/277_ti_board_cfg.dts|  14 +
 .../binman/test/278_ti_board_cfg_combined.dts |  25 ++
 .../binman/test/279_ti_board_cfg_no_type.dts  |  11 +
 tools/binman/test/yaml/config.yaml|  19 ++
 tools/binman/test/yaml/schema.yaml|  51 
 tools/binman/test/yaml/schema_notype.yaml |  40 +++
 9 files changed, 487 insertions(+)
 create mode 100644 tools/binman/etype/ti_board_config.py
 create mode 100644 tools/binman/test/277_ti_board_cfg.dts
 create mode 100644 tools/binman/test/278_ti_board_cfg_combined.dts
 create mode 100644 tools/binman/test/279_ti_board_cfg_no_type.dts
 create mode 100644 tools/binman/test/yaml/config.yaml
 create mode 100644 tools/binman/test/yaml/schema.yaml
 create mode 100644 tools/binman/test/yaml/schema_notype.yaml

diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index b71af801fd..14a2d03fad 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -1658,6 +1658,54 @@ by setting the size of the entry to something larger 
than the text.
 
 
 
+.. _etype_ti_board_config:
+
+Entry: ti-board-config: An entry containing a TI schema validated board config 
binary
+-
+
+This etype supports generation of two kinds of board configuration
+binaries: singular board config binary as well as combined board config
+binary.
+
+Properties / Entry arguments:
+- config-file: File containing board configuration data in YAML
+- schema-file: File containing board configuration YAML schema against
+  which the config file is validated
+
+Output files:
+- board config binary: File containing board configuration binary
+
+These above parameters are used only when the generated binary is
+intended to be a single board configuration binary. Example::
+
+my-ti-board-config {
+ti-board-config {
+config = "board-config.yaml";
+schema = "schema.yaml";
+};
+};
+
+To generate a combined board configuration binary, we pack the
+needed individual binaries into a ti-board-config binary. In this case,
+the available supported subnode names are board-cfg, pm-cfg, sec-cfg and
+rm-cfg. The final binary is prepended with a header containing details about
+the included board config binaries. Example::
+
+my-combined-ti-board-config {
+ti-board-config {
+board-cfg {
+config = "board-cfg.yaml";
+schema = "schema.yaml";
+};
+sec-cfg {
+config = "sec-cfg.yaml";
+schema = "schema.yaml";
+};
+}
+}
+
+
+
 .. _etype_u_boot:
 
 Entry: u-boot: U-Boot flat binary
diff --git a/tools/binman/etype/ti_board_config.py 
b/tools/binman/etype/ti_board_config.py
new file mode 100644
index 00..0799e5dc59
--- /dev/null
+++ b/tools/binman/etype/ti_board_config.py
@@ -0,0 +1,259 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2022 Texas Instruments Incorporated - https://www.ti.com/
+# Written by Neha Malcom Francis 
+#
+# Entry-type module for generating schema validated TI board
+# configuration binary
+#
+
+import os
+import struct
+import yaml
+
+from collections import OrderedDict
+from jsonschema import validate
+from shutil import copyfileobj
+
+from binman.entry import Entry
+from binman.etype.section import Entry_section
+from dtoc import fdt_util
+from u_boot_pylib import tools
+
+BOARDCFG = 0xB
+BOARDCFG_SEC = 0xD
+BOARDCFG_PM = 0xE
+BOARDCFG_RM = 0xC
+BOARDCFG_NUM_ELEMS = 4
+
+class Entry_ti_board_config(Entry_section):
+"""An entry containing a TI schema validated board config binary
+
+This etype supports generation of two kinds of board configuration
+binaries: singular board config binary as well as combined board config
+binary.
+
+Properties / Entry arguments:
+- config-file: File containing board configuration data in YAML
+- schema-file: File containing board configuration YAML schema against
+  which the config file is validated
+
+Output files:
+- board config binary: File containing board configuration binary
+
+These above parameters are used only when the generated binary is
+intended to be a single board configuration binary. Example::
+
+my-ti-board-config {
+ti-board-config {
+config = "board-config.yaml&

[PATCH v5 02/23] binman: ti-secure: Add support for TI signing

2023-07-07 Thread Neha Malcom Francis
The ti-secure entry contains certificate for binaries that will be
loaded or booted by system firmware whereas the ti-secure-rom entry
contains certificate for binaries that will be booted by ROM. Support
for both these types of certificates is necessary for booting of K3
devices.

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[vigne...@ti.com: fixed inconsist cert generation by multiple packing]
Signed-off-by: Vignesh Raghavendra 
---
 board/ti/keys/custMpk.pem |  51 
 board/ti/keys/ti-degenerate-key.pem   |  10 +
 tools/binman/btool/openssl.py | 244 +
 tools/binman/entries.rst  |  65 +
 tools/binman/etype/ti_secure.py   |  78 ++
 tools/binman/etype/ti_secure_rom.py   | 249 ++
 tools/binman/etype/x509_cert.py   |  87 +-
 tools/binman/ftest.py |  52 
 tools/binman/test/279_ti_secure.dts   |  17 ++
 tools/binman/test/280_ti_secure_rom.dts   |  17 ++
 .../test/281_ti_secure_rom_combined.dts   |  25 ++
 tools/binman/test/288_ti_secure_rom_a.dts |  19 ++
 tools/binman/test/289_ti_secure_rom_b.dts |  18 ++
 13 files changed, 924 insertions(+), 8 deletions(-)
 create mode 100644 board/ti/keys/custMpk.pem
 create mode 100644 board/ti/keys/ti-degenerate-key.pem
 create mode 100644 tools/binman/etype/ti_secure.py
 create mode 100644 tools/binman/etype/ti_secure_rom.py
 create mode 100644 tools/binman/test/279_ti_secure.dts
 create mode 100644 tools/binman/test/280_ti_secure_rom.dts
 create mode 100644 tools/binman/test/281_ti_secure_rom_combined.dts
 create mode 100644 tools/binman/test/288_ti_secure_rom_a.dts
 create mode 100644 tools/binman/test/289_ti_secure_rom_b.dts

diff --git a/board/ti/keys/custMpk.pem b/board/ti/keys/custMpk.pem
new file mode 100644
index 00..adba378c80
--- /dev/null
+++ b/board/ti/keys/custMpk.pem
@@ -0,0 +1,51 @@
+-BEGIN RSA PRIVATE KEY-
+MIIJKQIBAAKCAgEAvxSuSdh/ctNrI83rSA5l3CJN8g5PgvbttfLd23yR+m5Z/9X3
+tt4EHYrM0pXZ0eDEwfhQv/9IDJEiUJpMe4vzlgooJrOk2eCpVUEa+z5bJ2y/ysBx
+ry9yIu5GASVirT7HBPaxGLYswBJuD+KbPuWmoKgGRQNBF04WH6l01oRO1nmnELgR
+qQ6SHyXdf7Hy0bnyaNgzWUuCfXfM0Zz6I7T7WIjyzerVFvIsdS36YsPBCW7gBnDg
+tQcJmWLZ1uTnbG3IggdQk/fi2O3RX+PQns+TVNlf3V3ON2DxqxSKBHtlp7p/30VF
+fEuhW65OxpQ9jE6H0pQ8pPOf2vzyNnznDa1aQjfxKoHQbqGnZwMeh+0Au3NKaCgx
+ooKaowTB6If/RX6qwZ/UOwXHg/0hcf69fzjJFhlSDuYDM40dHsk2HM1OnYIpiM2b
+Kr5sX3uysjp5AGp99a0anR7NWCrPXvROgKs7T9341N40osQg2VkZLYUCXh9osUyN
+uREG6S12tViMUKg3bmZ4b4MwRk00n7QYSrm7+nvFrtYyEISEbD+agDM1/E281W5g
+VFDPfm2AlwT6jwsg/b2YK6E3vVn9SuxFoQmLF8lyFDO3BV4SXeJaHc4hVPbh6tVV
+qifrTQnfGUCCLmaJF2XZbrPWOE6NYRbWdNTeFl9RGdVCuIPSyN5LqWmXto0CAwEA
+AQKCAgAzkAwcJ0z1GnId/lJQZno8NhGckRoJuEKbR8dwlCP8VUz6Ca5H7Y9kvXDa
+Hs/hn+rYgP6hYOz7XyrIX2rmJ/T6dxEwqGeC1+o59FConcIRWHpE5zuGT6JYJL5F
+TuZa48bm4v8VMQvQZOjIZpkIFwao8c6HTwKAnHTB5IN/48I2hCt+Cn3RhfoOZ7Rm
+4gkpaSkt+7GXlhXHb82YfujNO+hbktEamhUYlQ9EK70Wa8aqmf3gHxO0JgsEFjW8
+lJaSnultlTW8SDcx3LMUUjCYumECk4oX/VlJfmKYjPlVjkr3QQ+Cm3nNucb4K4hc
+c+JL+2ERhSj8RjXL7VgbNgdPnIjvQDJuTNqecTU8xWPYrkOLQpNibbLjnutLkhJz
+fMyRtmDtrsey8WiCDuCHkPJ8/f8RjL2zWI9fzTDDIzdlEKouUFGOovaHVnbua6pn
+hymcu9d9FV3p2rcbj0ivCs7e8j+vhSxFJEJoAbcQdXCTi/n2uR7pLtoMNiUzsejy
+d46Uz+KEU920NTwE2z6JJq8I2vegnxjc7PDDrV3/5rK04B93aXiqvwWseCpxelrI
+xaMkRHbXrIXRO6MXQ3N+zNq8Dg3hjGTTvaBKuwgvqLwlXY8+Aa3ooFzEOInIOSsI
+XcWqXxt/tgZgsj9RwpC42t8kbA+BkbNk9EIUa+P5kEr2P/fO7QKCAQEA4EtArnOX
+D6tQF8uTw8USOZC2P9s/ez1z4jRq3oKP0Kv4tJiuIObJ/dUvGVD7aM5v2xaCfhm8
+xpk09VPUgghfG5jR5qVvQr75kCNToJQudWi4ngk1HwKJzzTO11giFEdybvTUA+Pj
+fmxCM0dYYqRWZoj0hLqXlUCwxE74BFIhJVjeYbf+nTQrqpllTLoW7MTZHzGx5SXx
+4dNzyVAUH49Yt2D8mgXXCkf5sGLh762wj34b/rR10Kr4O5utGMZrfTRIbuQ1pNjU
+m66baPzq+mC0BzqZEW70TgEb7lOr8rcVXLOi3r36omfd9/MHx7iZD6o3K1axSO15
+grD4ZrN7Ac3QJwKCAQEA2heCoBdpvy6YUk8AO2k8qDygTdmPQRuwjjT+Z2fMslBt
+D7DkpKwZ6Bl9OclcpiiLHmH+hv65KqYg+tR0RRb7PcogB9El9x7yKkGTPZEYWGky
+n8P84rJpKwjnwWQvPQktI1cs3YGvZA9DQTFBavRrwuzgd1oSJq5aPQ2tme0kMvWp
+l1/B/cPK+PKCi/Wfisaze1TjijP9qIeUwkdNN6WLrLU3QgsGppcg2I7RQtAIikT6
+GkuiOQAvWMsrJVV6PNrVKz4fJDJ59Rz6jbDHZNi1MEYNxQoB/Pl7QIakbfjWpHLv
+8Ey7cB2JKxjQy8tmyl8WNQVbXbE6daPXcMTUmaRAKwKCAQBv1lYMJmq+T2eCVen6
+BbvOpE+bi5EdvEiaFBTtmiBnpjg+pJq+oRU60h/H+c9CNR0lGxY6Fk9An4f+g6xE
+ojP6KLsQzJCrsVny+wpp2TlJJcxYULMCIVvhy60PR0zG29E9biqBPhJjKUvhEcQK
+e3LxcXyq6fdHXphFajLUxLbuTl+kTgBRFoBnclFGbsubh5PTsA3J+p+fQLZNPPar
+veg4l82cZykQYU8pGkUaI3sUMYd3+zd7sqRP5JHs9pMGPRmY4YW2CsAIWIn5UZNB
+ARMDP76vKKn8cyUgMuxb+9pU/OVLN2NPs4bEaZQJjAwV+YPEwldny7F47xEM9JVz
+EtKlAoIBAQDUt62u3GdGE/p5/ZgqWoDRTyDEDfmN9aYFbmbdEP80xQE7FrxMaZhz
+K7laja6SWmUm40nQ/c45bQQp4uLtKHcxU15egX7YRBTLZl5o5IasZR79ebnEm2O8
+l9kEZeU1USf3mmWmP4GExOZCRfqaiYA6BbUCdJXTqKdXeWnkAssV8UrS3JFoJHpq
+yo7OWGqefyQ8nRW6jO9SW7uaqtUD+7H6aF5XSk3YWvusfdBZrHNH+fM/hpnZovaL
+Us7ogTDS/laA8PyK37jYfMVdQhmZoU1Iomt3zkUWK3gt/aWPpfAlQf4Jka4YspZB
+tNiijefaZ1hPqsPs5Joyd/YAhdsfaHc1AoIBAQCn/9j6RRjRaw0ip756oad4AXHz
+XBwVB2CrY96qT6Hj9Sq7tGgdskqGkOQkAivBLBizUdcWv0t1yenOsSgasQeMlvlh

[PATCH v5 03/23] arm: dts: k3: Add support for packaging sysfw.itb and tiboot3.bin

2023-07-07 Thread Neha Malcom Francis
Board config binary artifacts must be generated to be used by binman to
package sysfw.itb and tiboot3.bin for all K3 devices.

For devices that follow combined flow, these board configuration
binaries must again be packaged into a combined board configuration
blobs to be used by binman to package tiboot3.bin.

Add common k3-binman.dtsi to generate all the board configuration
binaries needed.

Also add custMpk.pem and ti-degenerate-key.pem needed for signing GP and
HS bootloader images common to all K3 devices.

Signed-off-by: Neha Malcom Francis 
---
 arch/arm/dts/k3-binman.dtsi | 116 
 1 file changed, 116 insertions(+)
 create mode 100644 arch/arm/dts/k3-binman.dtsi

diff --git a/arch/arm/dts/k3-binman.dtsi b/arch/arm/dts/k3-binman.dtsi
new file mode 100644
index 00..97a3573bdb
--- /dev/null
+++ b/arch/arm/dts/k3-binman.dtsi
@@ -0,0 +1,116 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+/ {
+   binman: binman {
+   multiple-images;
+   };
+};
+
+&binman {
+   custMpk {
+   filename = "custMpk.pem";
+   blob-ext {
+   filename = "../keys/custMpk.pem";
+   };
+   };
+
+   ti-degenerate-key {
+   filename = "ti-degenerate-key.pem";
+   blob-ext {
+   filename = "../keys/ti-degenerate-key.pem";
+   };
+   };
+};
+
+#ifndef CONFIG_ARM64
+
+&binman {
+   board-cfg {
+   filename = "board-cfg.bin";
+   bcfg_yaml: ti-board-config {
+   config = "board-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   pm-cfg {
+   filename = "pm-cfg.bin";
+   rcfg_yaml: ti-board-config {
+   config = "pm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   rm-cfg {
+   filename = "rm-cfg.bin";
+   pcfg_yaml: ti-board-config {
+   config = "rm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   sec-cfg {
+   filename = "sec-cfg.bin";
+   scfg_yaml: ti-board-config {
+   config = "sec-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   combined-tifs-cfg {
+   filename = "combined-tifs-cfg.bin";
+   ti-board-config {
+   bcfg_yaml_tifs: board-cfg {
+   config = "board-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   scfg_yaml_tifs: sec-cfg {
+   config = "sec-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   pcfg_yaml_tifs: pm-cfg {
+   config = "pm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   rcfg_yaml_tifs: rm-cfg {
+   config = "rm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   };
+   combined-dm-cfg {
+   filename = "combined-dm-cfg.bin";
+   ti-board-config {
+   pcfg_yaml_dm: pm-cfg {
+   config = "pm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   rcfg_yaml_dm: rm-cfg {
+   config = "rm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   };
+   combined-sysfw-cfg {
+   filename = "combined-sysfw-cfg.bin";
+   ti-board-config {
+   board-cfg {
+   config = "board-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   sec-cfg {
+   config = "sec-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   pm-cfg {
+   config = "pm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   rm-cfg {
+   config = "rm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   };
+};
+
+#endif
-- 
2.34.1



[PATCH v5 05/23] j721e: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin, u-boot.img

2023-07-07 Thread Neha Malcom Francis
By providing entries in the binman node of the device tree, binman will
be able to find and package board config artifacts generated by
TIBoardConfig with sysfw.bin and generate the final image sysfw.itb.
It will also pick out the R5 SPL and sign it with the help of TI signing
entry and generate the final tiboot3.bin.

Entries for A72 build have been added to k3-j721e-binman.dtsi to
generate tispl.bin and u-boot.img.

Support has been added for both HS-SE(SR 1.1), HS-FS(SR 2.0) and GP images
In HS-SE, the encrypted system firmware binary must be signed along with
the signed certificate binary.

HS-SE:
* tiboot3-j721e_sr1_1-hs-evm.bin
* sysfw-j721e_sr1_1-hs-evm.itb
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-j721e_sr2-hs-fs-evm.bin
* sysfw-j721e_sr2-hs-fs-evm.itb
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin -->tiboot3-j721e-gp-evm.bin
* sysfw.itb --> sysfw-j721e-gp-evm.itb
* tispl.bin_unsigned
* u-boot.img_unsigned

It is to be noted that the bootflow followed by J721E requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs

sysfw.itb:
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-j721e-binman.dtsi | 701 ++
 .../k3-j721e-common-proc-board-u-boot.dtsi|   1 +
 .../arm/dts/k3-j721e-r5-common-proc-board.dts |   1 +
 arch/arm/dts/k3-j721e-sk-u-boot.dtsi  |   1 +
 board/ti/j721e/Kconfig|   2 +
 5 files changed, 706 insertions(+)
 create mode 100644 arch/arm/dts/k3-j721e-binman.dtsi

diff --git a/arch/arm/dts/k3-j721e-binman.dtsi 
b/arch/arm/dts/k3-j721e-binman.dtsi
new file mode 100644
index 00..0455deb6ca
--- /dev/null
+++ b/arch/arm/dts/k3-j721e-binman.dtsi
@@ -0,0 +1,701 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_J721E_R5_EVM
+
+&binman {
+   tiboot3-j721e_sr1_1-hs-evm.bin {
+   filename = "tiboot3-j721e_sr1_1-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>;
+   core = "public";
+   load = ;
+   keyfile = "custMpk.pem";
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   };
+   sysfw {
+   filename = "sysfw.bin";
+   ti-secure-rom {
+   content = <&ti_fs_cert>;
+   core = "secure";
+   load = <0x4>;
+   keyfile = "custMpk.pem";
+   countersign;
+   };
+   ti_fs_cert: ti-fs-cert.bin {
+   filename = 
"ti-sysfw/ti-fs-firmware-j721e_sr1_1-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   ti-fs-firmware-j721e_sr1_1-hs-enc.bin {
+   filename = 
"ti-sysfw/ti-fs-firmware-j721e_sr1_1-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   };
+   itb {
+   filename = "sysfw-j721e_sr1_1-hs-evm.itb";
+   fit {
+   description = "SYSFW and Config fragments";
+   #address-cells = <1>;
+   images {
+   sysfw.bin {
+   description = "sysfw";
+   type = "firmware";
+   arch = "arm";
+   compression = "none";
+   blob-ext {
+   filename = "sysfw.bin";
+   };
+   };
+   board-cfg.bin {
+   description = "board-cfg";
+   type = "firmware";
+   arch = "arm";
+   compression = "none";
+   ti-secure {
+   content = <

[PATCH v5 06/23] j7200: yaml: Add J7200 board config files

2023-07-07 Thread Neha Malcom Francis
Added YAML configs for J7200

Signed-off-by: Neha Malcom Francis 
---
 board/ti/j721e/board-cfg_j7200.yaml |   36 +
 board/ti/j721e/pm-cfg_j7200.yaml|   12 +
 board/ti/j721e/rm-cfg_j7200.yaml| 2065 +++
 board/ti/j721e/sec-cfg_j7200.yaml   |  380 +
 4 files changed, 2493 insertions(+)
 create mode 100644 board/ti/j721e/board-cfg_j7200.yaml
 create mode 100644 board/ti/j721e/pm-cfg_j7200.yaml
 create mode 100644 board/ti/j721e/rm-cfg_j7200.yaml
 create mode 100644 board/ti/j721e/sec-cfg_j7200.yaml

diff --git a/board/ti/j721e/board-cfg_j7200.yaml 
b/board/ti/j721e/board-cfg_j7200.yaml
new file mode 100644
index 00..1453317ecb
--- /dev/null
+++ b/board/ti/j721e/board-cfg_j7200.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for J7200
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x10
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
diff --git a/board/ti/j721e/pm-cfg_j7200.yaml b/board/ti/j721e/pm-cfg_j7200.yaml
new file mode 100644
index 00..588a1d530d
--- /dev/null
+++ b/board/ti/j721e/pm-cfg_j7200.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for J7200
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/j721e/rm-cfg_j7200.yaml b/board/ti/j721e/rm-cfg_j7200.yaml
new file mode 100644
index 00..66b589f370
--- /dev/null
+++ b/board/ti/j721e/rm-cfg_j7200.yaml
@@ -0,0 +1,2065 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for J7200
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 3
+allowed_atype : 0b101010
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 5
+allowed_atype : 0b101010
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 12
+allowed_atype : 0b101010
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 13
+allowed_atype : 0b101010
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #5
+host_id: 35
+allowed_atype : 0b101010
+allowed_qos : 0x
+allowed_orderid

[PATCH v5 07/23] j7200: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img

2023-07-07 Thread Neha Malcom Francis
Support has been added for both HS-SE(SR 2.0), HS-FS(SR 2.0) and GP
images.

HS-SE:
* tiboot3-j7200_sr2-hs-evm.bin
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-j7200_sr2-hs-fs-evm.bin
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-j7200-gp-evm.bin
* tispl.bin_unsigned
* u-boot.img_unsigned

It is to be noted that the bootflow followed by J7200 requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-j7200-binman.dtsi | 502 ++
 .../k3-j7200-common-proc-board-u-boot.dtsi|   2 +
 board/ti/j721e/Kconfig|   2 +
 3 files changed, 506 insertions(+)
 create mode 100644 arch/arm/dts/k3-j7200-binman.dtsi

diff --git a/arch/arm/dts/k3-j7200-binman.dtsi 
b/arch/arm/dts/k3-j7200-binman.dtsi
new file mode 100644
index 00..61bf576970
--- /dev/null
+++ b/arch/arm/dts/k3-j7200-binman.dtsi
@@ -0,0 +1,502 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_J7200_R5_EVM
+
+&bcfg_yaml {
+   config = "board-cfg_j7200.yaml";
+};
+
+&rcfg_yaml {
+   config = "rm-cfg_j7200.yaml";
+};
+
+&pcfg_yaml {
+   config = "pm-cfg_j7200.yaml";
+};
+
+&scfg_yaml {
+   config = "sec-cfg_j7200.yaml";
+};
+
+&bcfg_yaml_tifs {
+   config = "board-cfg_j7200.yaml";
+};
+
+&rcfg_yaml_tifs {
+   config = "rm-cfg_j7200.yaml";
+};
+
+&pcfg_yaml_tifs {
+   config = "pm-cfg_j7200.yaml";
+};
+
+&scfg_yaml_tifs {
+   config = "sec-cfg_j7200.yaml";
+};
+
+&rcfg_yaml_dm {
+   config = "rm-cfg_j7200.yaml";
+};
+
+&pcfg_yaml_dm {
+   config = "pm-cfg_j7200.yaml";
+};
+
+&binman {
+   tiboot3-j7200_sr2-hs-evm.bin {
+   filename = "tiboot3-j7200_sr2-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>, <&ti_fs_enc>, 
<&combined_tifs_cfg>,
+   <&combined_dm_cfg>, <&sysfw_inner_cert>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl>;
+   content-sysfw = <&ti_fs_enc>;
+   content-sysfw-data = <&combined_tifs_cfg>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert>;
+   content-dm-data = <&combined_dm_cfg>;
+   load = <0x41c0>;
+   load-sysfw = <0x4>;
+   load-sysfw-data = <0x7f000>;
+   load-dm-data = <0x41c8>;
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   ti_fs_enc: ti-fs-enc.bin {
+   filename = 
"ti-sysfw/ti-fs-firmware-j7200_sr2-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_tifs_cfg: combined-tifs-cfg.bin {
+   filename = "combined-tifs-cfg.bin";
+   type = "blob-ext";
+   };
+   sysfw_inner_cert: sysfw-inner-cert {
+   filename = 
"ti-sysfw/ti-fs-firmware-j7200_sr2-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_dm_cfg: combined-dm-cfg.bin {
+   filename = "combined-dm-cfg.bin";
+   type = "blob-ext";
+   };
+   };
+};
+
+&binman {
+   tiboot3-j7200_sr2-hs-fs-evm.bin {
+   filename = "tiboot3-j7200_sr2-hs-fs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl_fs>, <&ti_fs_enc_fs>, 
<&combined_tifs_cfg_fs>,
+   <&combined_dm_cfg_fs>, <&sysfw_inner_cert_fs>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+

[PATCH v5 08/23] am65x: yaml: Add AM65x board config files

2023-07-07 Thread Neha Malcom Francis
Added YAML configs for AM65x

Signed-off-by: Neha Malcom Francis 
---
 board/ti/am65x/board-cfg.yaml |   36 +
 board/ti/am65x/pm-cfg.yaml|   12 +
 board/ti/am65x/rm-cfg.yaml| 2068 +
 board/ti/am65x/sec-cfg.yaml   |  379 ++
 4 files changed, 2495 insertions(+)
 create mode 100644 board/ti/am65x/board-cfg.yaml
 create mode 100644 board/ti/am65x/pm-cfg.yaml
 create mode 100644 board/ti/am65x/rm-cfg.yaml
 create mode 100644 board/ti/am65x/sec-cfg.yaml

diff --git a/board/ti/am65x/board-cfg.yaml b/board/ti/am65x/board-cfg.yaml
new file mode 100644
index 00..133720ec3e
--- /dev/null
+++ b/board/ti/am65x/board-cfg.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM65x
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x10
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
diff --git a/board/ti/am65x/pm-cfg.yaml b/board/ti/am65x/pm-cfg.yaml
new file mode 100644
index 00..4b1ce475cd
--- /dev/null
+++ b/board/ti/am65x/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM65x
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/am65x/rm-cfg.yaml b/board/ti/am65x/rm-cfg.yaml
new file mode 100644
index 00..61acd0aa60
--- /dev/null
+++ b/board/ti/am65x/rm-cfg.yaml
@@ -0,0 +1,2068 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for AM65x
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 3
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 5
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 12
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 13
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #5
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #6
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #7
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #8
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #9
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0

[PATCH v5 09/23] am65: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin, u-boot.img

2023-07-07 Thread Neha Malcom Francis
Support has been added for both HS-SE(SR 2.0) and GP(SR 2.0) images.

HS-SE:
* tiboot3-am65x_sr2-hs-evm.bin
* sysfw-am65x_sr2-hs-evm.itb
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-am65x_sr2-gp-evm.bin
* sysfw.itb --> sysfw-am65x_sr2-gp-evm.itb
* tispl.bin_unsigned
* u-boot.img_unsigned

Note that the bootflow followed by AM65x requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
sysfw.itb:
* sysfw
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* ATF
* OPTEE
* A53 SPL
* A53 SPL dtbs

u-boot.img:
* A53 U-Boot
* A53 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi  |   1 +
 .../dts/k3-am654-r5-base-board-u-boot.dtsi|   1 +
 arch/arm/dts/k3-am65x-binman.dtsi | 518 ++
 board/ti/am65x/Kconfig|   2 +
 4 files changed, 522 insertions(+)
 create mode 100644 arch/arm/dts/k3-am65x-binman.dtsi

diff --git a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
index 0c1305df7e..e4cbc47c2a 100644
--- a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
@@ -4,6 +4,7 @@
  */
 
 #include "k3-am654-r5-base-board-u-boot.dtsi"
+#include "k3-am65x-binman.dtsi"
 
 &pru0_0 {
remoteproc-name = "pru0_0";
diff --git a/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi
index 4516ab1437..949320c91d 100644
--- a/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi
@@ -5,6 +5,7 @@
 
 #include 
 #include 
+#include "k3-am65x-binman.dtsi"
 
 / {
chosen {
diff --git a/arch/arm/dts/k3-am65x-binman.dtsi 
b/arch/arm/dts/k3-am65x-binman.dtsi
new file mode 100644
index 00..6535b9fec2
--- /dev/null
+++ b/arch/arm/dts/k3-am65x-binman.dtsi
@@ -0,0 +1,518 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_AM654_R5_EVM
+
+&binman {
+   tiboot3-am65x_sr2-hs-evm.bin {
+   filename = "tiboot3-am65x_sr2-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>;
+   core = "public";
+   load = ;
+   keyfile = "custMpk.pem";
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   };
+   sysfw {
+   filename = "sysfw.bin";
+   ti-secure-rom {
+   content = <&ti_sci_cert>;
+   core = "secure";
+   load = <0x4>;
+   keyfile = "custMpk.pem";
+   countersign;
+   };
+   ti_sci_cert: ti-sci-cert.bin {
+   filename = 
"ti-sysfw/ti-sci-firmware-am65x_sr2-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   ti-sci-firmware-am65x-hs-enc.bin {
+   filename = 
"ti-sysfw/ti-sci-firmware-am65x_sr2-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   };
+   itb {
+   filename = "sysfw-am65x_sr2-hs-evm.itb";
+   fit {
+   description = "SYSFW and Config fragments";
+   #address-cells = <1>;
+   images {
+   sysfw.bin {
+   description = "sysfw";
+   type = "firmware";
+   arch = "arm";
+   compression = "none";
+   blob-ext {
+   filename = "sysfw.bin";
+   };
+   };
+   board-cfg.bin {
+   description = "board-cfg";
+   type = "firmware";
+   arch = "arm";
+   compression = "none";
+   ti-secure {
+ 

[PATCH v5 10/23] am64x: yaml: Add board configs for AM64x

2023-07-07 Thread Neha Malcom Francis
Added YAML configs for AM64xx

Signed-off-by: Neha Malcom Francis 
---
 board/ti/am64x/board-cfg.yaml |   37 +
 board/ti/am64x/pm-cfg.yaml|   12 +
 board/ti/am64x/rm-cfg.yaml| 1400 +
 board/ti/am64x/sec-cfg.yaml   |  380 +
 4 files changed, 1829 insertions(+)
 create mode 100644 board/ti/am64x/board-cfg.yaml
 create mode 100644 board/ti/am64x/pm-cfg.yaml
 create mode 100644 board/ti/am64x/rm-cfg.yaml
 create mode 100644 board/ti/am64x/sec-cfg.yaml

diff --git a/board/ti/am64x/board-cfg.yaml b/board/ti/am64x/board-cfg.yaml
new file mode 100644
index 00..f1f7c68d50
--- /dev/null
+++ b/board/ti/am64x/board-cfg.yaml
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM64x
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x0
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
+
diff --git a/board/ti/am64x/pm-cfg.yaml b/board/ti/am64x/pm-cfg.yaml
new file mode 100644
index 00..c97495f482
--- /dev/null
+++ b/board/ti/am64x/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM64x
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/am64x/rm-cfg.yaml b/board/ti/am64x/rm-cfg.yaml
new file mode 100644
index 00..1e6b07aef6
--- /dev/null
+++ b/board/ti/am64x/rm-cfg.yaml
@@ -0,0 +1,1400 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for AM64x
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 12
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 30
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 36
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 38
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #5
+host_id: 41
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x

[PATCH v5 11/23] am64x: dts: binman: Package tiboot3.bin, tispl.bin u-boot.img

2023-07-07 Thread Neha Malcom Francis
Support added for HS and GP boot binaries for AM64x.

HS-SE:
* tiboot3-am64x_sr2-hs-evm.bin
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-am64x_sr2-hs-fs-evm.bin
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-am64x-gp-evm.bin
* tispl.bin_unsigned
* u-boot.img_unsigned

Note that the bootflow followed by AM64x requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* sysfw
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* ATF
* OPTEE
* A53 SPL
* A53 SPL dtbs

u-boot.img:
* A53 U-Boot
* A53 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-am642-evm-u-boot.dtsi |   2 +
 arch/arm/dts/k3-am642-r5-evm.dts  |   1 +
 arch/arm/dts/k3-am642-sk-u-boot.dtsi  |   2 +
 arch/arm/dts/k3-am64x-binman.dtsi | 515 ++
 board/ti/am64x/Kconfig|   2 +
 5 files changed, 522 insertions(+)
 create mode 100644 arch/arm/dts/k3-am64x-binman.dtsi

diff --git a/arch/arm/dts/k3-am642-evm-u-boot.dtsi 
b/arch/arm/dts/k3-am642-evm-u-boot.dtsi
index 64857b0909..73577e8cfd 100644
--- a/arch/arm/dts/k3-am642-evm-u-boot.dtsi
+++ b/arch/arm/dts/k3-am642-evm-u-boot.dtsi
@@ -3,6 +3,8 @@
  * Copyright (C) 2020-2021 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include "k3-am64x-binman.dtsi"
+
 / {
chosen {
stdout-path = "serial2:115200n8";
diff --git a/arch/arm/dts/k3-am642-r5-evm.dts b/arch/arm/dts/k3-am642-r5-evm.dts
index e870492a69..b49064181a 100644
--- a/arch/arm/dts/k3-am642-r5-evm.dts
+++ b/arch/arm/dts/k3-am642-r5-evm.dts
@@ -8,6 +8,7 @@
 #include "k3-am642.dtsi"
 #include "k3-am64-evm-ddr4-1600MTs.dtsi"
 #include "k3-am64-ddr.dtsi"
+#include "k3-am64x-binman.dtsi"
 
 / {
chosen {
diff --git a/arch/arm/dts/k3-am642-sk-u-boot.dtsi 
b/arch/arm/dts/k3-am642-sk-u-boot.dtsi
index 69dbe943bd..3d6be025bd 100644
--- a/arch/arm/dts/k3-am642-sk-u-boot.dtsi
+++ b/arch/arm/dts/k3-am642-sk-u-boot.dtsi
@@ -3,6 +3,8 @@
  * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include "k3-am64x-binman.dtsi"
+
 / {
chosen {
stdout-path = "serial2:115200n8";
diff --git a/arch/arm/dts/k3-am64x-binman.dtsi 
b/arch/arm/dts/k3-am64x-binman.dtsi
new file mode 100644
index 00..e6ca2457b4
--- /dev/null
+++ b/arch/arm/dts/k3-am64x-binman.dtsi
@@ -0,0 +1,515 @@
+// SPDX-License-Identifier: GPL-2.0+
+// Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_AM642_R5_EVM
+
+&binman {
+   tiboot3-am64x_sr2-hs-evm.bin {
+   filename = "tiboot3-am64x_sr2-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>, <&ti_sci_enc>,
+   <&combined_sysfw_cfg>, <&sysfw_inner_cert>;
+   combined;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl>;
+   content-sysfw = <&ti_sci_enc>;
+   content-sysfw-data = <&combined_sysfw_cfg>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert>;
+   load = <0x7000>;
+   load-sysfw = <0x44000>;
+   load-sysfw-data = <0x7b000>;
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   ti_sci_enc: ti-fs-enc.bin {
+   filename = 
"ti-sysfw/ti-sci-firmware-am64x_sr2-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_sysfw_cfg: combined-sysfw-cfg.bin {
+   filename = "combined-sysfw-cfg.bin";
+   type = "blob-ext";
+   };
+   sysfw_inner_cert: sysfw-inner-cert {
+   filename = 
"ti-sysfw/ti-sci-firmware-am64x_sr2-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+
+   };
+};
+
+&binman {
+   tiboot3-am64x_sr2-hs-fs-evm.bin {
+   filename = "tiboot3-am64x_sr2-hs-fs-evm.bin";
+   symlink = "tiboot3.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl_fs>, <&ti_sci_enc_fs>,
+   

[PATCH v5 13/23] j721s2: dts: binman: Package tiboot3.bin, tispl.bin and u-boot.img

2023-07-07 Thread Neha Malcom Francis
Support has been added for both HS-SE, HS-FS  and GP images.

HS-SE:
* tiboot3-j721s2-hs-evm.bin
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-j721s2-hs-fs-evm.bin
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-j721s2-gp-evm.bin
* tispl.bin_unsigned
* u-boot.img_unsigned

It is to be noted that the bootflow followed by J721S2 requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 .../arm/dts/k3-am68-sk-base-board-u-boot.dtsi |   2 +
 arch/arm/dts/k3-j721s2-binman.dtsi| 546 ++
 .../k3-j721s2-common-proc-board-u-boot.dtsi   |   2 +
 .../dts/k3-j721s2-r5-common-proc-board.dts|   1 +
 board/ti/j721s2/Kconfig   |   2 +
 5 files changed, 553 insertions(+)
 create mode 100644 arch/arm/dts/k3-j721s2-binman.dtsi

diff --git a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
index ee31b1ebe7..79faa1b573 100644
--- a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
@@ -3,6 +3,8 @@
  * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include "k3-j721s2-binman.dtsi"
+
 / {
chosen {
stdout-path = "serial2:115200n8";
diff --git a/arch/arm/dts/k3-j721s2-binman.dtsi 
b/arch/arm/dts/k3-j721s2-binman.dtsi
new file mode 100644
index 00..7fd7ba8e5d
--- /dev/null
+++ b/arch/arm/dts/k3-j721s2-binman.dtsi
@@ -0,0 +1,546 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_J721S2_R5_EVM
+
+&binman {
+   tiboot3-j721s2-hs-evm.bin {
+   filename = "tiboot3-j721s2-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>, <&ti_fs_enc>, 
<&combined_tifs_cfg>,
+   <&combined_dm_cfg>, <&sysfw_inner_cert>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl>;
+   content-sysfw = <&ti_fs_enc>;
+   content-sysfw-data = <&combined_tifs_cfg>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert>;
+   content-dm-data = <&combined_dm_cfg>;
+   load = <0x41c0>;
+   load-sysfw = <0x4>;
+   load-sysfw-data = <0x67000>;
+   load-dm-data = <0x41c8>;
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   ti_fs_enc: ti-fs-enc.bin {
+   filename = "ti-sysfw/ti-fs-firmware-j721s2-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_tifs_cfg: combined-tifs-cfg.bin {
+   filename = "combined-tifs-cfg.bin";
+   type = "blob-ext";
+   };
+   sysfw_inner_cert: sysfw-inner-cert {
+   filename = "ti-sysfw/ti-fs-firmware-j721s2-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_dm_cfg: combined-dm-cfg.bin {
+   filename = "combined-dm-cfg.bin";
+   type = "blob-ext";
+   };
+   };
+};
+
+&binman {
+   tiboot3-j721s2-hs-fs-evm.bin {
+   filename = "tiboot3-j721s2-hs-fs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl_fs>, <&ti_fs_enc_fs>, 
<&combined_tifs_cfg_fs>,
+   <&combined_dm_cfg_fs>, <&sysfw_inner_cert_fs>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl_fs>;
+   content-sysfw = <&ti_f

[PATCH v5 12/23] j721s2: yaml: Add board configs for J721S2

2023-07-07 Thread Neha Malcom Francis
Added YAML configs for J721S2

Signed-off-by: Neha Malcom Francis 
---
 board/ti/j721s2/board-cfg.yaml |   37 +
 board/ti/j721s2/pm-cfg.yaml|   12 +
 board/ti/j721s2/rm-cfg.yaml| 2901 
 board/ti/j721s2/sec-cfg.yaml   |  379 +
 4 files changed, 3329 insertions(+)
 create mode 100644 board/ti/j721s2/board-cfg.yaml
 create mode 100644 board/ti/j721s2/pm-cfg.yaml
 create mode 100644 board/ti/j721s2/rm-cfg.yaml
 create mode 100644 board/ti/j721s2/sec-cfg.yaml

diff --git a/board/ti/j721s2/board-cfg.yaml b/board/ti/j721s2/board-cfg.yaml
new file mode 100644
index 00..d80f308ca6
--- /dev/null
+++ b/board/ti/j721s2/board-cfg.yaml
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for J721S2
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x0
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
+
diff --git a/board/ti/j721s2/pm-cfg.yaml b/board/ti/j721s2/pm-cfg.yaml
new file mode 100644
index 00..45994e23cc
--- /dev/null
+++ b/board/ti/j721s2/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for J721S2
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/j721s2/rm-cfg.yaml b/board/ti/j721s2/rm-cfg.yaml
new file mode 100644
index 00..6058f3b35c
--- /dev/null
+++ b/board/ti/j721s2/rm-cfg.yaml
@@ -0,0 +1,2901 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for J721S2
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 3
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 5
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 12
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 13
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #5
+host_id: 21
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #6
+host_id: 23
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #7
+host_id: 35
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #8
+host_id: 37
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #9
+host_id: 40
+allowed_atype : 0x2A

[PATCH v5 14/23] am62: yaml: Add board configs for AM62

2023-07-07 Thread Neha Malcom Francis
Added YAML configs for AM62

Signed-off-by: Neha Malcom Francis 
---
 board/ti/am62x/board-cfg.yaml |   36 ++
 board/ti/am62x/pm-cfg.yaml|   12 +
 board/ti/am62x/rm-cfg.yaml| 1088 +
 board/ti/am62x/sec-cfg.yaml   |  379 
 4 files changed, 1515 insertions(+)
 create mode 100644 board/ti/am62x/board-cfg.yaml
 create mode 100644 board/ti/am62x/pm-cfg.yaml
 create mode 100644 board/ti/am62x/rm-cfg.yaml
 create mode 100644 board/ti/am62x/sec-cfg.yaml

diff --git a/board/ti/am62x/board-cfg.yaml b/board/ti/am62x/board-cfg.yaml
new file mode 100644
index 00..a26ef55bd4
--- /dev/null
+++ b/board/ti/am62x/board-cfg.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM62
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x0
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
diff --git a/board/ti/am62x/pm-cfg.yaml b/board/ti/am62x/pm-cfg.yaml
new file mode 100644
index 00..aa94097e97
--- /dev/null
+++ b/board/ti/am62x/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM62
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/am62x/rm-cfg.yaml b/board/ti/am62x/rm-cfg.yaml
new file mode 100644
index 00..1e8678c30b
--- /dev/null
+++ b/board/ti/am62x/rm-cfg.yaml
@@ -0,0 +1,1088 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for AM62
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 12
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 30
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 36
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #5
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #6
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #7
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #8
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #9
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0

[PATCH v5 15/23] am625: dts: binman: Package tiboot3.bin, tispl.bin and u-boot.img

2023-07-07 Thread Neha Malcom Francis
Support added for HS-SE, HS-FS and GP boot binaries for AM62.

HS-SE:
* tiboot3-am62x-hs-evm.bin
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-am62x-hs-fs-evm.bin
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-am62x-gp-evm.bin
* tispl.bin_unsigned
* u-boot.img_unsigned

It is to be noted that the bootflow followed by AM62 requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-am625-r5-sk.dts  |   1 +
 arch/arm/dts/k3-am625-sk-binman.dtsi | 463 +++
 arch/arm/dts/k3-am625-sk-u-boot.dtsi |   2 +
 board/ti/am62x/Kconfig   |   2 +
 4 files changed, 468 insertions(+)
 create mode 100644 arch/arm/dts/k3-am625-sk-binman.dtsi

diff --git a/arch/arm/dts/k3-am625-r5-sk.dts b/arch/arm/dts/k3-am625-r5-sk.dts
index 78df7cec3f..3ec5bad735 100644
--- a/arch/arm/dts/k3-am625-r5-sk.dts
+++ b/arch/arm/dts/k3-am625-r5-sk.dts
@@ -9,6 +9,7 @@
 #include "k3-am62-ddr.dtsi"
 
 #include "k3-am625-sk-u-boot.dtsi"
+#include "k3-am625-sk-binman.dtsi"
 
 / {
aliases {
diff --git a/arch/arm/dts/k3-am625-sk-binman.dtsi 
b/arch/arm/dts/k3-am625-sk-binman.dtsi
new file mode 100644
index 00..c5bd9e48d0
--- /dev/null
+++ b/arch/arm/dts/k3-am625-sk-binman.dtsi
@@ -0,0 +1,463 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_AM625_R5_EVM
+
+&binman {
+   tiboot3-am62x-hs-evm.bin {
+   filename = "tiboot3-am62x-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>, <&ti_fs_enc>, 
<&combined_tifs_cfg>,
+   <&combined_dm_cfg>, <&sysfw_inner_cert>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl>;
+   content-sysfw = <&ti_fs_enc>;
+   content-sysfw-data = <&combined_tifs_cfg>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert>;
+   content-dm-data = <&combined_dm_cfg>;
+   load = <0x43c0>;
+   load-sysfw = <0x4>;
+   load-sysfw-data = <0x67000>;
+   load-dm-data = <0x43c3a800>;
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   ti_fs_enc: ti-fs-enc.bin {
+   filename = "ti-sysfw/ti-fs-firmware-am62x-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_tifs_cfg: combined-tifs-cfg.bin {
+   filename = "combined-tifs-cfg.bin";
+   type = "blob-ext";
+   };
+   sysfw_inner_cert: sysfw-inner-cert {
+   filename = "ti-sysfw/ti-fs-firmware-am62x-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_dm_cfg: combined-dm-cfg.bin {
+   filename = "combined-dm-cfg.bin";
+   type = "blob-ext";
+   };
+   };
+};
+
+&binman {
+   tiboot3-am62x-hs-fs-evm.bin {
+   filename = "tiboot3-am62x-hs-fs-evm.bin";
+   symlink = "tiboot3.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl_fs>, <&ti_fs_enc_fs>, 
<&combined_tifs_cfg_fs>,
+   <&combined_dm_cfg_fs>, <&sysfw_inner_cert_fs>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl_fs>;
+   content-sysfw = <&ti_fs_enc_fs>;
+   content-sysfw-data = <&combined_tifs_cfg_fs>;
+   content-sysfw-in

[PATCH v5 17/23] am62a: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img

2023-07-07 Thread Neha Malcom Francis
Support added for HS-SE, HS-FS and GP boot binaries for AM62ax.

HS-SE:
* tiboot3-am62ax-hs-evm.bin
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-am62ax-hs-fs-evm.bin
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-am62ax-gp-evm.bin
* tispl.bin_unsigned
* u-boot.img_unsigned

It is to be noted that the bootflow followed by AM62ax requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-am62a-sk-binman.dtsi | 466 +++
 arch/arm/dts/k3-am62a7-r5-sk.dts |   1 +
 arch/arm/dts/k3-am62a7-sk.dts|   1 +
 board/ti/am62ax/Kconfig  |   2 +
 4 files changed, 470 insertions(+)
 create mode 100644 arch/arm/dts/k3-am62a-sk-binman.dtsi

diff --git a/arch/arm/dts/k3-am62a-sk-binman.dtsi 
b/arch/arm/dts/k3-am62a-sk-binman.dtsi
new file mode 100644
index 00..abbac8f084
--- /dev/null
+++ b/arch/arm/dts/k3-am62a-sk-binman.dtsi
@@ -0,0 +1,466 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_AM62A7_R5_EVM
+
+&rcfg_yaml_tifs {
+   config = "tifs-rm-cfg.yaml";
+};
+
+&binman {
+   tiboot3-am62ax-hs-evm.bin {
+   filename = "tiboot3-am62ax-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>, <&ti_fs_enc>, 
<&combined_tifs_cfg>,
+   <&combined_dm_cfg>, <&sysfw_inner_cert>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl>;
+   content-sysfw = <&ti_fs_enc>;
+   content-sysfw-data = <&combined_tifs_cfg>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert>;
+   content-dm-data = <&combined_dm_cfg>;
+   load = <0x43c0>;
+   load-sysfw = <0x4>;
+   load-sysfw-data = <0x67000>;
+   load-dm-data = <0x43c3a800>;
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   ti_fs_enc: ti-fs-enc.bin {
+   filename = "ti-sysfw/ti-fs-firmware-am62ax-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_tifs_cfg: combined-tifs-cfg.bin {
+   filename = "combined-tifs-cfg.bin";
+   type = "blob-ext";
+   };
+   sysfw_inner_cert: sysfw-inner-cert {
+   filename = "ti-sysfw/ti-fs-firmware-am62ax-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_dm_cfg: combined-dm-cfg.bin {
+   filename = "combined-dm-cfg.bin";
+   type = "blob-ext";
+   };
+   };
+};
+
+&binman {
+   tiboot3-am62ax-hs-fs-evm.bin {
+   filename = "tiboot3-am62ax-hs-fs-evm.bin";
+   symlink = "tiboot3.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl_fs>, <&ti_fs_enc_fs>, 
<&combined_tifs_cfg_fs>,
+   <&combined_dm_cfg_fs>, <&sysfw_inner_cert_fs>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl_fs>;
+   content-sysfw = <&ti_fs_enc_fs>;
+   content-sysfw-data = <&combined_tifs_cfg_fs>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert_fs>;
+   content-dm-data = <&combined_dm_cfg_fs>;
+   load = <0x43c0>;
+   load-sysfw = <0x4>;
+   load-sysfw-data = <0x67000>;
+  

[PATCH v5 18/23] arm: k3-am65x-iot2050: Use binman for tispl.bin for iot2050

2023-07-07 Thread Neha Malcom Francis
Move to using binman to generate tispl.bin which is used to generate the
final flash.bin bootloader for iot2050 boards.

Signed-off-by: Neha Malcom Francis 
Cc: Jan Kiszka 
---
 arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 76 +++-
 1 file changed, 74 insertions(+), 2 deletions(-)

diff --git a/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi 
b/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi
index 03ccc54329..9d83898d33 100644
--- a/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi
+++ b/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi
@@ -26,9 +26,81 @@
missing-msg = "iot2050-seboot";
};
 
-   blob@0x18 {
+   fit@0x18 {
offset = <0x18>;
-   filename = "tispl.bin";
+   pad-byte = <0xff>;
+   description = "Configuration to load ATF and SPL";
+
+   images {
+   atf {
+   description = "ARM Trusted Firmware";
+   type = "firmware";
+   arch = "arm64";
+   compression = "none";
+   os = "arm-trusted-firmware";
+   load = ;
+   entry = ;
+   atf: atf-bl31 {
+   };
+   };
+
+   tee {
+   description = "OPTEE";
+   type = "tee";
+   arch = "arm64";
+   compression = "none";
+   os = "tee";
+   load = <0x9e80>;
+   entry = <0x9e80>;
+   tee: tee-os {
+   };
+   };
+
+   dm {
+   description = "DM binary";
+   type = "firmware";
+   arch = "arm32";
+   compression = "none";
+   os = "DM";
+   load = <0x8900>;
+   entry = <0x8900>;
+   blob-ext {
+   filename = "/dev/null";
+   };
+   };
+
+   spl {
+   description = "SPL (64-bit)";
+   type = "standalone";
+   os = "U-Boot";
+   arch = "arm64";
+   compression = "none";
+   load = ;
+   entry = ;
+   u_boot_spl_nodtb: blob-ext {
+   filename = 
"spl/u-boot-spl-nodtb.bin";
+   };
+   };
+
+   fdt-0 {
+   description = "k3-am65-iot2050-spl.dtb";
+   type = "flat_dt";
+   arch = "arm";
+   compression = "none";
+   spl_am65x_evm_dtb: blob-ext {
+   filename = 
"spl/dts/k3-am65-iot2050-spl.dtb";
+   };
+   };
+   };
+
+   configurations {
+   default = "spl";
+   spl {
+   fdt = "fdt-0";
+   firmware = "atf";
+   loadables = "tee", "dm", "spl";
+   };
+   };
};
 
fit@0x38 {
-- 
2.34.1



[PATCH v5 16/23] am62a: yaml: Add board configs for AM62ax

2023-07-07 Thread Neha Malcom Francis
Added YAML configs for AM62ax

Signed-off-by: Neha Malcom Francis 
---
 board/ti/am62ax/board-cfg.yaml   |   36 +
 board/ti/am62ax/pm-cfg.yaml  |   12 +
 board/ti/am62ax/rm-cfg.yaml  | 1151 ++
 board/ti/am62ax/sec-cfg.yaml |  379 ++
 board/ti/am62ax/tifs-rm-cfg.yaml | 1011 ++
 5 files changed, 2589 insertions(+)
 create mode 100644 board/ti/am62ax/board-cfg.yaml
 create mode 100644 board/ti/am62ax/pm-cfg.yaml
 create mode 100644 board/ti/am62ax/rm-cfg.yaml
 create mode 100644 board/ti/am62ax/sec-cfg.yaml
 create mode 100644 board/ti/am62ax/tifs-rm-cfg.yaml

diff --git a/board/ti/am62ax/board-cfg.yaml b/board/ti/am62ax/board-cfg.yaml
new file mode 100644
index 00..6e45b494e0
--- /dev/null
+++ b/board/ti/am62ax/board-cfg.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM62ax
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x10
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
diff --git a/board/ti/am62ax/pm-cfg.yaml b/board/ti/am62ax/pm-cfg.yaml
new file mode 100644
index 00..a491f11260
--- /dev/null
+++ b/board/ti/am62ax/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM62ax
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/am62ax/rm-cfg.yaml b/board/ti/am62ax/rm-cfg.yaml
new file mode 100644
index 00..0e11bd3e3c
--- /dev/null
+++ b/board/ti/am62ax/rm-cfg.yaml
@@ -0,0 +1,1151 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for AM62ax
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 12
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 30
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 36
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #5
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #6
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #7
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #8
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #9
+host_id: 0
+allowed_atype : 0

[PATCH v5 19/23] k3: tools: config.mk: Update makefile and remove scripts

2023-07-07 Thread Neha Malcom Francis
Since binman is used to package bootloader images for all K3 devices, we
do not have to rely on the earlier methods to package them.

Scripts that were used to generate x509 certificate for tiboot3.bin and
generate tispl.bin, u-boot.img have been removed.

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
---
 arch/arm/mach-k3/config.mk | 103 ---
 tools/k3_fit_atf.sh| 123 -
 tools/k3_gen_x509_cert.sh  | 262 -
 3 files changed, 488 deletions(-)
 delete mode 100644 arch/arm/mach-k3/config.mk
 delete mode 100755 tools/k3_fit_atf.sh
 delete mode 100755 tools/k3_gen_x509_cert.sh

diff --git a/arch/arm/mach-k3/config.mk b/arch/arm/mach-k3/config.mk
deleted file mode 100644
index cbf9c10210..00
--- a/arch/arm/mach-k3/config.mk
+++ /dev/null
@@ -1,103 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Copyright (C) 2017-2018 Texas Instruments Incorporated - http://www.ti.com/
-#  Lokesh Vutla 
-
-ifdef CONFIG_SPL_BUILD
-
-# Openssl is required to generate x509 certificate.
-# Error out if openssl is not available.
-ifeq ($(shell which openssl),)
-$(error "No openssl in $(PATH), consider installing openssl")
-endif
-
-IMAGE_SIZE= $(shell cat $(obj)/u-boot-spl.bin | wc -c)
-MAX_SIZE= $(shell printf "%d" $(CONFIG_SYS_K3_MAX_DOWNLODABLE_IMAGE_SIZE))
-
-ifeq ($(CONFIG_SYS_K3_KEY), "")
-KEY=""
-# On HS use real key or warn if not available
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
-ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/keys/custMpk.pem),)
-KEY=$(TI_SECURE_DEV_PKG)/keys/custMpk.pem
-else
-$(warning "WARNING: signing key not found. Random key will NOT work on HS 
hardware!")
-endif
-endif
-else
-KEY=$(patsubst "%",$(srctree)/%,$(CONFIG_SYS_K3_KEY))
-endif
-
-# X509 SWRV default
-SWRV = $(CONFIG_K3_X509_SWRV)
-# On HS use SECDEV provided software revision or warn if not available
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
-ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/keys/swrv.txt),)
-SWRV= $(shell cat $(TI_SECURE_DEV_PKG)/keys/swrv.txt)
-else
-$(warning "WARNING: Software revision file not found. Default may not work on 
HS hardware.")
-endif
-endif
-
-# tiboot3.bin is mandated by ROM and ROM only supports R5 boot.
-# So restrict tiboot3.bin creation for CPU_V7R.
-ifdef CONFIG_CPU_V7R
-image_check: $(obj)/u-boot-spl.bin FORCE
-   @if [ $(IMAGE_SIZE) -gt $(MAX_SIZE) ]; then \
-   echo "===" >&2; \
-   echo "ERROR: Final Image too big. " >&2;\
-   echo "$< size = $(IMAGE_SIZE), max size = $(MAX_SIZE)" >&2; \
-   echo "===" >&2; \
-   exit 1; \
-   fi
-
-tiboot3.bin: image_check FORCE
-   $(srctree)/tools/k3_gen_x509_cert.sh -c 16 -b $(obj)/u-boot-spl.bin \
-   -o $@ -l $(CONFIG_SPL_TEXT_BASE) -r $(SWRV) -k 
$(KEY)
-
-INPUTS-y   += tiboot3.bin
-endif
-
-ifdef CONFIG_ARM64
-
-ifeq ($(CONFIG_SOC_K3_J721E),)
-export DM := /dev/null
-endif
-
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
-SPL_ITS := u-boot-spl-k3_HS.its
-$(SPL_ITS): export IS_HS=1
-INPUTS-y   += tispl.bin_HS
-INPUTS-y   += tispl.bin
-tispl.bin: $(obj)/u-boot-spl-nodtb.bin_HS $(patsubst 
%,$(obj)/dts/%.dtb_HS,$(subst ",,$(CONFIG_SPL_OF_LIST)))
-else
-SPL_ITS := u-boot-spl-k3.its
-INPUTS-y   += tispl.bin
-endif
-
-ifeq ($(CONFIG_SPL_OF_LIST),)
-LIST_OF_DTB := $(CONFIG_DEFAULT_DEVICE_TREE)
-else
-LIST_OF_DTB := $(CONFIG_SPL_OF_LIST)
-endif
-
-quiet_cmd_k3_mkits = MKITS   $@
-cmd_k3_mkits = \
-   $(srctree)/tools/k3_fit_atf.sh \
-   $(CONFIG_K3_ATF_LOAD_ADDR) \
-   $(patsubst %,$(obj)/dts/%.dtb,$(subst ",,$(LIST_OF_DTB))) > $@
-
-$(SPL_ITS): FORCE
-   $(call cmd,k3_mkits)
-endif
-
-else
-
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
-INPUTS-y   += u-boot.img_HS
-else
-INPUTS-y   += u-boot.img
-endif
-endif
-
-include $(srctree)/arch/arm/mach-k3/config_secure.mk
diff --git a/tools/k3_fit_atf.sh b/tools/k3_fit_atf.sh
deleted file mode 100755
index 7bc07ad074..00
--- a/tools/k3_fit_atf.sh
+++ /dev/null
@@ -1,123 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0+
-#
-# script to generate FIT image source for K3 Family boards with
-# ATF, OPTEE, SPL and multiple device trees (given on the command line).
-# Inspired from board/sunxi/mksunxi_fit_atf.sh
-#
-# usage: $0   [ [&2
-   ATF=/dev/null
-fi
-
-[ -z "$TEE" ] && TEE="bl32.bin"
-
-if [ ! -f $TEE ]; then
-   echo "WARNING OPTEE file $TEE NOT found, resulting might be 
non-functional" >&2
-   TEE=/dev/null
-fi
-
-[ -z "$DM" ] && DM="dm.bin"
-
-if [ ! -e $DM ]; then
-   echo "W

[PATCH v5 20/23] doc: board: ti: Update documentation for binman flow

2023-07-07 Thread Neha Malcom Francis
Earlier documentation specified builds for generating bootloader images
using an external TI repository k3-image-gen and core-secdev-k3. Modify
this to using the binman flow so that user understands how to build the
final boot images.

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
---
 doc/board/ti/am62x_sk.rst  | 42 -
 doc/board/ti/j721e_evm.rst | 50 +---
 doc/board/ti/k3.rst| 95 +-
 3 files changed, 73 insertions(+), 114 deletions(-)

diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst
index 27d7b527c6..e4d58b4958 100644
--- a/doc/board/ti/am62x_sk.rst
+++ b/doc/board/ti/am62x_sk.rst
@@ -115,23 +115,19 @@ Below is the pictorial representation of boot flow:
 
 Sources:
 
-1. SYSFW:
-   Tree: git://git.ti.com/k3-image-gen/k3-image-gen.git
-   Branch: master
-
-2. ATF:
+1. ATF:
Tree: https://github.com/ARM-software/arm-trusted-firmware.git
Branch: master
 
-3. OPTEE:
+2. OPTEE:
Tree: https://github.com/OP-TEE/optee_os.git
Branch: master
 
-4. U-Boot:
+3. U-Boot:
Tree: https://source.denx.de/u-boot/u-boot
Branch: master
 
-5. TI Linux Firmware:
+4. TI Linux Firmware:
Tree: git://git.ti.com/processor-firmware/ti-linux-firmware.git
Branch: ti-linux-firmware
 
@@ -139,35 +135,37 @@ Build procedure:
 
 1. ATF:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make CROSS_COMPILE=aarch64-none-linux-gnu- ARCH=aarch64 PLAT=k3 
TARGET_BOARD=lite SPD=opteed
+ $ make CROSS_COMPILE=aarch64-none-linux-gnu- ARCH=aarch64 PLAT=k3 \
+TARGET_BOARD=lite SPD=opteed
 
 2. OPTEE:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make PLATFORM=k3 CFG_ARM64_core=y CROSS_COMPILE=arm-none-linux-gnueabihf- 
CROSS_COMPILE64=aarch64-none-linux-gnu-
+ $ make PLATFORM=k3 CFG_ARM64_core=y CROSS_COMPILE=arm-none-linux-gnueabihf- \
+CROSS_COMPILE64=aarch64-none-linux-gnu-
 
 3. U-Boot:
 
 * 3.1 R5:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- 
am62x_evm_r5_defconfig O=/tmp/r5
- $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=/tmp/r5
- $ cd 
- $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- SOC=am62x 
SBL=/tmp/r5/spl/u-boot-spl.bin SYSFW_PATH=/ti-sysfw/ti-fs-firmware-am62x-gp.bin
-
-Use the tiboot3.bin generated from last command
+ $ make ARCH=arm am62x_evm_r5_defconfig
+ $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- \
+BINMAN_INDIRS=
 
 * 3.2 A53:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- am62x_evm_a53_defconfig 
O=/tmp/a53
- $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- ATF=/build/k3/lite/release/bl31.bin TEE=/out/arm-plat-k3/core/tee-pager_v2.bin DM=/ti-dm/am62xx/ipc_echo_testb_mcu1_0_release_strip.xer5f 
O=/tmp/a53
+ $ make ARCH=arm am62x_evm_a53_defconfig
+ $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- \
+BL31=/build/k3/lite/release/bl31.bin \
+TEE=/out/arm-plat-k3/core/tee-pager_v2.bin \
+BINMAN_INDIRS=
 
 Target Images
 --
diff --git a/doc/board/ti/j721e_evm.rst b/doc/board/ti/j721e_evm.rst
index feaa2da5e9..9e604f6f12 100644
--- a/doc/board/ti/j721e_evm.rst
+++ b/doc/board/ti/j721e_evm.rst
@@ -130,67 +130,61 @@ support. Below is the pictorial representation of boot 
flow:
 
 Sources:
 
-1. SYSFW:
-   Tree: git://git.ti.com/k3-image-gen/k3-image-gen.git
-   Branch: master
-
-2. ATF:
+1. ATF:
Tree: https://github.com/ARM-software/arm-trusted-firmware.git
Branch: master
 
-3. OPTEE:
+2. OPTEE:
Tree: https://github.com/OP-TEE/optee_os.git
Branch: master
 
-4. DM Firmware:
-   Tree: git://git.ti.com/processor-firmware/ti-linux-firmware.git
-   Branch: ti-linux-firmware
-
-5. U-Boot:
+3. U-Boot:
Tree: https://source.denx.de/u-boot/u-boot
Branch: master
 
+4. TI Linux Firmware:
+   Tree: git://git.ti.com/processor-firmware/ti-linux-firmware.git
+   Branch: ti-linux-firmware
+
 Build procedure:
 
-1. SYSFW:
-
-.. code-block:: bash
-
-make CROSS_COMPILE=arm-linux-gnueabihf- SOC=j721e
-
-2. ATF:
+1. ATF:
 
 .. code-block:: bash
 
-make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 
TARGET_BOARD=generic SPD=opteed
+ $ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 \
+TARGET_BOARD=generic SPD=opteed
 
-3. OPTEE:
+2. OPTEE:
 
 .. code-block:: bash
 
-make PLATFORM=k3-j721e CFG_ARM64_core=y
+ $ make PLATFORM=k3-j721e CFG_ARM64_core=y
 
-4. U-Boot:
+3. U-Boot:
 
 * 4.1 R5:
 
 .. code-block:: bash
 
-make CROSS_COMPILE=arm-linux-gnueabihf- j721e_evm_r5_defconfig O=build/r5
-make CROSS_COMPILE=arm-linux-gnueabihf- O=build/r5
+ $ make j721e_evm_r5_defconfig
+ $ make CROSS_COMPILE=arm-linux-gnueabihf- \
+BINMAN_INDIRS=
 
 * 4.2 A72:
 
 .. code-block:: bash
 
-make

[PATCH v5 21/23] binman: Overwrite symlink if it already exists

2023-07-07 Thread Neha Malcom Francis
From: Andrew Davis 

Without this re-building will fail with an error when trying to create
the symlink for the second time with an already exists error.

Signed-off-by: Andrew Davis 
Signed-off-by: Neha Malcom Francis 
---
 tools/binman/image.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/binman/image.py b/tools/binman/image.py
index 8ebf71d61a..e77b5d0d97 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -182,6 +182,8 @@ class Image(section.Entry_section):
 # Create symlink to file if symlink given
 if self._symlink is not None:
 sname = tools.get_output_filename(self._symlink)
+if os.path.islink(sname):
+os.remove(sname)
 os.symlink(fname, sname)
 
 def WriteMap(self):
-- 
2.34.1



[PATCH v5 22/23] buildman: Create a requirements.txt file

2023-07-07 Thread Neha Malcom Francis
From: Tom Rini 

At this point, buildman requires a few different modules and so we need
a requirements.txt to track what modules are needed.

Cc: Simon Glass 
Cc: Neha Malcom Francis 
Signed-off-by: Tom Rini 
Reviewed-by: Simon Glass 
Signed-off-by: Neha Malcom Francis 
---
 tools/buildman/requirements.txt | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 tools/buildman/requirements.txt

diff --git a/tools/buildman/requirements.txt b/tools/buildman/requirements.txt
new file mode 100644
index 00..a1efcb9d4b
--- /dev/null
+++ b/tools/buildman/requirements.txt
@@ -0,0 +1,2 @@
+jsonschema==4.17.3
+pyyaml==6.0
-- 
2.34.1



[PATCH v5 23/23] CI: Make use of buildman requirements.txt

2023-07-07 Thread Neha Malcom Francis
From: Tom Rini 

Now that buildman has a requirements.txt file we need to make use of it.

Signed-off-by: Tom Rini 
Reviewed-by: Simon Glass 
[n-fran...@ti.com: Adding missing command from .azure-pipelines.yml]
Signed-off-by: Neha Malcom Francis 
---
 .azure-pipelines.yml | 4 
 .gitlab-ci.yml   | 4 
 2 files changed, 8 insertions(+)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 06c46b681c..8626b27d4b 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -162,6 +162,7 @@ stages:
   virtualenv -p /usr/bin/python3 /tmp/venv
   . /tmp/venv/bin/activate
   pip install -r test/py/requirements.txt
+  pip install -r tools/buildman/requirements.txt
   export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl
   export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
   export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}
@@ -209,6 +210,7 @@ stages:
   git config --global --add safe.directory $(work_dir)
   export USER=azure
   pip install -r test/py/requirements.txt
+  pip install -r tools/buildman/requirements.txt
   pip install asteval pylint==2.12.2 pyopenssl
   export PATH=${PATH}:~/.local/bin
   echo "[MASTER]" >> .pylintrc
@@ -404,6 +406,7 @@ stages:
   if [ -n "${BUILD_ENV}" ]; then
   export ${BUILD_ENV};
   fi
+  pip install -r tools/buildman/requirements.txt
   tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e 
--board ${TEST_PY_BD} ${OVERRIDE}
   cp ~/grub_x86.efi ${UBOOT_TRAVIS_BUILD_DIR}/
   cp ~/grub_x64.efi ${UBOOT_TRAVIS_BUILD_DIR}/
@@ -583,6 +586,7 @@ stages:
   # make environment variables available as tests are running inside a 
container
   export BUILDMAN="${BUILDMAN}"
   git config --global --add safe.directory ${WORK_DIR}
+  pip install -r tools/buildman/requirements.txt
   EOF
   cat << "EOF" >> build.sh
   if [[ "${BUILDMAN}" != "" ]]; then
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cfd58513c3..07d8ba5ac2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -97,6 +97,7 @@ build all 32bit ARM platforms:
   script:
 - ret=0;
   git config --global --add safe.directory "${CI_PROJECT_DIR}";
+  pip install -r tools/buildman/requirements.txt;
   ./tools/buildman/buildman -o /tmp -PEWM arm -x aarch64 || ret=$?;
   if [[ $ret -ne 0 ]]; then
 ./tools/buildman/buildman -o /tmp -seP;
@@ -110,6 +111,7 @@ build all 64bit ARM platforms:
 - . /tmp/venv/bin/activate
 - ret=0;
   git config --global --add safe.directory "${CI_PROJECT_DIR}";
+  pip install -r tools/buildman/requirements.txt;
   ./tools/buildman/buildman -o /tmp -PEWM aarch64 || ret=$?;
   if [[ $ret -ne 0 ]]; then
 ./tools/buildman/buildman -o /tmp -seP;
@@ -208,6 +210,7 @@ Run binman, buildman, dtoc, Kconfig and patman testsuites:
   virtualenv -p /usr/bin/python3 /tmp/venv;
   . /tmp/venv/bin/activate;
   pip install -r test/py/requirements.txt;
+  pip install -r tools/buildman/requirements.txt;
   export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl;
   export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
   export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
@@ -240,6 +243,7 @@ Run pylint:
   script:
 - git config --global --add safe.directory "${CI_PROJECT_DIR}"
 - pip install -r test/py/requirements.txt
+- pip install -r tools/buildman/requirements.txt
 - pip install asteval pylint==2.12.2 pyopenssl
 - export PATH=${PATH}:~/.local/bin
 - echo "[MASTER]" >> .pylintrc
-- 
2.34.1



[PATCH v5 04/23] j721e: schema: yaml: Add general schema and J721E board config files

2023-07-07 Thread Neha Malcom Francis
Schema file in YAML must be provided in board/ti/common for validating
input config files and packaging system firmware. The schema includes
entries for rm-cfg, board-cfg, pm-cfg and sec-cfg.

Board config files must be provided in board/ti/ in YAML.
These can then be consumed for generation of binaries to package system
firmware. Added YAML configs for J721E in particular.

Signed-off-by: Tarun Sahu 
[n-fran...@ti.com: prepared patch for upstreaming]
Signed-off-by: Neha Malcom Francis 
---
 board/ti/common/schema.yaml   |  436 +
 board/ti/j721e/board-cfg.yaml |   37 +
 board/ti/j721e/pm-cfg.yaml|   13 +
 board/ti/j721e/rm-cfg.yaml| 3174 +
 board/ti/j721e/sec-cfg.yaml   |  381 
 5 files changed, 4041 insertions(+)
 create mode 100644 board/ti/common/schema.yaml
 create mode 100644 board/ti/j721e/board-cfg.yaml
 create mode 100644 board/ti/j721e/pm-cfg.yaml
 create mode 100644 board/ti/j721e/rm-cfg.yaml
 create mode 100644 board/ti/j721e/sec-cfg.yaml

diff --git a/board/ti/common/schema.yaml b/board/ti/common/schema.yaml
new file mode 100644
index 00..8023ecb0e0
--- /dev/null
+++ b/board/ti/common/schema.yaml
@@ -0,0 +1,436 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Config schema for TI K3 devices
+#
+
+---
+
+definitions:
+u8:
+type: integer
+minimum: 0
+maximum: 0xff
+u16:
+type: integer
+minimum: 0
+maximum: 0x
+u32:
+type: integer
+minimum: 0
+maximum: 0x
+
+
+
+type: object
+properties:
+pm-cfg:
+type: object
+properties:
+rev:
+type: object
+properties:
+boardcfg_abi_maj:
+$ref: "#/definitions/u8"
+boardcfg_abi_min:
+$ref: "#/definitions/u8"
+board-cfg:
+type: object
+properties:
+rev:
+type: object
+properties:
+boardcfg_abi_maj:
+$ref: "#/definitions/u8"
+boardcfg_abi_min:
+$ref: "#/definitions/u8"
+control:
+type: object
+properties:
+subhdr:
+type: object
+properties:
+magic:
+$ref: "#/definitions/u16"
+size:
+$ref: "#/definitions/u16"
+main_isolation_enable:
+$ref: "#/definitions/u8"
+main_isolation_hostid:
+$ref: "#/definitions/u16"
+
+
+secproxy:
+type: object
+properties:
+subhdr:
+type: object
+properties:
+magic:
+$ref: "#/definitions/u16"
+size:
+$ref: "#/definitions/u16"
+scaling_factor:
+$ref: "#/definitions/u8"
+scaling_profile:
+$ref: "#/definitions/u8"
+disable_main_nav_secure_proxy:
+$ref: "#/definitions/u8"
+
+msmc:
+type: object
+properties:
+subhdr:
+type: object
+properties:
+magic:
+$ref: "#/definitions/u16"
+size:
+$ref: "#/definitions/u16"
+msmc_cache_size:
+$ref: "#/definitions/u8"
+debug_cfg:
+type: object
+properties:
+subhdr:
+type: object
+properties:
+magic:
+$ref: "#/definitions/u16"
+size:
+$ref: "#/definitions/u16"
+trace_dst_enables:
+$ref: "#/definitions/u16"
+trace_src_enables:
+$ref: "#/definitions/u16"
+
+sec-cfg:
+type: object
+properties:
+rev:
+type: object
+properties:
+boardcfg_abi_maj:
+$ref: "#/definitions/u8"
+boardcfg_abi_min:

Re: [PATCH v5 18/23] arm: k3-am65x-iot2050: Use binman for tispl.bin for iot2050

2023-07-10 Thread Neha Malcom Francis

Hi Jan

On 07/07/23 19:08, Jan Kiszka wrote:

On 07.07.23 14:34, Neha Malcom Francis wrote:

Move to using binman to generate tispl.bin which is used to generate the
final flash.bin bootloader for iot2050 boards.

Signed-off-by: Neha Malcom Francis 
Cc: Jan Kiszka 
---
  arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 76 +++-
  1 file changed, 74 insertions(+), 2 deletions(-)

diff --git a/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi 
b/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi
index 03ccc54329..9d83898d33 100644
--- a/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi
+++ b/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi
@@ -26,9 +26,81 @@
missing-msg = "iot2050-seboot";
};
  
-		blob@0x18 {

+   fit@0x18 {
offset = <0x18>;
-   filename = "tispl.bin";
+   pad-byte = <0xff>;
+   description = "Configuration to load ATF and SPL";
+
+   images {
+   atf {
+   description = "ARM Trusted Firmware";
+   type = "firmware";
+   arch = "arm64";
+   compression = "none";
+   os = "arm-trusted-firmware";
+   load = ;
+   entry = ;
+   atf: atf-bl31 {
+   };
+   };
+
+   tee {
+   description = "OPTEE";
+   type = "tee";
+   arch = "arm64";
+   compression = "none";
+   os = "tee";
+   load = <0x9e80>;
+   entry = <0x9e80>;
+   tee: tee-os {
+   };
+   };
+
+   dm {
+   description = "DM binary";
+   type = "firmware";
+   arch = "arm32";
+   compression = "none";
+   os = "DM";
+   load = <0x8900>;
+   entry = <0x8900>;
+   blob-ext {
+   filename = "/dev/null";
+   };
+   };
+
+   spl {
+   description = "SPL (64-bit)";
+   type = "standalone";
+   os = "U-Boot";
+   arch = "arm64";
+   compression = "none";
+   load = ;
+   entry = ;
+   u_boot_spl_nodtb: blob-ext {
+   filename = 
"spl/u-boot-spl-nodtb.bin";
+   };
+   };
+
+   fdt-0 {
+   description = "k3-am65-iot2050-spl.dtb";
+   type = "flat_dt";
+   arch = "arm";
+   compression = "none";
+   spl_am65x_evm_dtb: blob-ext {
+   filename = 
"spl/dts/k3-am65-iot2050-spl.dtb";
+   };
+   };
+   };
+
+   configurations {
+   default = "spl";
+   spl {
+   fdt = "fdt-0";
+   firmware = "atf";
+   loadables = "tee", "dm", "spl";
+       };
+   };
};
  
  		fit@0x38 {


Looks ok (will have to test), but this lacks adjustment of
tools/iot2050-sign-fw.sh, probably something around
s/tispl.bin/fit@0x18/g.



Okay, let us know once tested.

Regarding the naming used in tools/iot2050-sign-fw.sh; would you like me to 
preserve tispl.bin naming in the dts?



Jan



--
Thanking You
Neha Malcom Francis


Re: [PATCH v5 11/23] am64x: dts: binman: Package tiboot3.bin, tispl.bin u-boot.img

2023-07-10 Thread Neha Malcom Francis

Hi Simon

On 07/07/23 23:05, Simon Glass wrote:

Hi Neha,

On Fri, 7 Jul 2023 at 13:36, Neha Malcom Francis  wrote:


Support added for HS and GP boot binaries for AM64x.

HS-SE:
 * tiboot3-am64x_sr2-hs-evm.bin
 * tispl.bin
 * u-boot.img

HS-FS:
 * tiboot3-am64x_sr2-hs-fs-evm.bin
 * tispl.bin
 * u-boot.img

GP:
 * tiboot3.bin --> tiboot3-am64x-gp-evm.bin
 * tispl.bin_unsigned
 * u-boot.img_unsigned

Note that the bootflow followed by AM64x requires:

tiboot3.bin:
 * R5 SPL
 * R5 SPL dtbs
 * sysfw
 * board-cfg
 * pm-cfg
 * sec-cfg
 * rm-cfg

tispl.bin:
 * ATF
 * OPTEE
 * A53 SPL
 * A53 SPL dtbs

u-boot.img:
 * A53 U-Boot
 * A53 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
  arch/arm/dts/k3-am642-evm-u-boot.dtsi |   2 +
  arch/arm/dts/k3-am642-r5-evm.dts  |   1 +
  arch/arm/dts/k3-am642-sk-u-boot.dtsi  |   2 +
  arch/arm/dts/k3-am64x-binman.dtsi | 515 ++
  board/ti/am64x/Kconfig|   2 +
  5 files changed, 522 insertions(+)
  create mode 100644 arch/arm/dts/k3-am64x-binman.dtsi


It looks like the template feature (see pending patches) might help
reduce the size of the .dtsi, but we can worry about that later.



Right, I'll have a shot at it once this series is up. Thanks!


Regards,
Simon


--
Thanking You
Neha Malcom Francis


[PATCH v6 00/23] Migration to using binman for bootloader

2023-07-12 Thread Neha Malcom Francis
This series aims to eliminate the use of additional custom repositories
such as k3-image-gen (K3 Image Generation) repo and core-secdev-k3 (K3
Security Development Tools) that was plumbed into the U-Boot build flow
to generate boot images for TI K3 platform devices. And instead, we move
towards using binman that aligns better with the community standard build
flow.

This series uses binman for all K3 platforms supported on U-Boot currently;
both HS (High Security, both SE and FS) and GP (General Purpose) devices.

Background on using k3-image-gen:
* TI K3 devices require a SYSFW (System Firmware) image consisting
of a signed system firmware image and board configuration binaries,
this is needed to bring up system firmware during U-Boot R5 SPL
startup.
* Board configuration data contain board-specific information
such as resource management, power management and security.

Background on using core-secdev-k3:
* Contains resources to sign x509 certificates for HS devices

Series intends to use binman to take over the packaging and signing for
the R5 bootloader images tiboot3.bin (and sysfw.itb, for non-combined
boot flow) instead of k3-image-gen.

Series also packages the A72/A53 bootloader images (tispl.bin and
u-boot.img) using ATF, OPTEE and DM (Device Manager)

Changes in v6:
- addressed whitespace warnings
- added testcase for overwriting symlink functionality
- s%/Arm Trusted Firmware/Trusted Firmware-A
- s%/tee-pager_v2.bin/tee-raw.bin
- k3-am65-iot2050 image fit@0x18 filename changed to
  tispl.bin

Changes in v5:
- updated all board configurations to latest
- changed output binary filenames
- fixed multiple certificate generation leading to packaging
  inconsistency in ti-secure*.py
- added patch to overwrite symlink if exists, patch 21/23
  ("binman: Overwrite symlink if it already exists")

Changes in v4:
- added support for iot2050
- documentation fixes
- move to using self.Raise in ti-board-config etype
- introduced common k3-binman.dtsi (further reduction in code
  duplication can be targeted, this as first step)

Changes in v3:
- added support for HS-FS devices
- added support for AM68-sk
- added back dropped documentation patch
- changed prefix for SYSFW and DM files to expected directory
  name
- extended test coverage to 100%
- documentation fixes
- corrected formatting changes

Changes in v2:
- removed all external scripts
- created ti-board-config etype to support generation of board
  config binaries
- created ti-secure and ti-secure-rom etypes to handle signing
  instead of using external TI_SECURE_DEV_PKG
- updated openssl btool to support x509 certificate generation
- dropped Makefile changes to obtain external binary components,
  moving to using BINMAN_INDIRS to achieve the same

CI/CD passes 100% (series based on -next) [1]

v1: 
https://patchwork.ozlabs.org/project/uboot/cover/20230120101903.179959-1-n-fran...@ti.com/
v2: 
https://patchwork.ozlabs.org/project/uboot/cover/20230404121342.446935-1-n-fran...@ti.com/
v3: 
https://patchwork.ozlabs.org/project/uboot/cover/20230421123203.1315330-1-n-fran...@ti.com/
 
v4: 
https://patchwork.ozlabs.org/project/uboot/cover/20230518142713.184164-1-n-fran...@ti.com/
v5: 
https://patchwork.ozlabs.org/project/uboot/cover/20230707123450.30329-1-n-fran...@ti.com/

[1] https://github.com/u-boot/u-boot/pull/363

Andrew Davis (1):
  binman: Overwrite symlink if it already exists

Neha Malcom Francis (20):
  binman: ti-board-config: Add support for TI board config binaries
  binman: ti-secure: Add support for TI signing
  arm: dts: k3: Add support for packaging sysfw.itb and tiboot3.bin
  j721e: schema: yaml: Add general schema and J721E board config files
  j721e: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin,
u-boot.img
  j7200: yaml: Add J7200 board config files
  j7200: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img
  am65x: yaml: Add AM65x board config files
  am65: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin,
u-boot.img
  am64x: yaml: Add board configs for AM64x
  am64x: dts: binman: Package tiboot3.bin, tispl.bin u-boot.img
  j721s2: yaml: Add board configs for J721S2
  j721s2: dts: binman: Package tiboot3.bin, tispl.bin and u-boot.img
  am62: yaml: Add board configs for AM62
  am625: dts: binman: Package tiboot3.bin, tispl.bin and u-boot.img
  am62a: yaml: Add board configs for AM62ax
  am62a: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img
  arm: k3-am65x-iot2050: Use binman for tispl.bin for iot2050
  k3: tools: config.mk: Update makefile and remove scripts
  doc: board: ti: Update documentation for binman flow

Tom Rini (2):
  buildman: Create a requirements.txt file

[PATCH v6 01/23] binman: ti-board-config: Add support for TI board config binaries

2023-07-12 Thread Neha Malcom Francis
The ti-board-config entry loads and validates a given YAML config file
against a given schema, and generates the board config binary. K3
devices require these binaries to be packed into the final system
firmware images.

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
---
 tools/binman/entries.rst  |  48 
 tools/binman/etype/ti_board_config.py | 259 ++
 tools/binman/ftest.py |  20 ++
 tools/binman/test/277_ti_board_cfg.dts|  14 +
 .../binman/test/278_ti_board_cfg_combined.dts |  25 ++
 .../binman/test/279_ti_board_cfg_no_type.dts  |  11 +
 tools/binman/test/yaml/config.yaml|  19 ++
 tools/binman/test/yaml/schema.yaml|  50 
 tools/binman/test/yaml/schema_notype.yaml |  39 +++
 9 files changed, 485 insertions(+)
 create mode 100644 tools/binman/etype/ti_board_config.py
 create mode 100644 tools/binman/test/277_ti_board_cfg.dts
 create mode 100644 tools/binman/test/278_ti_board_cfg_combined.dts
 create mode 100644 tools/binman/test/279_ti_board_cfg_no_type.dts
 create mode 100644 tools/binman/test/yaml/config.yaml
 create mode 100644 tools/binman/test/yaml/schema.yaml
 create mode 100644 tools/binman/test/yaml/schema_notype.yaml

diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index b71af801fd..14a2d03fad 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -1658,6 +1658,54 @@ by setting the size of the entry to something larger 
than the text.
 
 
 
+.. _etype_ti_board_config:
+
+Entry: ti-board-config: An entry containing a TI schema validated board config 
binary
+-
+
+This etype supports generation of two kinds of board configuration
+binaries: singular board config binary as well as combined board config
+binary.
+
+Properties / Entry arguments:
+- config-file: File containing board configuration data in YAML
+- schema-file: File containing board configuration YAML schema against
+  which the config file is validated
+
+Output files:
+- board config binary: File containing board configuration binary
+
+These above parameters are used only when the generated binary is
+intended to be a single board configuration binary. Example::
+
+my-ti-board-config {
+ti-board-config {
+config = "board-config.yaml";
+schema = "schema.yaml";
+};
+};
+
+To generate a combined board configuration binary, we pack the
+needed individual binaries into a ti-board-config binary. In this case,
+the available supported subnode names are board-cfg, pm-cfg, sec-cfg and
+rm-cfg. The final binary is prepended with a header containing details about
+the included board config binaries. Example::
+
+my-combined-ti-board-config {
+ti-board-config {
+board-cfg {
+config = "board-cfg.yaml";
+schema = "schema.yaml";
+};
+sec-cfg {
+config = "sec-cfg.yaml";
+schema = "schema.yaml";
+};
+}
+}
+
+
+
 .. _etype_u_boot:
 
 Entry: u-boot: U-Boot flat binary
diff --git a/tools/binman/etype/ti_board_config.py 
b/tools/binman/etype/ti_board_config.py
new file mode 100644
index 00..0799e5dc59
--- /dev/null
+++ b/tools/binman/etype/ti_board_config.py
@@ -0,0 +1,259 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2022 Texas Instruments Incorporated - https://www.ti.com/
+# Written by Neha Malcom Francis 
+#
+# Entry-type module for generating schema validated TI board
+# configuration binary
+#
+
+import os
+import struct
+import yaml
+
+from collections import OrderedDict
+from jsonschema import validate
+from shutil import copyfileobj
+
+from binman.entry import Entry
+from binman.etype.section import Entry_section
+from dtoc import fdt_util
+from u_boot_pylib import tools
+
+BOARDCFG = 0xB
+BOARDCFG_SEC = 0xD
+BOARDCFG_PM = 0xE
+BOARDCFG_RM = 0xC
+BOARDCFG_NUM_ELEMS = 4
+
+class Entry_ti_board_config(Entry_section):
+"""An entry containing a TI schema validated board config binary
+
+This etype supports generation of two kinds of board configuration
+binaries: singular board config binary as well as combined board config
+binary.
+
+Properties / Entry arguments:
+- config-file: File containing board configuration data in YAML
+- schema-file: File containing board configuration YAML schema against
+  which the config file is validated
+
+Output files:
+- board config binary: File containing board configuration binary
+
+These above parameters are used only when the generated binary is
+intended to be a single board configuration binary. Example::
+
+my-ti-board-config {
+ti-board-config {
+config = "board-config.yaml&

[PATCH v6 02/23] binman: ti-secure: Add support for TI signing

2023-07-12 Thread Neha Malcom Francis
The ti-secure entry contains certificate for binaries that will be
loaded or booted by system firmware whereas the ti-secure-rom entry
contains certificate for binaries that will be booted by ROM. Support
for both these types of certificates is necessary for booting of K3
devices.

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[vigne...@ti.com: fixed inconsist cert generation by multiple packing]
Signed-off-by: Vignesh Raghavendra 
---
 board/ti/keys/custMpk.pem |  51 
 board/ti/keys/ti-degenerate-key.pem   |  10 +
 tools/binman/btool/openssl.py | 244 +
 tools/binman/entries.rst  |  65 +
 tools/binman/etype/ti_secure.py   |  78 ++
 tools/binman/etype/ti_secure_rom.py   | 249 ++
 tools/binman/etype/x509_cert.py   |  87 +-
 tools/binman/ftest.py |  52 
 tools/binman/test/279_ti_secure.dts   |  17 ++
 tools/binman/test/280_ti_secure_rom.dts   |  17 ++
 .../test/281_ti_secure_rom_combined.dts   |  25 ++
 tools/binman/test/288_ti_secure_rom_a.dts |  19 ++
 tools/binman/test/289_ti_secure_rom_b.dts |  18 ++
 13 files changed, 924 insertions(+), 8 deletions(-)
 create mode 100644 board/ti/keys/custMpk.pem
 create mode 100644 board/ti/keys/ti-degenerate-key.pem
 create mode 100644 tools/binman/etype/ti_secure.py
 create mode 100644 tools/binman/etype/ti_secure_rom.py
 create mode 100644 tools/binman/test/279_ti_secure.dts
 create mode 100644 tools/binman/test/280_ti_secure_rom.dts
 create mode 100644 tools/binman/test/281_ti_secure_rom_combined.dts
 create mode 100644 tools/binman/test/288_ti_secure_rom_a.dts
 create mode 100644 tools/binman/test/289_ti_secure_rom_b.dts

diff --git a/board/ti/keys/custMpk.pem b/board/ti/keys/custMpk.pem
new file mode 100644
index 00..adba378c80
--- /dev/null
+++ b/board/ti/keys/custMpk.pem
@@ -0,0 +1,51 @@
+-BEGIN RSA PRIVATE KEY-
+MIIJKQIBAAKCAgEAvxSuSdh/ctNrI83rSA5l3CJN8g5PgvbttfLd23yR+m5Z/9X3
+tt4EHYrM0pXZ0eDEwfhQv/9IDJEiUJpMe4vzlgooJrOk2eCpVUEa+z5bJ2y/ysBx
+ry9yIu5GASVirT7HBPaxGLYswBJuD+KbPuWmoKgGRQNBF04WH6l01oRO1nmnELgR
+qQ6SHyXdf7Hy0bnyaNgzWUuCfXfM0Zz6I7T7WIjyzerVFvIsdS36YsPBCW7gBnDg
+tQcJmWLZ1uTnbG3IggdQk/fi2O3RX+PQns+TVNlf3V3ON2DxqxSKBHtlp7p/30VF
+fEuhW65OxpQ9jE6H0pQ8pPOf2vzyNnznDa1aQjfxKoHQbqGnZwMeh+0Au3NKaCgx
+ooKaowTB6If/RX6qwZ/UOwXHg/0hcf69fzjJFhlSDuYDM40dHsk2HM1OnYIpiM2b
+Kr5sX3uysjp5AGp99a0anR7NWCrPXvROgKs7T9341N40osQg2VkZLYUCXh9osUyN
+uREG6S12tViMUKg3bmZ4b4MwRk00n7QYSrm7+nvFrtYyEISEbD+agDM1/E281W5g
+VFDPfm2AlwT6jwsg/b2YK6E3vVn9SuxFoQmLF8lyFDO3BV4SXeJaHc4hVPbh6tVV
+qifrTQnfGUCCLmaJF2XZbrPWOE6NYRbWdNTeFl9RGdVCuIPSyN5LqWmXto0CAwEA
+AQKCAgAzkAwcJ0z1GnId/lJQZno8NhGckRoJuEKbR8dwlCP8VUz6Ca5H7Y9kvXDa
+Hs/hn+rYgP6hYOz7XyrIX2rmJ/T6dxEwqGeC1+o59FConcIRWHpE5zuGT6JYJL5F
+TuZa48bm4v8VMQvQZOjIZpkIFwao8c6HTwKAnHTB5IN/48I2hCt+Cn3RhfoOZ7Rm
+4gkpaSkt+7GXlhXHb82YfujNO+hbktEamhUYlQ9EK70Wa8aqmf3gHxO0JgsEFjW8
+lJaSnultlTW8SDcx3LMUUjCYumECk4oX/VlJfmKYjPlVjkr3QQ+Cm3nNucb4K4hc
+c+JL+2ERhSj8RjXL7VgbNgdPnIjvQDJuTNqecTU8xWPYrkOLQpNibbLjnutLkhJz
+fMyRtmDtrsey8WiCDuCHkPJ8/f8RjL2zWI9fzTDDIzdlEKouUFGOovaHVnbua6pn
+hymcu9d9FV3p2rcbj0ivCs7e8j+vhSxFJEJoAbcQdXCTi/n2uR7pLtoMNiUzsejy
+d46Uz+KEU920NTwE2z6JJq8I2vegnxjc7PDDrV3/5rK04B93aXiqvwWseCpxelrI
+xaMkRHbXrIXRO6MXQ3N+zNq8Dg3hjGTTvaBKuwgvqLwlXY8+Aa3ooFzEOInIOSsI
+XcWqXxt/tgZgsj9RwpC42t8kbA+BkbNk9EIUa+P5kEr2P/fO7QKCAQEA4EtArnOX
+D6tQF8uTw8USOZC2P9s/ez1z4jRq3oKP0Kv4tJiuIObJ/dUvGVD7aM5v2xaCfhm8
+xpk09VPUgghfG5jR5qVvQr75kCNToJQudWi4ngk1HwKJzzTO11giFEdybvTUA+Pj
+fmxCM0dYYqRWZoj0hLqXlUCwxE74BFIhJVjeYbf+nTQrqpllTLoW7MTZHzGx5SXx
+4dNzyVAUH49Yt2D8mgXXCkf5sGLh762wj34b/rR10Kr4O5utGMZrfTRIbuQ1pNjU
+m66baPzq+mC0BzqZEW70TgEb7lOr8rcVXLOi3r36omfd9/MHx7iZD6o3K1axSO15
+grD4ZrN7Ac3QJwKCAQEA2heCoBdpvy6YUk8AO2k8qDygTdmPQRuwjjT+Z2fMslBt
+D7DkpKwZ6Bl9OclcpiiLHmH+hv65KqYg+tR0RRb7PcogB9El9x7yKkGTPZEYWGky
+n8P84rJpKwjnwWQvPQktI1cs3YGvZA9DQTFBavRrwuzgd1oSJq5aPQ2tme0kMvWp
+l1/B/cPK+PKCi/Wfisaze1TjijP9qIeUwkdNN6WLrLU3QgsGppcg2I7RQtAIikT6
+GkuiOQAvWMsrJVV6PNrVKz4fJDJ59Rz6jbDHZNi1MEYNxQoB/Pl7QIakbfjWpHLv
+8Ey7cB2JKxjQy8tmyl8WNQVbXbE6daPXcMTUmaRAKwKCAQBv1lYMJmq+T2eCVen6
+BbvOpE+bi5EdvEiaFBTtmiBnpjg+pJq+oRU60h/H+c9CNR0lGxY6Fk9An4f+g6xE
+ojP6KLsQzJCrsVny+wpp2TlJJcxYULMCIVvhy60PR0zG29E9biqBPhJjKUvhEcQK
+e3LxcXyq6fdHXphFajLUxLbuTl+kTgBRFoBnclFGbsubh5PTsA3J+p+fQLZNPPar
+veg4l82cZykQYU8pGkUaI3sUMYd3+zd7sqRP5JHs9pMGPRmY4YW2CsAIWIn5UZNB
+ARMDP76vKKn8cyUgMuxb+9pU/OVLN2NPs4bEaZQJjAwV+YPEwldny7F47xEM9JVz
+EtKlAoIBAQDUt62u3GdGE/p5/ZgqWoDRTyDEDfmN9aYFbmbdEP80xQE7FrxMaZhz
+K7laja6SWmUm40nQ/c45bQQp4uLtKHcxU15egX7YRBTLZl5o5IasZR79ebnEm2O8
+l9kEZeU1USf3mmWmP4GExOZCRfqaiYA6BbUCdJXTqKdXeWnkAssV8UrS3JFoJHpq
+yo7OWGqefyQ8nRW6jO9SW7uaqtUD+7H6aF5XSk3YWvusfdBZrHNH+fM/hpnZovaL
+Us7ogTDS/laA8PyK37jYfMVdQhmZoU1Iomt3zkUWK3gt/aWPpfAlQf4Jka4YspZB
+tNiijefaZ1hPqsPs5Joyd/YAhdsfaHc1AoIBAQCn/9j6RRjRaw0ip756oad4AXHz
+XBwVB2CrY96qT6Hj9Sq7tGgdskqGkOQkAivBLBizUdcWv0t1yenOsSgasQeMlvlh

[PATCH v6 03/23] arm: dts: k3: Add support for packaging sysfw.itb and tiboot3.bin

2023-07-12 Thread Neha Malcom Francis
Board config binary artifacts must be generated to be used by binman to
package sysfw.itb and tiboot3.bin for all K3 devices.

For devices that follow combined flow, these board configuration
binaries must again be packaged into a combined board configuration
blobs to be used by binman to package tiboot3.bin.

Add common k3-binman.dtsi to generate all the board configuration
binaries needed.

Also add custMpk.pem and ti-degenerate-key.pem needed for signing GP and
HS bootloader images common to all K3 devices.

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
---
 arch/arm/dts/k3-binman.dtsi | 116 
 1 file changed, 116 insertions(+)
 create mode 100644 arch/arm/dts/k3-binman.dtsi

diff --git a/arch/arm/dts/k3-binman.dtsi b/arch/arm/dts/k3-binman.dtsi
new file mode 100644
index 00..97a3573bdb
--- /dev/null
+++ b/arch/arm/dts/k3-binman.dtsi
@@ -0,0 +1,116 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+/ {
+   binman: binman {
+   multiple-images;
+   };
+};
+
+&binman {
+   custMpk {
+   filename = "custMpk.pem";
+   blob-ext {
+   filename = "../keys/custMpk.pem";
+   };
+   };
+
+   ti-degenerate-key {
+   filename = "ti-degenerate-key.pem";
+   blob-ext {
+   filename = "../keys/ti-degenerate-key.pem";
+   };
+   };
+};
+
+#ifndef CONFIG_ARM64
+
+&binman {
+   board-cfg {
+   filename = "board-cfg.bin";
+   bcfg_yaml: ti-board-config {
+   config = "board-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   pm-cfg {
+   filename = "pm-cfg.bin";
+   rcfg_yaml: ti-board-config {
+   config = "pm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   rm-cfg {
+   filename = "rm-cfg.bin";
+   pcfg_yaml: ti-board-config {
+   config = "rm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   sec-cfg {
+   filename = "sec-cfg.bin";
+   scfg_yaml: ti-board-config {
+   config = "sec-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   combined-tifs-cfg {
+   filename = "combined-tifs-cfg.bin";
+   ti-board-config {
+   bcfg_yaml_tifs: board-cfg {
+   config = "board-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   scfg_yaml_tifs: sec-cfg {
+   config = "sec-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   pcfg_yaml_tifs: pm-cfg {
+   config = "pm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   rcfg_yaml_tifs: rm-cfg {
+   config = "rm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   };
+   combined-dm-cfg {
+   filename = "combined-dm-cfg.bin";
+   ti-board-config {
+   pcfg_yaml_dm: pm-cfg {
+   config = "pm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   rcfg_yaml_dm: rm-cfg {
+   config = "rm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   };
+   combined-sysfw-cfg {
+   filename = "combined-sysfw-cfg.bin";
+   ti-board-config {
+   board-cfg {
+   config = "board-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   sec-cfg {
+   config = "sec-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   pm-cfg {
+   config = "pm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   rm-cfg {
+   config = "rm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   };
+};
+
+#endif
-- 
2.34.1



[PATCH v6 05/23] j721e: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin, u-boot.img

2023-07-12 Thread Neha Malcom Francis
By providing entries in the binman node of the device tree, binman will
be able to find and package board config artifacts generated by
TIBoardConfig with sysfw.bin and generate the final image sysfw.itb.
It will also pick out the R5 SPL and sign it with the help of TI signing
entry and generate the final tiboot3.bin.

Entries for A72 build have been added to k3-j721e-binman.dtsi to
generate tispl.bin and u-boot.img.

Support has been added for both HS-SE(SR 1.1), HS-FS(SR 2.0) and GP images
In HS-SE, the encrypted system firmware binary must be signed along with
the signed certificate binary.

HS-SE:
* tiboot3-j721e_sr1_1-hs-evm.bin
* sysfw-j721e_sr1_1-hs-evm.itb
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-j721e_sr2-hs-fs-evm.bin
* sysfw-j721e_sr2-hs-fs-evm.itb
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin -->tiboot3-j721e-gp-evm.bin
* sysfw.itb --> sysfw-j721e-gp-evm.itb
* tispl.bin_unsigned
* u-boot.img_unsigned

It is to be noted that the bootflow followed by J721E requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs

sysfw.itb:
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-j721e-binman.dtsi | 701 ++
 .../k3-j721e-common-proc-board-u-boot.dtsi|   1 +
 .../arm/dts/k3-j721e-r5-common-proc-board.dts |   1 +
 arch/arm/dts/k3-j721e-sk-u-boot.dtsi  |   1 +
 board/ti/j721e/Kconfig|   2 +
 5 files changed, 706 insertions(+)
 create mode 100644 arch/arm/dts/k3-j721e-binman.dtsi

diff --git a/arch/arm/dts/k3-j721e-binman.dtsi 
b/arch/arm/dts/k3-j721e-binman.dtsi
new file mode 100644
index 00..0455deb6ca
--- /dev/null
+++ b/arch/arm/dts/k3-j721e-binman.dtsi
@@ -0,0 +1,701 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_J721E_R5_EVM
+
+&binman {
+   tiboot3-j721e_sr1_1-hs-evm.bin {
+   filename = "tiboot3-j721e_sr1_1-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>;
+   core = "public";
+   load = ;
+   keyfile = "custMpk.pem";
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   };
+   sysfw {
+   filename = "sysfw.bin";
+   ti-secure-rom {
+   content = <&ti_fs_cert>;
+   core = "secure";
+   load = <0x4>;
+   keyfile = "custMpk.pem";
+   countersign;
+   };
+   ti_fs_cert: ti-fs-cert.bin {
+   filename = 
"ti-sysfw/ti-fs-firmware-j721e_sr1_1-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   ti-fs-firmware-j721e_sr1_1-hs-enc.bin {
+   filename = 
"ti-sysfw/ti-fs-firmware-j721e_sr1_1-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   };
+   itb {
+   filename = "sysfw-j721e_sr1_1-hs-evm.itb";
+   fit {
+   description = "SYSFW and Config fragments";
+   #address-cells = <1>;
+   images {
+   sysfw.bin {
+   description = "sysfw";
+   type = "firmware";
+   arch = "arm";
+   compression = "none";
+   blob-ext {
+   filename = "sysfw.bin";
+   };
+   };
+   board-cfg.bin {
+   description = "board-cfg";
+   type = "firmware";
+   arch = "arm";
+   compression = "none";
+   ti-secure {
+   content = <

[PATCH v6 06/23] j7200: yaml: Add J7200 board config files

2023-07-12 Thread Neha Malcom Francis
Added YAML configs for J7200

Signed-off-by: Neha Malcom Francis 
---
 board/ti/j721e/board-cfg_j7200.yaml |   36 +
 board/ti/j721e/pm-cfg_j7200.yaml|   12 +
 board/ti/j721e/rm-cfg_j7200.yaml| 2065 +++
 board/ti/j721e/sec-cfg_j7200.yaml   |  380 +
 4 files changed, 2493 insertions(+)
 create mode 100644 board/ti/j721e/board-cfg_j7200.yaml
 create mode 100644 board/ti/j721e/pm-cfg_j7200.yaml
 create mode 100644 board/ti/j721e/rm-cfg_j7200.yaml
 create mode 100644 board/ti/j721e/sec-cfg_j7200.yaml

diff --git a/board/ti/j721e/board-cfg_j7200.yaml 
b/board/ti/j721e/board-cfg_j7200.yaml
new file mode 100644
index 00..1453317ecb
--- /dev/null
+++ b/board/ti/j721e/board-cfg_j7200.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for J7200
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x10
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
diff --git a/board/ti/j721e/pm-cfg_j7200.yaml b/board/ti/j721e/pm-cfg_j7200.yaml
new file mode 100644
index 00..588a1d530d
--- /dev/null
+++ b/board/ti/j721e/pm-cfg_j7200.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for J7200
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/j721e/rm-cfg_j7200.yaml b/board/ti/j721e/rm-cfg_j7200.yaml
new file mode 100644
index 00..66b589f370
--- /dev/null
+++ b/board/ti/j721e/rm-cfg_j7200.yaml
@@ -0,0 +1,2065 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for J7200
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 3
+allowed_atype : 0b101010
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 5
+allowed_atype : 0b101010
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 12
+allowed_atype : 0b101010
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 13
+allowed_atype : 0b101010
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #5
+host_id: 35
+allowed_atype : 0b101010
+allowed_qos : 0x
+allowed_orderid

[PATCH v6 07/23] j7200: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img

2023-07-12 Thread Neha Malcom Francis
Support has been added for both HS-SE(SR 2.0), HS-FS(SR 2.0) and GP
images.

HS-SE:
* tiboot3-j7200_sr2-hs-evm.bin
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-j7200_sr2-hs-fs-evm.bin
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-j7200-gp-evm.bin
* tispl.bin_unsigned
* u-boot.img_unsigned

It is to be noted that the bootflow followed by J7200 requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-j7200-binman.dtsi | 502 ++
 .../k3-j7200-common-proc-board-u-boot.dtsi|   2 +
 board/ti/j721e/Kconfig|   2 +
 3 files changed, 506 insertions(+)
 create mode 100644 arch/arm/dts/k3-j7200-binman.dtsi

diff --git a/arch/arm/dts/k3-j7200-binman.dtsi 
b/arch/arm/dts/k3-j7200-binman.dtsi
new file mode 100644
index 00..61bf576970
--- /dev/null
+++ b/arch/arm/dts/k3-j7200-binman.dtsi
@@ -0,0 +1,502 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_J7200_R5_EVM
+
+&bcfg_yaml {
+   config = "board-cfg_j7200.yaml";
+};
+
+&rcfg_yaml {
+   config = "rm-cfg_j7200.yaml";
+};
+
+&pcfg_yaml {
+   config = "pm-cfg_j7200.yaml";
+};
+
+&scfg_yaml {
+   config = "sec-cfg_j7200.yaml";
+};
+
+&bcfg_yaml_tifs {
+   config = "board-cfg_j7200.yaml";
+};
+
+&rcfg_yaml_tifs {
+   config = "rm-cfg_j7200.yaml";
+};
+
+&pcfg_yaml_tifs {
+   config = "pm-cfg_j7200.yaml";
+};
+
+&scfg_yaml_tifs {
+   config = "sec-cfg_j7200.yaml";
+};
+
+&rcfg_yaml_dm {
+   config = "rm-cfg_j7200.yaml";
+};
+
+&pcfg_yaml_dm {
+   config = "pm-cfg_j7200.yaml";
+};
+
+&binman {
+   tiboot3-j7200_sr2-hs-evm.bin {
+   filename = "tiboot3-j7200_sr2-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>, <&ti_fs_enc>, 
<&combined_tifs_cfg>,
+   <&combined_dm_cfg>, <&sysfw_inner_cert>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl>;
+   content-sysfw = <&ti_fs_enc>;
+   content-sysfw-data = <&combined_tifs_cfg>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert>;
+   content-dm-data = <&combined_dm_cfg>;
+   load = <0x41c0>;
+   load-sysfw = <0x4>;
+   load-sysfw-data = <0x7f000>;
+   load-dm-data = <0x41c8>;
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   ti_fs_enc: ti-fs-enc.bin {
+   filename = 
"ti-sysfw/ti-fs-firmware-j7200_sr2-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_tifs_cfg: combined-tifs-cfg.bin {
+   filename = "combined-tifs-cfg.bin";
+   type = "blob-ext";
+   };
+   sysfw_inner_cert: sysfw-inner-cert {
+   filename = 
"ti-sysfw/ti-fs-firmware-j7200_sr2-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_dm_cfg: combined-dm-cfg.bin {
+   filename = "combined-dm-cfg.bin";
+   type = "blob-ext";
+   };
+   };
+};
+
+&binman {
+   tiboot3-j7200_sr2-hs-fs-evm.bin {
+   filename = "tiboot3-j7200_sr2-hs-fs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl_fs>, <&ti_fs_enc_fs>, 
<&combined_tifs_cfg_fs>,
+   <&combined_dm_cfg_fs>, <&sysfw_inner_cert_fs>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+

[PATCH v6 08/23] am65x: yaml: Add AM65x board config files

2023-07-12 Thread Neha Malcom Francis
Added YAML configs for AM65x

Signed-off-by: Neha Malcom Francis 
---
 board/ti/am65x/board-cfg.yaml |   36 +
 board/ti/am65x/pm-cfg.yaml|   12 +
 board/ti/am65x/rm-cfg.yaml| 2068 +
 board/ti/am65x/sec-cfg.yaml   |  379 ++
 4 files changed, 2495 insertions(+)
 create mode 100644 board/ti/am65x/board-cfg.yaml
 create mode 100644 board/ti/am65x/pm-cfg.yaml
 create mode 100644 board/ti/am65x/rm-cfg.yaml
 create mode 100644 board/ti/am65x/sec-cfg.yaml

diff --git a/board/ti/am65x/board-cfg.yaml b/board/ti/am65x/board-cfg.yaml
new file mode 100644
index 00..133720ec3e
--- /dev/null
+++ b/board/ti/am65x/board-cfg.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM65x
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x10
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
diff --git a/board/ti/am65x/pm-cfg.yaml b/board/ti/am65x/pm-cfg.yaml
new file mode 100644
index 00..4b1ce475cd
--- /dev/null
+++ b/board/ti/am65x/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM65x
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/am65x/rm-cfg.yaml b/board/ti/am65x/rm-cfg.yaml
new file mode 100644
index 00..61acd0aa60
--- /dev/null
+++ b/board/ti/am65x/rm-cfg.yaml
@@ -0,0 +1,2068 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for AM65x
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 3
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 5
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 12
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 13
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #5
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #6
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #7
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #8
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #9
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0

[PATCH v6 09/23] am65: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin, u-boot.img

2023-07-12 Thread Neha Malcom Francis
Support has been added for both HS-SE(SR 2.0) and GP(SR 2.0) images.

HS-SE:
* tiboot3-am65x_sr2-hs-evm.bin
* sysfw-am65x_sr2-hs-evm.itb
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-am65x_sr2-gp-evm.bin
* sysfw.itb --> sysfw-am65x_sr2-gp-evm.itb
* tispl.bin_unsigned
* u-boot.img_unsigned

Note that the bootflow followed by AM65x requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
sysfw.itb:
* sysfw
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* ATF
* OPTEE
* A53 SPL
* A53 SPL dtbs

u-boot.img:
* A53 U-Boot
* A53 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi  |   1 +
 .../dts/k3-am654-r5-base-board-u-boot.dtsi|   1 +
 arch/arm/dts/k3-am65x-binman.dtsi | 518 ++
 board/ti/am65x/Kconfig|   2 +
 4 files changed, 522 insertions(+)
 create mode 100644 arch/arm/dts/k3-am65x-binman.dtsi

diff --git a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
index 0c1305df7e..e4cbc47c2a 100644
--- a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
@@ -4,6 +4,7 @@
  */
 
 #include "k3-am654-r5-base-board-u-boot.dtsi"
+#include "k3-am65x-binman.dtsi"
 
 &pru0_0 {
remoteproc-name = "pru0_0";
diff --git a/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi
index 4516ab1437..949320c91d 100644
--- a/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi
@@ -5,6 +5,7 @@
 
 #include 
 #include 
+#include "k3-am65x-binman.dtsi"
 
 / {
chosen {
diff --git a/arch/arm/dts/k3-am65x-binman.dtsi 
b/arch/arm/dts/k3-am65x-binman.dtsi
new file mode 100644
index 00..6535b9fec2
--- /dev/null
+++ b/arch/arm/dts/k3-am65x-binman.dtsi
@@ -0,0 +1,518 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_AM654_R5_EVM
+
+&binman {
+   tiboot3-am65x_sr2-hs-evm.bin {
+   filename = "tiboot3-am65x_sr2-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>;
+   core = "public";
+   load = ;
+   keyfile = "custMpk.pem";
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   };
+   sysfw {
+   filename = "sysfw.bin";
+   ti-secure-rom {
+   content = <&ti_sci_cert>;
+   core = "secure";
+   load = <0x4>;
+   keyfile = "custMpk.pem";
+   countersign;
+   };
+   ti_sci_cert: ti-sci-cert.bin {
+   filename = 
"ti-sysfw/ti-sci-firmware-am65x_sr2-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   ti-sci-firmware-am65x-hs-enc.bin {
+   filename = 
"ti-sysfw/ti-sci-firmware-am65x_sr2-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   };
+   itb {
+   filename = "sysfw-am65x_sr2-hs-evm.itb";
+   fit {
+   description = "SYSFW and Config fragments";
+   #address-cells = <1>;
+   images {
+   sysfw.bin {
+   description = "sysfw";
+   type = "firmware";
+   arch = "arm";
+   compression = "none";
+   blob-ext {
+   filename = "sysfw.bin";
+   };
+   };
+   board-cfg.bin {
+   description = "board-cfg";
+   type = "firmware";
+   arch = "arm";
+   compression = "none";
+   ti-secure {
+ 

[PATCH v6 10/23] am64x: yaml: Add board configs for AM64x

2023-07-12 Thread Neha Malcom Francis
Added YAML configs for AM64xx

Signed-off-by: Neha Malcom Francis 
---
 board/ti/am64x/board-cfg.yaml |   36 +
 board/ti/am64x/pm-cfg.yaml|   12 +
 board/ti/am64x/rm-cfg.yaml| 1400 +
 board/ti/am64x/sec-cfg.yaml   |  380 +
 4 files changed, 1828 insertions(+)
 create mode 100644 board/ti/am64x/board-cfg.yaml
 create mode 100644 board/ti/am64x/pm-cfg.yaml
 create mode 100644 board/ti/am64x/rm-cfg.yaml
 create mode 100644 board/ti/am64x/sec-cfg.yaml

diff --git a/board/ti/am64x/board-cfg.yaml b/board/ti/am64x/board-cfg.yaml
new file mode 100644
index 00..36ac5361c7
--- /dev/null
+++ b/board/ti/am64x/board-cfg.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM64x
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x0
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
diff --git a/board/ti/am64x/pm-cfg.yaml b/board/ti/am64x/pm-cfg.yaml
new file mode 100644
index 00..c97495f482
--- /dev/null
+++ b/board/ti/am64x/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM64x
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/am64x/rm-cfg.yaml b/board/ti/am64x/rm-cfg.yaml
new file mode 100644
index 00..1e6b07aef6
--- /dev/null
+++ b/board/ti/am64x/rm-cfg.yaml
@@ -0,0 +1,1400 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for AM64x
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 12
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 30
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 36
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 38
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #5
+host_id: 41
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x

[PATCH v6 11/23] am64x: dts: binman: Package tiboot3.bin, tispl.bin u-boot.img

2023-07-12 Thread Neha Malcom Francis
Support added for HS and GP boot binaries for AM64x.

HS-SE:
* tiboot3-am64x_sr2-hs-evm.bin
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-am64x_sr2-hs-fs-evm.bin
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-am64x-gp-evm.bin
* tispl.bin_unsigned
* u-boot.img_unsigned

Note that the bootflow followed by AM64x requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* sysfw
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* ATF
* OPTEE
* A53 SPL
* A53 SPL dtbs

u-boot.img:
* A53 U-Boot
* A53 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-am642-evm-u-boot.dtsi |   2 +
 arch/arm/dts/k3-am642-r5-evm.dts  |   1 +
 arch/arm/dts/k3-am642-sk-u-boot.dtsi  |   2 +
 arch/arm/dts/k3-am64x-binman.dtsi | 515 ++
 board/ti/am64x/Kconfig|   2 +
 5 files changed, 522 insertions(+)
 create mode 100644 arch/arm/dts/k3-am64x-binman.dtsi

diff --git a/arch/arm/dts/k3-am642-evm-u-boot.dtsi 
b/arch/arm/dts/k3-am642-evm-u-boot.dtsi
index 64857b0909..73577e8cfd 100644
--- a/arch/arm/dts/k3-am642-evm-u-boot.dtsi
+++ b/arch/arm/dts/k3-am642-evm-u-boot.dtsi
@@ -3,6 +3,8 @@
  * Copyright (C) 2020-2021 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include "k3-am64x-binman.dtsi"
+
 / {
chosen {
stdout-path = "serial2:115200n8";
diff --git a/arch/arm/dts/k3-am642-r5-evm.dts b/arch/arm/dts/k3-am642-r5-evm.dts
index e870492a69..b49064181a 100644
--- a/arch/arm/dts/k3-am642-r5-evm.dts
+++ b/arch/arm/dts/k3-am642-r5-evm.dts
@@ -8,6 +8,7 @@
 #include "k3-am642.dtsi"
 #include "k3-am64-evm-ddr4-1600MTs.dtsi"
 #include "k3-am64-ddr.dtsi"
+#include "k3-am64x-binman.dtsi"
 
 / {
chosen {
diff --git a/arch/arm/dts/k3-am642-sk-u-boot.dtsi 
b/arch/arm/dts/k3-am642-sk-u-boot.dtsi
index 69dbe943bd..3d6be025bd 100644
--- a/arch/arm/dts/k3-am642-sk-u-boot.dtsi
+++ b/arch/arm/dts/k3-am642-sk-u-boot.dtsi
@@ -3,6 +3,8 @@
  * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include "k3-am64x-binman.dtsi"
+
 / {
chosen {
stdout-path = "serial2:115200n8";
diff --git a/arch/arm/dts/k3-am64x-binman.dtsi 
b/arch/arm/dts/k3-am64x-binman.dtsi
new file mode 100644
index 00..e6ca2457b4
--- /dev/null
+++ b/arch/arm/dts/k3-am64x-binman.dtsi
@@ -0,0 +1,515 @@
+// SPDX-License-Identifier: GPL-2.0+
+// Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_AM642_R5_EVM
+
+&binman {
+   tiboot3-am64x_sr2-hs-evm.bin {
+   filename = "tiboot3-am64x_sr2-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>, <&ti_sci_enc>,
+   <&combined_sysfw_cfg>, <&sysfw_inner_cert>;
+   combined;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl>;
+   content-sysfw = <&ti_sci_enc>;
+   content-sysfw-data = <&combined_sysfw_cfg>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert>;
+   load = <0x7000>;
+   load-sysfw = <0x44000>;
+   load-sysfw-data = <0x7b000>;
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   ti_sci_enc: ti-fs-enc.bin {
+   filename = 
"ti-sysfw/ti-sci-firmware-am64x_sr2-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_sysfw_cfg: combined-sysfw-cfg.bin {
+   filename = "combined-sysfw-cfg.bin";
+   type = "blob-ext";
+   };
+   sysfw_inner_cert: sysfw-inner-cert {
+   filename = 
"ti-sysfw/ti-sci-firmware-am64x_sr2-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+
+   };
+};
+
+&binman {
+   tiboot3-am64x_sr2-hs-fs-evm.bin {
+   filename = "tiboot3-am64x_sr2-hs-fs-evm.bin";
+   symlink = "tiboot3.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl_fs>, <&ti_sci_enc_fs>,
+   

[PATCH v6 12/23] j721s2: yaml: Add board configs for J721S2

2023-07-12 Thread Neha Malcom Francis
Added YAML configs for J721S2

Signed-off-by: Neha Malcom Francis 
---
 board/ti/j721s2/board-cfg.yaml |   36 +
 board/ti/j721s2/pm-cfg.yaml|   12 +
 board/ti/j721s2/rm-cfg.yaml| 2901 
 board/ti/j721s2/sec-cfg.yaml   |  379 +
 4 files changed, 3328 insertions(+)
 create mode 100644 board/ti/j721s2/board-cfg.yaml
 create mode 100644 board/ti/j721s2/pm-cfg.yaml
 create mode 100644 board/ti/j721s2/rm-cfg.yaml
 create mode 100644 board/ti/j721s2/sec-cfg.yaml

diff --git a/board/ti/j721s2/board-cfg.yaml b/board/ti/j721s2/board-cfg.yaml
new file mode 100644
index 00..18da445629
--- /dev/null
+++ b/board/ti/j721s2/board-cfg.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for J721S2
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x0
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
diff --git a/board/ti/j721s2/pm-cfg.yaml b/board/ti/j721s2/pm-cfg.yaml
new file mode 100644
index 00..45994e23cc
--- /dev/null
+++ b/board/ti/j721s2/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for J721S2
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/j721s2/rm-cfg.yaml b/board/ti/j721s2/rm-cfg.yaml
new file mode 100644
index 00..6058f3b35c
--- /dev/null
+++ b/board/ti/j721s2/rm-cfg.yaml
@@ -0,0 +1,2901 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for J721S2
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 3
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 5
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 12
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 13
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #5
+host_id: 21
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #6
+host_id: 23
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #7
+host_id: 35
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #8
+host_id: 37
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #9
+host_id: 40
+allowed_atype : 0x2A

[PATCH v6 13/23] j721s2: dts: binman: Package tiboot3.bin, tispl.bin and u-boot.img

2023-07-12 Thread Neha Malcom Francis
Support has been added for both HS-SE, HS-FS  and GP images.

HS-SE:
* tiboot3-j721s2-hs-evm.bin
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-j721s2-hs-fs-evm.bin
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-j721s2-gp-evm.bin
* tispl.bin_unsigned
* u-boot.img_unsigned

It is to be noted that the bootflow followed by J721S2 requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 .../arm/dts/k3-am68-sk-base-board-u-boot.dtsi |   2 +
 arch/arm/dts/k3-j721s2-binman.dtsi| 546 ++
 .../k3-j721s2-common-proc-board-u-boot.dtsi   |   2 +
 .../dts/k3-j721s2-r5-common-proc-board.dts|   1 +
 board/ti/j721s2/Kconfig   |   2 +
 5 files changed, 553 insertions(+)
 create mode 100644 arch/arm/dts/k3-j721s2-binman.dtsi

diff --git a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
index ee31b1ebe7..79faa1b573 100644
--- a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
@@ -3,6 +3,8 @@
  * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include "k3-j721s2-binman.dtsi"
+
 / {
chosen {
stdout-path = "serial2:115200n8";
diff --git a/arch/arm/dts/k3-j721s2-binman.dtsi 
b/arch/arm/dts/k3-j721s2-binman.dtsi
new file mode 100644
index 00..7fd7ba8e5d
--- /dev/null
+++ b/arch/arm/dts/k3-j721s2-binman.dtsi
@@ -0,0 +1,546 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_J721S2_R5_EVM
+
+&binman {
+   tiboot3-j721s2-hs-evm.bin {
+   filename = "tiboot3-j721s2-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>, <&ti_fs_enc>, 
<&combined_tifs_cfg>,
+   <&combined_dm_cfg>, <&sysfw_inner_cert>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl>;
+   content-sysfw = <&ti_fs_enc>;
+   content-sysfw-data = <&combined_tifs_cfg>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert>;
+   content-dm-data = <&combined_dm_cfg>;
+   load = <0x41c0>;
+   load-sysfw = <0x4>;
+   load-sysfw-data = <0x67000>;
+   load-dm-data = <0x41c8>;
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   ti_fs_enc: ti-fs-enc.bin {
+   filename = "ti-sysfw/ti-fs-firmware-j721s2-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_tifs_cfg: combined-tifs-cfg.bin {
+   filename = "combined-tifs-cfg.bin";
+   type = "blob-ext";
+   };
+   sysfw_inner_cert: sysfw-inner-cert {
+   filename = "ti-sysfw/ti-fs-firmware-j721s2-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_dm_cfg: combined-dm-cfg.bin {
+   filename = "combined-dm-cfg.bin";
+   type = "blob-ext";
+   };
+   };
+};
+
+&binman {
+   tiboot3-j721s2-hs-fs-evm.bin {
+   filename = "tiboot3-j721s2-hs-fs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl_fs>, <&ti_fs_enc_fs>, 
<&combined_tifs_cfg_fs>,
+   <&combined_dm_cfg_fs>, <&sysfw_inner_cert_fs>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl_fs>;
+   content-sysfw = <&ti_f

[PATCH v6 14/23] am62: yaml: Add board configs for AM62

2023-07-12 Thread Neha Malcom Francis
Added YAML configs for AM62

Signed-off-by: Neha Malcom Francis 
---
 board/ti/am62x/board-cfg.yaml |   36 ++
 board/ti/am62x/pm-cfg.yaml|   12 +
 board/ti/am62x/rm-cfg.yaml| 1088 +
 board/ti/am62x/sec-cfg.yaml   |  379 
 4 files changed, 1515 insertions(+)
 create mode 100644 board/ti/am62x/board-cfg.yaml
 create mode 100644 board/ti/am62x/pm-cfg.yaml
 create mode 100644 board/ti/am62x/rm-cfg.yaml
 create mode 100644 board/ti/am62x/sec-cfg.yaml

diff --git a/board/ti/am62x/board-cfg.yaml b/board/ti/am62x/board-cfg.yaml
new file mode 100644
index 00..a26ef55bd4
--- /dev/null
+++ b/board/ti/am62x/board-cfg.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM62
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x0
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
diff --git a/board/ti/am62x/pm-cfg.yaml b/board/ti/am62x/pm-cfg.yaml
new file mode 100644
index 00..aa94097e97
--- /dev/null
+++ b/board/ti/am62x/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM62
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/am62x/rm-cfg.yaml b/board/ti/am62x/rm-cfg.yaml
new file mode 100644
index 00..1e8678c30b
--- /dev/null
+++ b/board/ti/am62x/rm-cfg.yaml
@@ -0,0 +1,1088 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for AM62
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 12
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 30
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 36
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #5
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #6
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #7
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #8
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #9
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0

[PATCH v6 15/23] am625: dts: binman: Package tiboot3.bin, tispl.bin and u-boot.img

2023-07-12 Thread Neha Malcom Francis
Support added for HS-SE, HS-FS and GP boot binaries for AM62.

HS-SE:
* tiboot3-am62x-hs-evm.bin
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-am62x-hs-fs-evm.bin
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-am62x-gp-evm.bin
* tispl.bin_unsigned
* u-boot.img_unsigned

It is to be noted that the bootflow followed by AM62 requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-am625-r5-sk.dts  |   1 +
 arch/arm/dts/k3-am625-sk-binman.dtsi | 463 +++
 arch/arm/dts/k3-am625-sk-u-boot.dtsi |   2 +
 board/ti/am62x/Kconfig   |   2 +
 4 files changed, 468 insertions(+)
 create mode 100644 arch/arm/dts/k3-am625-sk-binman.dtsi

diff --git a/arch/arm/dts/k3-am625-r5-sk.dts b/arch/arm/dts/k3-am625-r5-sk.dts
index 78df7cec3f..3ec5bad735 100644
--- a/arch/arm/dts/k3-am625-r5-sk.dts
+++ b/arch/arm/dts/k3-am625-r5-sk.dts
@@ -9,6 +9,7 @@
 #include "k3-am62-ddr.dtsi"
 
 #include "k3-am625-sk-u-boot.dtsi"
+#include "k3-am625-sk-binman.dtsi"
 
 / {
aliases {
diff --git a/arch/arm/dts/k3-am625-sk-binman.dtsi 
b/arch/arm/dts/k3-am625-sk-binman.dtsi
new file mode 100644
index 00..c5bd9e48d0
--- /dev/null
+++ b/arch/arm/dts/k3-am625-sk-binman.dtsi
@@ -0,0 +1,463 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_AM625_R5_EVM
+
+&binman {
+   tiboot3-am62x-hs-evm.bin {
+   filename = "tiboot3-am62x-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>, <&ti_fs_enc>, 
<&combined_tifs_cfg>,
+   <&combined_dm_cfg>, <&sysfw_inner_cert>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl>;
+   content-sysfw = <&ti_fs_enc>;
+   content-sysfw-data = <&combined_tifs_cfg>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert>;
+   content-dm-data = <&combined_dm_cfg>;
+   load = <0x43c0>;
+   load-sysfw = <0x4>;
+   load-sysfw-data = <0x67000>;
+   load-dm-data = <0x43c3a800>;
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   ti_fs_enc: ti-fs-enc.bin {
+   filename = "ti-sysfw/ti-fs-firmware-am62x-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_tifs_cfg: combined-tifs-cfg.bin {
+   filename = "combined-tifs-cfg.bin";
+   type = "blob-ext";
+   };
+   sysfw_inner_cert: sysfw-inner-cert {
+   filename = "ti-sysfw/ti-fs-firmware-am62x-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_dm_cfg: combined-dm-cfg.bin {
+   filename = "combined-dm-cfg.bin";
+   type = "blob-ext";
+   };
+   };
+};
+
+&binman {
+   tiboot3-am62x-hs-fs-evm.bin {
+   filename = "tiboot3-am62x-hs-fs-evm.bin";
+   symlink = "tiboot3.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl_fs>, <&ti_fs_enc_fs>, 
<&combined_tifs_cfg_fs>,
+   <&combined_dm_cfg_fs>, <&sysfw_inner_cert_fs>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl_fs>;
+   content-sysfw = <&ti_fs_enc_fs>;
+   content-sysfw-data = <&combined_tifs_cfg_fs>;
+   content-sysfw-in

[PATCH v6 16/23] am62a: yaml: Add board configs for AM62ax

2023-07-12 Thread Neha Malcom Francis
Added YAML configs for AM62ax

Signed-off-by: Neha Malcom Francis 
---
 board/ti/am62ax/board-cfg.yaml   |   36 +
 board/ti/am62ax/pm-cfg.yaml  |   12 +
 board/ti/am62ax/rm-cfg.yaml  | 1151 ++
 board/ti/am62ax/sec-cfg.yaml |  379 ++
 board/ti/am62ax/tifs-rm-cfg.yaml | 1011 ++
 5 files changed, 2589 insertions(+)
 create mode 100644 board/ti/am62ax/board-cfg.yaml
 create mode 100644 board/ti/am62ax/pm-cfg.yaml
 create mode 100644 board/ti/am62ax/rm-cfg.yaml
 create mode 100644 board/ti/am62ax/sec-cfg.yaml
 create mode 100644 board/ti/am62ax/tifs-rm-cfg.yaml

diff --git a/board/ti/am62ax/board-cfg.yaml b/board/ti/am62ax/board-cfg.yaml
new file mode 100644
index 00..6e45b494e0
--- /dev/null
+++ b/board/ti/am62ax/board-cfg.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM62ax
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x10
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
diff --git a/board/ti/am62ax/pm-cfg.yaml b/board/ti/am62ax/pm-cfg.yaml
new file mode 100644
index 00..a491f11260
--- /dev/null
+++ b/board/ti/am62ax/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM62ax
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/am62ax/rm-cfg.yaml b/board/ti/am62ax/rm-cfg.yaml
new file mode 100644
index 00..0e11bd3e3c
--- /dev/null
+++ b/board/ti/am62ax/rm-cfg.yaml
@@ -0,0 +1,1151 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for AM62ax
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 12
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 30
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 36
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #5
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #6
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #7
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #8
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #9
+host_id: 0
+allowed_atype : 0

[PATCH v6 17/23] am62a: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img

2023-07-12 Thread Neha Malcom Francis
Support added for HS-SE, HS-FS and GP boot binaries for AM62ax.

HS-SE:
* tiboot3-am62ax-hs-evm.bin
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-am62ax-hs-fs-evm.bin
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-am62ax-gp-evm.bin
* tispl.bin_unsigned
* u-boot.img_unsigned

It is to be noted that the bootflow followed by AM62ax requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-am62a-sk-binman.dtsi | 466 +++
 arch/arm/dts/k3-am62a7-r5-sk.dts |   1 +
 arch/arm/dts/k3-am62a7-sk.dts|   1 +
 board/ti/am62ax/Kconfig  |   2 +
 4 files changed, 470 insertions(+)
 create mode 100644 arch/arm/dts/k3-am62a-sk-binman.dtsi

diff --git a/arch/arm/dts/k3-am62a-sk-binman.dtsi 
b/arch/arm/dts/k3-am62a-sk-binman.dtsi
new file mode 100644
index 00..abbac8f084
--- /dev/null
+++ b/arch/arm/dts/k3-am62a-sk-binman.dtsi
@@ -0,0 +1,466 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_AM62A7_R5_EVM
+
+&rcfg_yaml_tifs {
+   config = "tifs-rm-cfg.yaml";
+};
+
+&binman {
+   tiboot3-am62ax-hs-evm.bin {
+   filename = "tiboot3-am62ax-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>, <&ti_fs_enc>, 
<&combined_tifs_cfg>,
+   <&combined_dm_cfg>, <&sysfw_inner_cert>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl>;
+   content-sysfw = <&ti_fs_enc>;
+   content-sysfw-data = <&combined_tifs_cfg>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert>;
+   content-dm-data = <&combined_dm_cfg>;
+   load = <0x43c0>;
+   load-sysfw = <0x4>;
+   load-sysfw-data = <0x67000>;
+   load-dm-data = <0x43c3a800>;
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   ti_fs_enc: ti-fs-enc.bin {
+   filename = "ti-sysfw/ti-fs-firmware-am62ax-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_tifs_cfg: combined-tifs-cfg.bin {
+   filename = "combined-tifs-cfg.bin";
+   type = "blob-ext";
+   };
+   sysfw_inner_cert: sysfw-inner-cert {
+   filename = "ti-sysfw/ti-fs-firmware-am62ax-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_dm_cfg: combined-dm-cfg.bin {
+   filename = "combined-dm-cfg.bin";
+   type = "blob-ext";
+   };
+   };
+};
+
+&binman {
+   tiboot3-am62ax-hs-fs-evm.bin {
+   filename = "tiboot3-am62ax-hs-fs-evm.bin";
+   symlink = "tiboot3.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl_fs>, <&ti_fs_enc_fs>, 
<&combined_tifs_cfg_fs>,
+   <&combined_dm_cfg_fs>, <&sysfw_inner_cert_fs>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl_fs>;
+   content-sysfw = <&ti_fs_enc_fs>;
+   content-sysfw-data = <&combined_tifs_cfg_fs>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert_fs>;
+   content-dm-data = <&combined_dm_cfg_fs>;
+   load = <0x43c0>;
+   load-sysfw = <0x4>;
+   load-sysfw-data = <0x67000>;
+  

[PATCH v6 18/23] arm: k3-am65x-iot2050: Use binman for tispl.bin for iot2050

2023-07-12 Thread Neha Malcom Francis
Move to using binman to generate tispl.bin which is used to generate the
final flash.bin bootloader for iot2050 boards.

Signed-off-by: Neha Malcom Francis 
Cc: Jan Kiszka 
Reviewed-by: Simon Glass 
---
 arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 76 +++-
 1 file changed, 74 insertions(+), 2 deletions(-)

diff --git a/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi 
b/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi
index 03ccc54329..9d83898d33 100644
--- a/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi
+++ b/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi
@@ -26,9 +26,81 @@
missing-msg = "iot2050-seboot";
};
 
-   blob@0x18 {
+   fit@0x18 {
offset = <0x18>;
-   filename = "tispl.bin";
+   pad-byte = <0xff>;
+   description = "Configuration to load ATF and SPL";
+
+   images {
+   atf {
+   description = "ARM Trusted Firmware";
+   type = "firmware";
+   arch = "arm64";
+   compression = "none";
+   os = "arm-trusted-firmware";
+   load = ;
+   entry = ;
+   atf: atf-bl31 {
+   };
+   };
+
+   tee {
+   description = "OPTEE";
+   type = "tee";
+   arch = "arm64";
+   compression = "none";
+   os = "tee";
+   load = <0x9e80>;
+   entry = <0x9e80>;
+   tee: tee-os {
+   };
+   };
+
+   dm {
+   description = "DM binary";
+   type = "firmware";
+   arch = "arm32";
+   compression = "none";
+   os = "DM";
+   load = <0x8900>;
+   entry = <0x8900>;
+   blob-ext {
+   filename = "/dev/null";
+   };
+   };
+
+   spl {
+   description = "SPL (64-bit)";
+   type = "standalone";
+   os = "U-Boot";
+   arch = "arm64";
+   compression = "none";
+   load = ;
+   entry = ;
+   u_boot_spl_nodtb: blob-ext {
+   filename = 
"spl/u-boot-spl-nodtb.bin";
+   };
+   };
+
+   fdt-0 {
+   description = "k3-am65-iot2050-spl.dtb";
+   type = "flat_dt";
+   arch = "arm";
+   compression = "none";
+   spl_am65x_evm_dtb: blob-ext {
+   filename = 
"spl/dts/k3-am65-iot2050-spl.dtb";
+   };
+   };
+   };
+
+   configurations {
+   default = "spl";
+   spl {
+   fdt = "fdt-0";
+   firmware = "atf";
+   loadables = "tee", "dm", "spl";
+   };
+   };
};
 
fit@0x38 {
-- 
2.34.1



[PATCH v6 19/23] k3: tools: config.mk: Update makefile and remove scripts

2023-07-12 Thread Neha Malcom Francis
Since binman is used to package bootloader images for all K3 devices, we
do not have to rely on the earlier methods to package them.

Scripts that were used to generate x509 certificate for tiboot3.bin and
generate tispl.bin, u-boot.img have been removed.

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
---
 arch/arm/mach-k3/config.mk | 103 ---
 tools/k3_fit_atf.sh| 123 -
 tools/k3_gen_x509_cert.sh  | 262 -
 3 files changed, 488 deletions(-)
 delete mode 100644 arch/arm/mach-k3/config.mk
 delete mode 100755 tools/k3_fit_atf.sh
 delete mode 100755 tools/k3_gen_x509_cert.sh

diff --git a/arch/arm/mach-k3/config.mk b/arch/arm/mach-k3/config.mk
deleted file mode 100644
index cbf9c10210..00
--- a/arch/arm/mach-k3/config.mk
+++ /dev/null
@@ -1,103 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Copyright (C) 2017-2018 Texas Instruments Incorporated - http://www.ti.com/
-#  Lokesh Vutla 
-
-ifdef CONFIG_SPL_BUILD
-
-# Openssl is required to generate x509 certificate.
-# Error out if openssl is not available.
-ifeq ($(shell which openssl),)
-$(error "No openssl in $(PATH), consider installing openssl")
-endif
-
-IMAGE_SIZE= $(shell cat $(obj)/u-boot-spl.bin | wc -c)
-MAX_SIZE= $(shell printf "%d" $(CONFIG_SYS_K3_MAX_DOWNLODABLE_IMAGE_SIZE))
-
-ifeq ($(CONFIG_SYS_K3_KEY), "")
-KEY=""
-# On HS use real key or warn if not available
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
-ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/keys/custMpk.pem),)
-KEY=$(TI_SECURE_DEV_PKG)/keys/custMpk.pem
-else
-$(warning "WARNING: signing key not found. Random key will NOT work on HS 
hardware!")
-endif
-endif
-else
-KEY=$(patsubst "%",$(srctree)/%,$(CONFIG_SYS_K3_KEY))
-endif
-
-# X509 SWRV default
-SWRV = $(CONFIG_K3_X509_SWRV)
-# On HS use SECDEV provided software revision or warn if not available
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
-ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/keys/swrv.txt),)
-SWRV= $(shell cat $(TI_SECURE_DEV_PKG)/keys/swrv.txt)
-else
-$(warning "WARNING: Software revision file not found. Default may not work on 
HS hardware.")
-endif
-endif
-
-# tiboot3.bin is mandated by ROM and ROM only supports R5 boot.
-# So restrict tiboot3.bin creation for CPU_V7R.
-ifdef CONFIG_CPU_V7R
-image_check: $(obj)/u-boot-spl.bin FORCE
-   @if [ $(IMAGE_SIZE) -gt $(MAX_SIZE) ]; then \
-   echo "===" >&2; \
-   echo "ERROR: Final Image too big. " >&2;\
-   echo "$< size = $(IMAGE_SIZE), max size = $(MAX_SIZE)" >&2; \
-   echo "===" >&2; \
-   exit 1; \
-   fi
-
-tiboot3.bin: image_check FORCE
-   $(srctree)/tools/k3_gen_x509_cert.sh -c 16 -b $(obj)/u-boot-spl.bin \
-   -o $@ -l $(CONFIG_SPL_TEXT_BASE) -r $(SWRV) -k 
$(KEY)
-
-INPUTS-y   += tiboot3.bin
-endif
-
-ifdef CONFIG_ARM64
-
-ifeq ($(CONFIG_SOC_K3_J721E),)
-export DM := /dev/null
-endif
-
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
-SPL_ITS := u-boot-spl-k3_HS.its
-$(SPL_ITS): export IS_HS=1
-INPUTS-y   += tispl.bin_HS
-INPUTS-y   += tispl.bin
-tispl.bin: $(obj)/u-boot-spl-nodtb.bin_HS $(patsubst 
%,$(obj)/dts/%.dtb_HS,$(subst ",,$(CONFIG_SPL_OF_LIST)))
-else
-SPL_ITS := u-boot-spl-k3.its
-INPUTS-y   += tispl.bin
-endif
-
-ifeq ($(CONFIG_SPL_OF_LIST),)
-LIST_OF_DTB := $(CONFIG_DEFAULT_DEVICE_TREE)
-else
-LIST_OF_DTB := $(CONFIG_SPL_OF_LIST)
-endif
-
-quiet_cmd_k3_mkits = MKITS   $@
-cmd_k3_mkits = \
-   $(srctree)/tools/k3_fit_atf.sh \
-   $(CONFIG_K3_ATF_LOAD_ADDR) \
-   $(patsubst %,$(obj)/dts/%.dtb,$(subst ",,$(LIST_OF_DTB))) > $@
-
-$(SPL_ITS): FORCE
-   $(call cmd,k3_mkits)
-endif
-
-else
-
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
-INPUTS-y   += u-boot.img_HS
-else
-INPUTS-y   += u-boot.img
-endif
-endif
-
-include $(srctree)/arch/arm/mach-k3/config_secure.mk
diff --git a/tools/k3_fit_atf.sh b/tools/k3_fit_atf.sh
deleted file mode 100755
index 7bc07ad074..00
--- a/tools/k3_fit_atf.sh
+++ /dev/null
@@ -1,123 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0+
-#
-# script to generate FIT image source for K3 Family boards with
-# ATF, OPTEE, SPL and multiple device trees (given on the command line).
-# Inspired from board/sunxi/mksunxi_fit_atf.sh
-#
-# usage: $0   [ [&2
-   ATF=/dev/null
-fi
-
-[ -z "$TEE" ] && TEE="bl32.bin"
-
-if [ ! -f $TEE ]; then
-   echo "WARNING OPTEE file $TEE NOT found, resulting might be 
non-functional" >&2
-   TEE=/dev/null
-fi
-
-[ -z "$DM" ] && DM="dm.bin"
-
-if [ ! -e $DM ]; then
-   echo "W

[PATCH v6 20/23] doc: board: ti: Update documentation for binman flow

2023-07-12 Thread Neha Malcom Francis
Earlier documentation specified builds for generating bootloader images
using an external TI repository k3-image-gen and core-secdev-k3. Modify
this to using the binman flow so that user understands how to build the
final boot images.

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
---
 doc/board/ti/am62x_sk.rst  |  54 +--
 doc/board/ti/j7200_evm.rst |  55 +--
 doc/board/ti/j721e_evm.rst |  58 +---
 doc/board/ti/k3.rst| 107 +
 4 files changed, 113 insertions(+), 161 deletions(-)

diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst
index 27d7b527c6..bf23022b95 100644
--- a/doc/board/ti/am62x_sk.rst
+++ b/doc/board/ti/am62x_sk.rst
@@ -90,9 +90,9 @@ Below is the pictorial representation of boot flow:
  |||--|---|>| Reset rls | |
  |||  |   | +---+ |
  ||  TIFS  |  |   |  :|
- ||Services|  |   | +---+ |
- |||<-|---|>|*ATF/OPTEE*| |
- |||  |   | +---+ |
+ ||Services|  |   | ++|
+ |||<-|---|>|*TF-A/OPTEE*||
+ |||  |   | ++|
  |||  |   |  :|
  |||  |   | +---+ |
  |||<-|---|>| *A53 SPL* | |
@@ -115,59 +115,57 @@ Below is the pictorial representation of boot flow:
 
 Sources:
 
-1. SYSFW:
-   Tree: git://git.ti.com/k3-image-gen/k3-image-gen.git
-   Branch: master
-
-2. ATF:
-   Tree: https://github.com/ARM-software/arm-trusted-firmware.git
+1. Trusted Firmware-A:
+   Tree: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/
Branch: master
 
-3. OPTEE:
+2. OPTEE:
Tree: https://github.com/OP-TEE/optee_os.git
Branch: master
 
-4. U-Boot:
+3. U-Boot:
Tree: https://source.denx.de/u-boot/u-boot
Branch: master
 
-5. TI Linux Firmware:
+4. TI Linux Firmware:
Tree: git://git.ti.com/processor-firmware/ti-linux-firmware.git
Branch: ti-linux-firmware
 
 Build procedure:
 
-1. ATF:
+1. Trusted Firmware-A:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make CROSS_COMPILE=aarch64-none-linux-gnu- ARCH=aarch64 PLAT=k3 
TARGET_BOARD=lite SPD=opteed
+ $ make CROSS_COMPILE=aarch64-none-linux-gnu- ARCH=aarch64 PLAT=k3 \
+TARGET_BOARD=lite SPD=opteed
 
 2. OPTEE:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make PLATFORM=k3 CFG_ARM64_core=y CROSS_COMPILE=arm-none-linux-gnueabihf- 
CROSS_COMPILE64=aarch64-none-linux-gnu-
+ $ make PLATFORM=k3 CFG_ARM64_core=y CROSS_COMPILE=arm-none-linux-gnueabihf- \
+CROSS_COMPILE64=aarch64-none-linux-gnu-
 
 3. U-Boot:
 
 * 3.1 R5:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- 
am62x_evm_r5_defconfig O=/tmp/r5
- $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=/tmp/r5
- $ cd 
- $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- SOC=am62x 
SBL=/tmp/r5/spl/u-boot-spl.bin SYSFW_PATH=/ti-sysfw/ti-fs-firmware-am62x-gp.bin
-
-Use the tiboot3.bin generated from last command
+ $ make ARCH=arm am62x_evm_r5_defconfig
+ $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- \
+BINMAN_INDIRS=
 
 * 3.2 A53:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- am62x_evm_a53_defconfig 
O=/tmp/a53
- $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- ATF=/build/k3/lite/release/bl31.bin TEE=/out/arm-plat-k3/core/tee-pager_v2.bin DM=/ti-dm/am62xx/ipc_echo_testb_mcu1_0_release_strip.xer5f 
O=/tmp/a53
+ $ make ARCH=arm am62x_evm_a53_defconfig
+ $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- \
+BL31=/build/k3/lite/release/bl31.bin \
+TEE=/out/arm-plat-k3/core/tee-raw.bin \
+BINMAN_INDIRS=
 
 Target Images
 --
@@ -214,7 +212,7 @@ Image formats:
 |   FIT HEADER  |
 | +---+ |
 | |   | |
-| |  A53 ATF  | |
+| | A53 TF-A  | |
 | +---+ |
 | |   | |
 | | A53 OPTEE | |
diff --git a/doc/board/ti/j7200_evm.rst b/doc/board/ti/j7200_evm.rst
index 0d3a526516..8f6d13ab8c 100644
--- a/doc/board/ti/j7200_evm.rst
+++ b/doc/board/ti/j7200_evm.rst
@@ -83,9 +83,9 @@ Below is the pictorial repres

[PATCH v6 21/23] binman: Overwrite symlink if it already exists

2023-07-12 Thread Neha Malcom Francis
From: Andrew Davis 

Without this re-building will fail with an error when trying to create
the symlink for the second time with an already exists error.

Signed-off-by: Andrew Davis 
[n-fran...@ti.com: Added support for test output dir and testcase]
Signed-off-by: Neha Malcom Francis 
---
 tools/binman/ftest.py | 18 --
 tools/binman/image.py |  2 ++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index f4bff50aaf..6280eb92c4 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -353,7 +353,7 @@ class TestFunctional(unittest.TestCase):
 use_expanded=False, verbosity=None, allow_missing=False,
 allow_fake_blobs=False, extra_indirs=None, threads=None,
 test_section_timeout=False, update_fdt_in_elf=None,
-force_missing_bintools='', ignore_missing=False):
+force_missing_bintools='', ignore_missing=False, 
output_dir=None):
 """Run binman with a given test file
 
 Args:
@@ -384,6 +384,7 @@ class TestFunctional(unittest.TestCase):
 update_fdt_in_elf: Value to pass with --update-fdt-in-elf=xxx
 force_missing_tools (str): comma-separated list of bintools to
 regard as missing
+output_dir: Specific output directory to use for image using -O
 
 Returns:
 int return code, 0 on success
@@ -430,6 +431,8 @@ class TestFunctional(unittest.TestCase):
 if extra_indirs:
 for indir in extra_indirs:
 args += ['-I', indir]
+if output_dir:
+args += ['-O', output_dir]
 return self._DoBinman(*args)
 
 def _SetupDtb(self, fname, outfile='u-boot.dtb'):
@@ -6113,7 +6116,7 @@ fdt fdtmapExtract the devicetree 
blob from the fdtmap
   str(e.exception))
 
 def testSymlink(self):
-"""Test that image files can be named"""
+"""Test that image files can be symlinked"""
 retcode = self._DoTestFile('259_symlink.dts', debug=True, map=True)
 self.assertEqual(0, retcode)
 image = control.images['test_image']
@@ -6122,6 +6125,17 @@ fdt fdtmapExtract the devicetree 
blob from the fdtmap
 self.assertTrue(os.path.islink(sname))
 self.assertEqual(os.readlink(sname), fname)
 
+def testSymlinkOverwrite(self):
+"""Test that symlinked images can be overwritten"""
+testdir = TestFunctional._MakeInputDir('symlinktest')
+self._DoTestFile('259_symlink.dts', debug=True, map=True, 
output_dir=testdir)
+# build the same image again in the same directory so that existing 
symlink is present
+self._DoTestFile('259_symlink.dts', debug=True, map=True, 
output_dir=testdir)
+fname = tools.get_output_filename('test_image.bin')
+sname = tools.get_output_filename('symlink_to_test.bin')
+self.assertTrue(os.path.islink(sname))
+self.assertEqual(os.readlink(sname), fname)
+
 def testSymbolsElf(self):
 """Test binman can assign symbols embedded in an ELF file"""
 if not elf.ELF_TOOLS:
diff --git a/tools/binman/image.py b/tools/binman/image.py
index 8ebf71d61a..e77b5d0d97 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -182,6 +182,8 @@ class Image(section.Entry_section):
 # Create symlink to file if symlink given
 if self._symlink is not None:
 sname = tools.get_output_filename(self._symlink)
+if os.path.islink(sname):
+os.remove(sname)
 os.symlink(fname, sname)
 
 def WriteMap(self):
-- 
2.34.1



[PATCH v6 22/23] buildman: Create a requirements.txt file

2023-07-12 Thread Neha Malcom Francis
From: Tom Rini 

At this point, buildman requires a few different modules and so we need
a requirements.txt to track what modules are needed.

Cc: Simon Glass 
Cc: Neha Malcom Francis 
Signed-off-by: Tom Rini 
Reviewed-by: Simon Glass 
Signed-off-by: Neha Malcom Francis 
---
 tools/buildman/requirements.txt | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 tools/buildman/requirements.txt

diff --git a/tools/buildman/requirements.txt b/tools/buildman/requirements.txt
new file mode 100644
index 00..a1efcb9d4b
--- /dev/null
+++ b/tools/buildman/requirements.txt
@@ -0,0 +1,2 @@
+jsonschema==4.17.3
+pyyaml==6.0
-- 
2.34.1



[PATCH v6 23/23] CI: Make use of buildman requirements.txt

2023-07-12 Thread Neha Malcom Francis
From: Tom Rini 

Now that buildman has a requirements.txt file we need to make use of it.

Signed-off-by: Tom Rini 
Reviewed-by: Simon Glass 
[n-fran...@ti.com: Adding missing command from .azure-pipelines.yml]
Signed-off-by: Neha Malcom Francis 
---
 .azure-pipelines.yml | 4 
 .gitlab-ci.yml   | 4 
 2 files changed, 8 insertions(+)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 06c46b681c..8626b27d4b 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -162,6 +162,7 @@ stages:
   virtualenv -p /usr/bin/python3 /tmp/venv
   . /tmp/venv/bin/activate
   pip install -r test/py/requirements.txt
+  pip install -r tools/buildman/requirements.txt
   export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl
   export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
   export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}
@@ -209,6 +210,7 @@ stages:
   git config --global --add safe.directory $(work_dir)
   export USER=azure
   pip install -r test/py/requirements.txt
+  pip install -r tools/buildman/requirements.txt
   pip install asteval pylint==2.12.2 pyopenssl
   export PATH=${PATH}:~/.local/bin
   echo "[MASTER]" >> .pylintrc
@@ -404,6 +406,7 @@ stages:
   if [ -n "${BUILD_ENV}" ]; then
   export ${BUILD_ENV};
   fi
+  pip install -r tools/buildman/requirements.txt
   tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e 
--board ${TEST_PY_BD} ${OVERRIDE}
   cp ~/grub_x86.efi ${UBOOT_TRAVIS_BUILD_DIR}/
   cp ~/grub_x64.efi ${UBOOT_TRAVIS_BUILD_DIR}/
@@ -583,6 +586,7 @@ stages:
   # make environment variables available as tests are running inside a 
container
   export BUILDMAN="${BUILDMAN}"
   git config --global --add safe.directory ${WORK_DIR}
+  pip install -r tools/buildman/requirements.txt
   EOF
   cat << "EOF" >> build.sh
   if [[ "${BUILDMAN}" != "" ]]; then
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cfd58513c3..07d8ba5ac2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -97,6 +97,7 @@ build all 32bit ARM platforms:
   script:
 - ret=0;
   git config --global --add safe.directory "${CI_PROJECT_DIR}";
+  pip install -r tools/buildman/requirements.txt;
   ./tools/buildman/buildman -o /tmp -PEWM arm -x aarch64 || ret=$?;
   if [[ $ret -ne 0 ]]; then
 ./tools/buildman/buildman -o /tmp -seP;
@@ -110,6 +111,7 @@ build all 64bit ARM platforms:
 - . /tmp/venv/bin/activate
 - ret=0;
   git config --global --add safe.directory "${CI_PROJECT_DIR}";
+  pip install -r tools/buildman/requirements.txt;
   ./tools/buildman/buildman -o /tmp -PEWM aarch64 || ret=$?;
   if [[ $ret -ne 0 ]]; then
 ./tools/buildman/buildman -o /tmp -seP;
@@ -208,6 +210,7 @@ Run binman, buildman, dtoc, Kconfig and patman testsuites:
   virtualenv -p /usr/bin/python3 /tmp/venv;
   . /tmp/venv/bin/activate;
   pip install -r test/py/requirements.txt;
+  pip install -r tools/buildman/requirements.txt;
   export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl;
   export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
   export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
@@ -240,6 +243,7 @@ Run pylint:
   script:
 - git config --global --add safe.directory "${CI_PROJECT_DIR}"
 - pip install -r test/py/requirements.txt
+- pip install -r tools/buildman/requirements.txt
 - pip install asteval pylint==2.12.2 pyopenssl
 - export PATH=${PATH}:~/.local/bin
 - echo "[MASTER]" >> .pylintrc
-- 
2.34.1



[PATCH v6 04/23] j721e: schema: yaml: Add general schema and J721E board config files

2023-07-12 Thread Neha Malcom Francis
Schema file in YAML must be provided in board/ti/common for validating
input config files and packaging system firmware. The schema includes
entries for rm-cfg, board-cfg, pm-cfg and sec-cfg.

Board config files must be provided in board/ti/ in YAML.
These can then be consumed for generation of binaries to package system
firmware. Added YAML configs for J721E in particular.

Signed-off-by: Tarun Sahu 
[n-fran...@ti.com: prepared patch for upstreaming]
Signed-off-by: Neha Malcom Francis 
---
 board/ti/common/schema.yaml   |  436 +
 board/ti/j721e/board-cfg.yaml |   36 +
 board/ti/j721e/pm-cfg.yaml|   12 +
 board/ti/j721e/rm-cfg.yaml| 3174 +
 board/ti/j721e/sec-cfg.yaml   |  380 
 5 files changed, 4038 insertions(+)
 create mode 100644 board/ti/common/schema.yaml
 create mode 100644 board/ti/j721e/board-cfg.yaml
 create mode 100644 board/ti/j721e/pm-cfg.yaml
 create mode 100644 board/ti/j721e/rm-cfg.yaml
 create mode 100644 board/ti/j721e/sec-cfg.yaml

diff --git a/board/ti/common/schema.yaml b/board/ti/common/schema.yaml
new file mode 100644
index 00..8023ecb0e0
--- /dev/null
+++ b/board/ti/common/schema.yaml
@@ -0,0 +1,436 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Config schema for TI K3 devices
+#
+
+---
+
+definitions:
+u8:
+type: integer
+minimum: 0
+maximum: 0xff
+u16:
+type: integer
+minimum: 0
+maximum: 0x
+u32:
+type: integer
+minimum: 0
+maximum: 0x
+
+
+
+type: object
+properties:
+pm-cfg:
+type: object
+properties:
+rev:
+type: object
+properties:
+boardcfg_abi_maj:
+$ref: "#/definitions/u8"
+boardcfg_abi_min:
+$ref: "#/definitions/u8"
+board-cfg:
+type: object
+properties:
+rev:
+type: object
+properties:
+boardcfg_abi_maj:
+$ref: "#/definitions/u8"
+boardcfg_abi_min:
+$ref: "#/definitions/u8"
+control:
+type: object
+properties:
+subhdr:
+type: object
+properties:
+magic:
+$ref: "#/definitions/u16"
+size:
+$ref: "#/definitions/u16"
+main_isolation_enable:
+$ref: "#/definitions/u8"
+main_isolation_hostid:
+$ref: "#/definitions/u16"
+
+
+secproxy:
+type: object
+properties:
+subhdr:
+type: object
+properties:
+magic:
+$ref: "#/definitions/u16"
+size:
+$ref: "#/definitions/u16"
+scaling_factor:
+$ref: "#/definitions/u8"
+scaling_profile:
+$ref: "#/definitions/u8"
+disable_main_nav_secure_proxy:
+$ref: "#/definitions/u8"
+
+msmc:
+type: object
+properties:
+subhdr:
+type: object
+properties:
+magic:
+$ref: "#/definitions/u16"
+size:
+$ref: "#/definitions/u16"
+msmc_cache_size:
+$ref: "#/definitions/u8"
+debug_cfg:
+type: object
+properties:
+subhdr:
+type: object
+properties:
+magic:
+$ref: "#/definitions/u16"
+size:
+$ref: "#/definitions/u16"
+trace_dst_enables:
+$ref: "#/definitions/u16"
+trace_src_enables:
+$ref: "#/definitions/u16"
+
+sec-cfg:
+type: object
+properties:
+rev:
+type: object
+properties:
+boardcfg_abi_maj:
+$ref: "#/definitions/u8"
+boardcfg_abi_min:

[PATCH v7 00/23] Migration to using binman for bootloader

2023-07-14 Thread Neha Malcom Francis
This series aims to eliminate the use of additional custom repositories
such as k3-image-gen (K3 Image Generation) repo and core-secdev-k3 (K3
Security Development Tools) that was plumbed into the U-Boot build flow
to generate boot images for TI K3 platform devices. And instead, we move
towards using binman that aligns better with the community standard build
flow.

This series uses binman for all K3 platforms supported on U-Boot currently;
both HS (High Security, both SE and FS) and GP (General Purpose) devices.

Background on using k3-image-gen:
* TI K3 devices require a SYSFW (System Firmware) image consisting
of a signed system firmware image and board configuration binaries,
this is needed to bring up system firmware during U-Boot R5 SPL
startup.
* Board configuration data contain board-specific information
such as resource management, power management and security.

Background on using core-secdev-k3:
* Contains resources to sign x509 certificates for HS devices

Series intends to use binman to take over the packaging and signing for
the R5 bootloader images tiboot3.bin (and sysfw.itb, for non-combined
boot flow) instead of k3-image-gen.

Series also packages the A72/A53 bootloader images (tispl.bin and
u-boot.img) using ATF, OPTEE and DM (Device Manager)

Changes in v7:
- corrected Texas Instruments copyright year
- k3-am65-iot2050 image fit@0x18 filename retained as
  tispl.bin

Changes in v6:
- addressed whitespace warnings
- added testcase for overwriting symlink functionality
- %s/Arm Trusted Firmware/Trusted Firmware-A
- %s/tee-pager_v2.bin/tee-raw.bin

Changes in v5:
- updated all board configurations to latest
- changed output binary filenames
- fixed multiple certificate generation leading to packaging
  inconsistency in ti-secure*.py
- added patch to overwrite symlink if exists, patch 21/23
  ("binman: Overwrite symlink if it already exists")

Changes in v4:
- added support for iot2050
- documentation fixes
- move to using self.Raise in ti-board-config etype
- introduced common k3-binman.dtsi (further reduction in code
  duplication can be targeted, this as first step)

Changes in v3:
- added support for HS-FS devices
- added support for AM68-sk
- added back dropped documentation patch
- changed prefix for SYSFW and DM files to expected directory
  name
- extended test coverage to 100%
- documentation fixes
- corrected formatting changes

Changes in v2:
- removed all external scripts
- created ti-board-config etype to support generation of board
  config binaries
- created ti-secure and ti-secure-rom etypes to handle signing
  instead of using external TI_SECURE_DEV_PKG
- updated openssl btool to support x509 certificate generation
- dropped Makefile changes to obtain external binary components,
  moving to using BINMAN_INDIRS to achieve the same

CI/CD passes 100% (series based on -next) [1]

v1: 
https://patchwork.ozlabs.org/project/uboot/cover/20230120101903.179959-1-n-fran...@ti.com/
v2: 
https://patchwork.ozlabs.org/project/uboot/cover/20230404121342.446935-1-n-fran...@ti.com/
v3: 
https://patchwork.ozlabs.org/project/uboot/cover/20230421123203.1315330-1-n-fran...@ti.com/
 
v4: 
https://patchwork.ozlabs.org/project/uboot/cover/20230518142713.184164-1-n-fran...@ti.com/
v5: 
https://patchwork.ozlabs.org/project/uboot/cover/20230707123450.30329-1-n-fran...@ti.com/
v6: 
https://patchwork.ozlabs.org/project/uboot/cover/20230712183453.7623-1-n-fran...@ti.com/

[1] https://github.com/u-boot/u-boot/pull/363

Andrew Davis (1):
  binman: Overwrite symlink if it already exists

Neha Malcom Francis (20):
  binman: ti-board-config: Add support for TI board config binaries
  binman: ti-secure: Add support for TI signing
  arm: dts: k3: Add support for packaging sysfw.itb and tiboot3.bin
  j721e: schema: yaml: Add general schema and J721E board config files
  j721e: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin,
u-boot.img
  j7200: yaml: Add J7200 board config files
  j7200: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img
  am65x: yaml: Add AM65x board config files
  am65: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin,
u-boot.img
  am64x: yaml: Add board configs for AM64x
  am64x: dts: binman: Package tiboot3.bin, tispl.bin u-boot.img
  j721s2: yaml: Add board configs for J721S2
  j721s2: dts: binman: Package tiboot3.bin, tispl.bin and u-boot.img
  am62: yaml: Add board configs for AM62
  am625: dts: binman: Package tiboot3.bin, tispl.bin and u-boot.img
  am62a: yaml: Add board configs for AM62ax
  am62a: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img
  arm: k3-am65x-iot2050: Use binman for tispl.bin for iot2050
 

[PATCH v7 01/23] binman: ti-board-config: Add support for TI board config binaries

2023-07-14 Thread Neha Malcom Francis
The ti-board-config entry loads and validates a given YAML config file
against a given schema, and generates the board config binary. K3
devices require these binaries to be packed into the final system
firmware images.

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
---
 tools/binman/entries.rst  |  48 
 tools/binman/etype/ti_board_config.py | 259 ++
 tools/binman/ftest.py |  20 ++
 tools/binman/test/277_ti_board_cfg.dts|  14 +
 .../binman/test/278_ti_board_cfg_combined.dts |  25 ++
 .../binman/test/279_ti_board_cfg_no_type.dts  |  11 +
 tools/binman/test/yaml/config.yaml|  18 ++
 tools/binman/test/yaml/schema.yaml|  49 
 tools/binman/test/yaml/schema_notype.yaml |  38 +++
 9 files changed, 482 insertions(+)
 create mode 100644 tools/binman/etype/ti_board_config.py
 create mode 100644 tools/binman/test/277_ti_board_cfg.dts
 create mode 100644 tools/binman/test/278_ti_board_cfg_combined.dts
 create mode 100644 tools/binman/test/279_ti_board_cfg_no_type.dts
 create mode 100644 tools/binman/test/yaml/config.yaml
 create mode 100644 tools/binman/test/yaml/schema.yaml
 create mode 100644 tools/binman/test/yaml/schema_notype.yaml

diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index b71af801fd..14a2d03fad 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -1658,6 +1658,54 @@ by setting the size of the entry to something larger 
than the text.
 
 
 
+.. _etype_ti_board_config:
+
+Entry: ti-board-config: An entry containing a TI schema validated board config 
binary
+-
+
+This etype supports generation of two kinds of board configuration
+binaries: singular board config binary as well as combined board config
+binary.
+
+Properties / Entry arguments:
+- config-file: File containing board configuration data in YAML
+- schema-file: File containing board configuration YAML schema against
+  which the config file is validated
+
+Output files:
+- board config binary: File containing board configuration binary
+
+These above parameters are used only when the generated binary is
+intended to be a single board configuration binary. Example::
+
+my-ti-board-config {
+ti-board-config {
+config = "board-config.yaml";
+schema = "schema.yaml";
+};
+};
+
+To generate a combined board configuration binary, we pack the
+needed individual binaries into a ti-board-config binary. In this case,
+the available supported subnode names are board-cfg, pm-cfg, sec-cfg and
+rm-cfg. The final binary is prepended with a header containing details about
+the included board config binaries. Example::
+
+my-combined-ti-board-config {
+ti-board-config {
+board-cfg {
+config = "board-cfg.yaml";
+schema = "schema.yaml";
+};
+sec-cfg {
+config = "sec-cfg.yaml";
+schema = "schema.yaml";
+};
+}
+}
+
+
+
 .. _etype_u_boot:
 
 Entry: u-boot: U-Boot flat binary
diff --git a/tools/binman/etype/ti_board_config.py 
b/tools/binman/etype/ti_board_config.py
new file mode 100644
index 00..94f894c281
--- /dev/null
+++ b/tools/binman/etype/ti_board_config.py
@@ -0,0 +1,259 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+# Written by Neha Malcom Francis 
+#
+# Entry-type module for generating schema validated TI board
+# configuration binary
+#
+
+import os
+import struct
+import yaml
+
+from collections import OrderedDict
+from jsonschema import validate
+from shutil import copyfileobj
+
+from binman.entry import Entry
+from binman.etype.section import Entry_section
+from dtoc import fdt_util
+from u_boot_pylib import tools
+
+BOARDCFG = 0xB
+BOARDCFG_SEC = 0xD
+BOARDCFG_PM = 0xE
+BOARDCFG_RM = 0xC
+BOARDCFG_NUM_ELEMS = 4
+
+class Entry_ti_board_config(Entry_section):
+"""An entry containing a TI schema validated board config binary
+
+This etype supports generation of two kinds of board configuration
+binaries: singular board config binary as well as combined board config
+binary.
+
+Properties / Entry arguments:
+- config-file: File containing board configuration data in YAML
+- schema-file: File containing board configuration YAML schema against
+  which the config file is validated
+
+Output files:
+- board config binary: File containing board configuration binary
+
+These above parameters are used only when the generated binary is
+intended to be a single board configuration binary. Example::
+
+my-ti-board-config {
+ti-board-config {
+ 

[PATCH v7 03/23] arm: dts: k3: Add support for packaging sysfw.itb and tiboot3.bin

2023-07-14 Thread Neha Malcom Francis
Board config binary artifacts must be generated to be used by binman to
package sysfw.itb and tiboot3.bin for all K3 devices.

For devices that follow combined flow, these board configuration
binaries must again be packaged into a combined board configuration
blobs to be used by binman to package tiboot3.bin.

Add common k3-binman.dtsi to generate all the board configuration
binaries needed.

Also add custMpk.pem and ti-degenerate-key.pem needed for signing GP and
HS bootloader images common to all K3 devices.

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
---
 arch/arm/dts/k3-binman.dtsi | 116 
 1 file changed, 116 insertions(+)
 create mode 100644 arch/arm/dts/k3-binman.dtsi

diff --git a/arch/arm/dts/k3-binman.dtsi b/arch/arm/dts/k3-binman.dtsi
new file mode 100644
index 00..2a67cebf94
--- /dev/null
+++ b/arch/arm/dts/k3-binman.dtsi
@@ -0,0 +1,116 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+/ {
+   binman: binman {
+   multiple-images;
+   };
+};
+
+&binman {
+   custMpk {
+   filename = "custMpk.pem";
+   blob-ext {
+   filename = "../keys/custMpk.pem";
+   };
+   };
+
+   ti-degenerate-key {
+   filename = "ti-degenerate-key.pem";
+   blob-ext {
+   filename = "../keys/ti-degenerate-key.pem";
+   };
+   };
+};
+
+#ifndef CONFIG_ARM64
+
+&binman {
+   board-cfg {
+   filename = "board-cfg.bin";
+   bcfg_yaml: ti-board-config {
+   config = "board-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   pm-cfg {
+   filename = "pm-cfg.bin";
+   rcfg_yaml: ti-board-config {
+   config = "pm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   rm-cfg {
+   filename = "rm-cfg.bin";
+   pcfg_yaml: ti-board-config {
+   config = "rm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   sec-cfg {
+   filename = "sec-cfg.bin";
+   scfg_yaml: ti-board-config {
+   config = "sec-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   combined-tifs-cfg {
+   filename = "combined-tifs-cfg.bin";
+   ti-board-config {
+   bcfg_yaml_tifs: board-cfg {
+   config = "board-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   scfg_yaml_tifs: sec-cfg {
+   config = "sec-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   pcfg_yaml_tifs: pm-cfg {
+   config = "pm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   rcfg_yaml_tifs: rm-cfg {
+   config = "rm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   };
+   combined-dm-cfg {
+   filename = "combined-dm-cfg.bin";
+   ti-board-config {
+   pcfg_yaml_dm: pm-cfg {
+   config = "pm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   rcfg_yaml_dm: rm-cfg {
+   config = "rm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   };
+   combined-sysfw-cfg {
+   filename = "combined-sysfw-cfg.bin";
+   ti-board-config {
+   board-cfg {
+   config = "board-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   sec-cfg {
+   config = "sec-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   pm-cfg {
+   config = "pm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   rm-cfg {
+   config = "rm-cfg.yaml";
+   schema = "../common/schema.yaml";
+   };
+   };
+   };
+};
+
+#endif
-- 
2.34.1



[PATCH v7 02/23] binman: ti-secure: Add support for TI signing

2023-07-14 Thread Neha Malcom Francis
The ti-secure entry contains certificate for binaries that will be
loaded or booted by system firmware whereas the ti-secure-rom entry
contains certificate for binaries that will be booted by ROM. Support
for both these types of certificates is necessary for booting of K3
devices.

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[vigne...@ti.com: fixed inconsist cert generation by multiple packing]
Signed-off-by: Vignesh Raghavendra 
---
 board/ti/keys/custMpk.pem |  51 
 board/ti/keys/ti-degenerate-key.pem   |  10 +
 tools/binman/btool/openssl.py | 244 +
 tools/binman/entries.rst  |  65 +
 tools/binman/etype/ti_secure.py   |  78 ++
 tools/binman/etype/ti_secure_rom.py   | 249 ++
 tools/binman/etype/x509_cert.py   |  87 +-
 tools/binman/ftest.py |  52 
 tools/binman/test/279_ti_secure.dts   |  17 ++
 tools/binman/test/280_ti_secure_rom.dts   |  17 ++
 .../test/281_ti_secure_rom_combined.dts   |  25 ++
 tools/binman/test/288_ti_secure_rom_a.dts |  19 ++
 tools/binman/test/289_ti_secure_rom_b.dts |  18 ++
 13 files changed, 924 insertions(+), 8 deletions(-)
 create mode 100644 board/ti/keys/custMpk.pem
 create mode 100644 board/ti/keys/ti-degenerate-key.pem
 create mode 100644 tools/binman/etype/ti_secure.py
 create mode 100644 tools/binman/etype/ti_secure_rom.py
 create mode 100644 tools/binman/test/279_ti_secure.dts
 create mode 100644 tools/binman/test/280_ti_secure_rom.dts
 create mode 100644 tools/binman/test/281_ti_secure_rom_combined.dts
 create mode 100644 tools/binman/test/288_ti_secure_rom_a.dts
 create mode 100644 tools/binman/test/289_ti_secure_rom_b.dts

diff --git a/board/ti/keys/custMpk.pem b/board/ti/keys/custMpk.pem
new file mode 100644
index 00..adba378c80
--- /dev/null
+++ b/board/ti/keys/custMpk.pem
@@ -0,0 +1,51 @@
+-BEGIN RSA PRIVATE KEY-
+MIIJKQIBAAKCAgEAvxSuSdh/ctNrI83rSA5l3CJN8g5PgvbttfLd23yR+m5Z/9X3
+tt4EHYrM0pXZ0eDEwfhQv/9IDJEiUJpMe4vzlgooJrOk2eCpVUEa+z5bJ2y/ysBx
+ry9yIu5GASVirT7HBPaxGLYswBJuD+KbPuWmoKgGRQNBF04WH6l01oRO1nmnELgR
+qQ6SHyXdf7Hy0bnyaNgzWUuCfXfM0Zz6I7T7WIjyzerVFvIsdS36YsPBCW7gBnDg
+tQcJmWLZ1uTnbG3IggdQk/fi2O3RX+PQns+TVNlf3V3ON2DxqxSKBHtlp7p/30VF
+fEuhW65OxpQ9jE6H0pQ8pPOf2vzyNnznDa1aQjfxKoHQbqGnZwMeh+0Au3NKaCgx
+ooKaowTB6If/RX6qwZ/UOwXHg/0hcf69fzjJFhlSDuYDM40dHsk2HM1OnYIpiM2b
+Kr5sX3uysjp5AGp99a0anR7NWCrPXvROgKs7T9341N40osQg2VkZLYUCXh9osUyN
+uREG6S12tViMUKg3bmZ4b4MwRk00n7QYSrm7+nvFrtYyEISEbD+agDM1/E281W5g
+VFDPfm2AlwT6jwsg/b2YK6E3vVn9SuxFoQmLF8lyFDO3BV4SXeJaHc4hVPbh6tVV
+qifrTQnfGUCCLmaJF2XZbrPWOE6NYRbWdNTeFl9RGdVCuIPSyN5LqWmXto0CAwEA
+AQKCAgAzkAwcJ0z1GnId/lJQZno8NhGckRoJuEKbR8dwlCP8VUz6Ca5H7Y9kvXDa
+Hs/hn+rYgP6hYOz7XyrIX2rmJ/T6dxEwqGeC1+o59FConcIRWHpE5zuGT6JYJL5F
+TuZa48bm4v8VMQvQZOjIZpkIFwao8c6HTwKAnHTB5IN/48I2hCt+Cn3RhfoOZ7Rm
+4gkpaSkt+7GXlhXHb82YfujNO+hbktEamhUYlQ9EK70Wa8aqmf3gHxO0JgsEFjW8
+lJaSnultlTW8SDcx3LMUUjCYumECk4oX/VlJfmKYjPlVjkr3QQ+Cm3nNucb4K4hc
+c+JL+2ERhSj8RjXL7VgbNgdPnIjvQDJuTNqecTU8xWPYrkOLQpNibbLjnutLkhJz
+fMyRtmDtrsey8WiCDuCHkPJ8/f8RjL2zWI9fzTDDIzdlEKouUFGOovaHVnbua6pn
+hymcu9d9FV3p2rcbj0ivCs7e8j+vhSxFJEJoAbcQdXCTi/n2uR7pLtoMNiUzsejy
+d46Uz+KEU920NTwE2z6JJq8I2vegnxjc7PDDrV3/5rK04B93aXiqvwWseCpxelrI
+xaMkRHbXrIXRO6MXQ3N+zNq8Dg3hjGTTvaBKuwgvqLwlXY8+Aa3ooFzEOInIOSsI
+XcWqXxt/tgZgsj9RwpC42t8kbA+BkbNk9EIUa+P5kEr2P/fO7QKCAQEA4EtArnOX
+D6tQF8uTw8USOZC2P9s/ez1z4jRq3oKP0Kv4tJiuIObJ/dUvGVD7aM5v2xaCfhm8
+xpk09VPUgghfG5jR5qVvQr75kCNToJQudWi4ngk1HwKJzzTO11giFEdybvTUA+Pj
+fmxCM0dYYqRWZoj0hLqXlUCwxE74BFIhJVjeYbf+nTQrqpllTLoW7MTZHzGx5SXx
+4dNzyVAUH49Yt2D8mgXXCkf5sGLh762wj34b/rR10Kr4O5utGMZrfTRIbuQ1pNjU
+m66baPzq+mC0BzqZEW70TgEb7lOr8rcVXLOi3r36omfd9/MHx7iZD6o3K1axSO15
+grD4ZrN7Ac3QJwKCAQEA2heCoBdpvy6YUk8AO2k8qDygTdmPQRuwjjT+Z2fMslBt
+D7DkpKwZ6Bl9OclcpiiLHmH+hv65KqYg+tR0RRb7PcogB9El9x7yKkGTPZEYWGky
+n8P84rJpKwjnwWQvPQktI1cs3YGvZA9DQTFBavRrwuzgd1oSJq5aPQ2tme0kMvWp
+l1/B/cPK+PKCi/Wfisaze1TjijP9qIeUwkdNN6WLrLU3QgsGppcg2I7RQtAIikT6
+GkuiOQAvWMsrJVV6PNrVKz4fJDJ59Rz6jbDHZNi1MEYNxQoB/Pl7QIakbfjWpHLv
+8Ey7cB2JKxjQy8tmyl8WNQVbXbE6daPXcMTUmaRAKwKCAQBv1lYMJmq+T2eCVen6
+BbvOpE+bi5EdvEiaFBTtmiBnpjg+pJq+oRU60h/H+c9CNR0lGxY6Fk9An4f+g6xE
+ojP6KLsQzJCrsVny+wpp2TlJJcxYULMCIVvhy60PR0zG29E9biqBPhJjKUvhEcQK
+e3LxcXyq6fdHXphFajLUxLbuTl+kTgBRFoBnclFGbsubh5PTsA3J+p+fQLZNPPar
+veg4l82cZykQYU8pGkUaI3sUMYd3+zd7sqRP5JHs9pMGPRmY4YW2CsAIWIn5UZNB
+ARMDP76vKKn8cyUgMuxb+9pU/OVLN2NPs4bEaZQJjAwV+YPEwldny7F47xEM9JVz
+EtKlAoIBAQDUt62u3GdGE/p5/ZgqWoDRTyDEDfmN9aYFbmbdEP80xQE7FrxMaZhz
+K7laja6SWmUm40nQ/c45bQQp4uLtKHcxU15egX7YRBTLZl5o5IasZR79ebnEm2O8
+l9kEZeU1USf3mmWmP4GExOZCRfqaiYA6BbUCdJXTqKdXeWnkAssV8UrS3JFoJHpq
+yo7OWGqefyQ8nRW6jO9SW7uaqtUD+7H6aF5XSk3YWvusfdBZrHNH+fM/hpnZovaL
+Us7ogTDS/laA8PyK37jYfMVdQhmZoU1Iomt3zkUWK3gt/aWPpfAlQf4Jka4YspZB
+tNiijefaZ1hPqsPs5Joyd/YAhdsfaHc1AoIBAQCn/9j6RRjRaw0ip756oad4AXHz
+XBwVB2CrY96qT6Hj9Sq7tGgdskqGkOQkAivBLBizUdcWv0t1yenOsSgasQeMlvlh

[PATCH v7 05/23] j721e: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin, u-boot.img

2023-07-14 Thread Neha Malcom Francis
By providing entries in the binman node of the device tree, binman will
be able to find and package board config artifacts generated by
TIBoardConfig with sysfw.bin and generate the final image sysfw.itb.
It will also pick out the R5 SPL and sign it with the help of TI signing
entry and generate the final tiboot3.bin.

Entries for A72 build have been added to k3-j721e-binman.dtsi to
generate tispl.bin and u-boot.img.

Support has been added for both HS-SE(SR 1.1), HS-FS(SR 2.0) and GP images
In HS-SE, the encrypted system firmware binary must be signed along with
the signed certificate binary.

HS-SE:
* tiboot3-j721e_sr1_1-hs-evm.bin
* sysfw-j721e_sr1_1-hs-evm.itb
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-j721e_sr2-hs-fs-evm.bin
* sysfw-j721e_sr2-hs-fs-evm.itb
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin -->tiboot3-j721e-gp-evm.bin
* sysfw.itb --> sysfw-j721e-gp-evm.itb
* tispl.bin_unsigned
* u-boot.img_unsigned

It is to be noted that the bootflow followed by J721E requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs

sysfw.itb:
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-j721e-binman.dtsi | 701 ++
 .../k3-j721e-common-proc-board-u-boot.dtsi|   1 +
 .../arm/dts/k3-j721e-r5-common-proc-board.dts |   1 +
 arch/arm/dts/k3-j721e-sk-u-boot.dtsi  |   1 +
 board/ti/j721e/Kconfig|   2 +
 5 files changed, 706 insertions(+)
 create mode 100644 arch/arm/dts/k3-j721e-binman.dtsi

diff --git a/arch/arm/dts/k3-j721e-binman.dtsi 
b/arch/arm/dts/k3-j721e-binman.dtsi
new file mode 100644
index 00..339e909501
--- /dev/null
+++ b/arch/arm/dts/k3-j721e-binman.dtsi
@@ -0,0 +1,701 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_J721E_R5_EVM
+
+&binman {
+   tiboot3-j721e_sr1_1-hs-evm.bin {
+   filename = "tiboot3-j721e_sr1_1-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>;
+   core = "public";
+   load = ;
+   keyfile = "custMpk.pem";
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   };
+   sysfw {
+   filename = "sysfw.bin";
+   ti-secure-rom {
+   content = <&ti_fs_cert>;
+   core = "secure";
+   load = <0x4>;
+   keyfile = "custMpk.pem";
+   countersign;
+   };
+   ti_fs_cert: ti-fs-cert.bin {
+   filename = 
"ti-sysfw/ti-fs-firmware-j721e_sr1_1-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   ti-fs-firmware-j721e_sr1_1-hs-enc.bin {
+   filename = 
"ti-sysfw/ti-fs-firmware-j721e_sr1_1-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   };
+   itb {
+   filename = "sysfw-j721e_sr1_1-hs-evm.itb";
+   fit {
+   description = "SYSFW and Config fragments";
+   #address-cells = <1>;
+   images {
+   sysfw.bin {
+   description = "sysfw";
+   type = "firmware";
+   arch = "arm";
+   compression = "none";
+   blob-ext {
+   filename = "sysfw.bin";
+   };
+   };
+   board-cfg.bin {
+   description = "board-cfg";
+   type = "firmware";
+   arch = "arm";
+   compression = "none";
+   ti-secure {
+   content = <

[PATCH v7 06/23] j7200: yaml: Add J7200 board config files

2023-07-14 Thread Neha Malcom Francis
Added YAML configs for J7200

Signed-off-by: Neha Malcom Francis 
---
 board/ti/j721e/board-cfg_j7200.yaml |   36 +
 board/ti/j721e/pm-cfg_j7200.yaml|   12 +
 board/ti/j721e/rm-cfg_j7200.yaml| 2065 +++
 board/ti/j721e/sec-cfg_j7200.yaml   |  380 +
 4 files changed, 2493 insertions(+)
 create mode 100644 board/ti/j721e/board-cfg_j7200.yaml
 create mode 100644 board/ti/j721e/pm-cfg_j7200.yaml
 create mode 100644 board/ti/j721e/rm-cfg_j7200.yaml
 create mode 100644 board/ti/j721e/sec-cfg_j7200.yaml

diff --git a/board/ti/j721e/board-cfg_j7200.yaml 
b/board/ti/j721e/board-cfg_j7200.yaml
new file mode 100644
index 00..0ac1ae93fe
--- /dev/null
+++ b/board/ti/j721e/board-cfg_j7200.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for J7200
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x10
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
diff --git a/board/ti/j721e/pm-cfg_j7200.yaml b/board/ti/j721e/pm-cfg_j7200.yaml
new file mode 100644
index 00..daaefb1318
--- /dev/null
+++ b/board/ti/j721e/pm-cfg_j7200.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for J7200
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/j721e/rm-cfg_j7200.yaml b/board/ti/j721e/rm-cfg_j7200.yaml
new file mode 100644
index 00..263285ff42
--- /dev/null
+++ b/board/ti/j721e/rm-cfg_j7200.yaml
@@ -0,0 +1,2065 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for J7200
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 3
+allowed_atype : 0b101010
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 5
+allowed_atype : 0b101010
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 12
+allowed_atype : 0b101010
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 13
+allowed_atype : 0b101010
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #5
+host_id: 35
+allowed_atype : 0b101010
+allowed_qos : 0x

[PATCH v7 07/23] j7200: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img

2023-07-14 Thread Neha Malcom Francis
Support has been added for both HS-SE(SR 2.0), HS-FS(SR 2.0) and GP
images.

HS-SE:
* tiboot3-j7200_sr2-hs-evm.bin
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-j7200_sr2-hs-fs-evm.bin
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-j7200-gp-evm.bin
* tispl.bin_unsigned
* u-boot.img_unsigned

It is to be noted that the bootflow followed by J7200 requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-j7200-binman.dtsi | 502 ++
 .../k3-j7200-common-proc-board-u-boot.dtsi|   2 +
 board/ti/j721e/Kconfig|   2 +
 3 files changed, 506 insertions(+)
 create mode 100644 arch/arm/dts/k3-j7200-binman.dtsi

diff --git a/arch/arm/dts/k3-j7200-binman.dtsi 
b/arch/arm/dts/k3-j7200-binman.dtsi
new file mode 100644
index 00..4b055773bf
--- /dev/null
+++ b/arch/arm/dts/k3-j7200-binman.dtsi
@@ -0,0 +1,502 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_J7200_R5_EVM
+
+&bcfg_yaml {
+   config = "board-cfg_j7200.yaml";
+};
+
+&rcfg_yaml {
+   config = "rm-cfg_j7200.yaml";
+};
+
+&pcfg_yaml {
+   config = "pm-cfg_j7200.yaml";
+};
+
+&scfg_yaml {
+   config = "sec-cfg_j7200.yaml";
+};
+
+&bcfg_yaml_tifs {
+   config = "board-cfg_j7200.yaml";
+};
+
+&rcfg_yaml_tifs {
+   config = "rm-cfg_j7200.yaml";
+};
+
+&pcfg_yaml_tifs {
+   config = "pm-cfg_j7200.yaml";
+};
+
+&scfg_yaml_tifs {
+   config = "sec-cfg_j7200.yaml";
+};
+
+&rcfg_yaml_dm {
+   config = "rm-cfg_j7200.yaml";
+};
+
+&pcfg_yaml_dm {
+   config = "pm-cfg_j7200.yaml";
+};
+
+&binman {
+   tiboot3-j7200_sr2-hs-evm.bin {
+   filename = "tiboot3-j7200_sr2-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>, <&ti_fs_enc>, 
<&combined_tifs_cfg>,
+   <&combined_dm_cfg>, <&sysfw_inner_cert>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl>;
+   content-sysfw = <&ti_fs_enc>;
+   content-sysfw-data = <&combined_tifs_cfg>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert>;
+   content-dm-data = <&combined_dm_cfg>;
+   load = <0x41c0>;
+   load-sysfw = <0x4>;
+   load-sysfw-data = <0x7f000>;
+   load-dm-data = <0x41c8>;
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   ti_fs_enc: ti-fs-enc.bin {
+   filename = 
"ti-sysfw/ti-fs-firmware-j7200_sr2-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_tifs_cfg: combined-tifs-cfg.bin {
+   filename = "combined-tifs-cfg.bin";
+   type = "blob-ext";
+   };
+   sysfw_inner_cert: sysfw-inner-cert {
+   filename = 
"ti-sysfw/ti-fs-firmware-j7200_sr2-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_dm_cfg: combined-dm-cfg.bin {
+   filename = "combined-dm-cfg.bin";
+   type = "blob-ext";
+   };
+   };
+};
+
+&binman {
+   tiboot3-j7200_sr2-hs-fs-evm.bin {
+   filename = "tiboot3-j7200_sr2-hs-fs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl_fs>, <&ti_fs_enc_fs>, 
<&combined_tifs_cfg_fs>,
+   <&combined_dm_cfg_fs>, <&sysfw_inner_cert_fs>;
+   combined;
+   dm-data;
+   sysfw

[PATCH v7 08/23] am65x: yaml: Add AM65x board config files

2023-07-14 Thread Neha Malcom Francis
Added YAML configs for AM65x

Signed-off-by: Neha Malcom Francis 
---
 board/ti/am65x/board-cfg.yaml |   36 +
 board/ti/am65x/pm-cfg.yaml|   12 +
 board/ti/am65x/rm-cfg.yaml| 2068 +
 board/ti/am65x/sec-cfg.yaml   |  379 ++
 4 files changed, 2495 insertions(+)
 create mode 100644 board/ti/am65x/board-cfg.yaml
 create mode 100644 board/ti/am65x/pm-cfg.yaml
 create mode 100644 board/ti/am65x/rm-cfg.yaml
 create mode 100644 board/ti/am65x/sec-cfg.yaml

diff --git a/board/ti/am65x/board-cfg.yaml b/board/ti/am65x/board-cfg.yaml
new file mode 100644
index 00..a8e06166d5
--- /dev/null
+++ b/board/ti/am65x/board-cfg.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM65x
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x10
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
diff --git a/board/ti/am65x/pm-cfg.yaml b/board/ti/am65x/pm-cfg.yaml
new file mode 100644
index 00..73fe86c29a
--- /dev/null
+++ b/board/ti/am65x/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM65x
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/am65x/rm-cfg.yaml b/board/ti/am65x/rm-cfg.yaml
new file mode 100644
index 00..5903773e81
--- /dev/null
+++ b/board/ti/am65x/rm-cfg.yaml
@@ -0,0 +1,2068 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for AM65x
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 3
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 5
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 12
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 13
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #5
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #6
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #7
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #8
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #9
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0

[PATCH v7 09/23] am65: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin, u-boot.img

2023-07-14 Thread Neha Malcom Francis
Support has been added for both HS-SE(SR 2.0) and GP(SR 2.0) images.

HS-SE:
* tiboot3-am65x_sr2-hs-evm.bin
* sysfw-am65x_sr2-hs-evm.itb
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-am65x_sr2-gp-evm.bin
* sysfw.itb --> sysfw-am65x_sr2-gp-evm.itb
* tispl.bin_unsigned
* u-boot.img_unsigned

Note that the bootflow followed by AM65x requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
sysfw.itb:
* sysfw
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* ATF
* OPTEE
* A53 SPL
* A53 SPL dtbs

u-boot.img:
* A53 U-Boot
* A53 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi  |   1 +
 .../dts/k3-am654-r5-base-board-u-boot.dtsi|   1 +
 arch/arm/dts/k3-am65x-binman.dtsi | 518 ++
 board/ti/am65x/Kconfig|   2 +
 4 files changed, 522 insertions(+)
 create mode 100644 arch/arm/dts/k3-am65x-binman.dtsi

diff --git a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
index 0c1305df7e..e4cbc47c2a 100644
--- a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
@@ -4,6 +4,7 @@
  */
 
 #include "k3-am654-r5-base-board-u-boot.dtsi"
+#include "k3-am65x-binman.dtsi"
 
 &pru0_0 {
remoteproc-name = "pru0_0";
diff --git a/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi
index 4516ab1437..949320c91d 100644
--- a/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi
@@ -5,6 +5,7 @@
 
 #include 
 #include 
+#include "k3-am65x-binman.dtsi"
 
 / {
chosen {
diff --git a/arch/arm/dts/k3-am65x-binman.dtsi 
b/arch/arm/dts/k3-am65x-binman.dtsi
new file mode 100644
index 00..ff36ae35d6
--- /dev/null
+++ b/arch/arm/dts/k3-am65x-binman.dtsi
@@ -0,0 +1,518 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_AM654_R5_EVM
+
+&binman {
+   tiboot3-am65x_sr2-hs-evm.bin {
+   filename = "tiboot3-am65x_sr2-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>;
+   core = "public";
+   load = ;
+   keyfile = "custMpk.pem";
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   };
+   sysfw {
+   filename = "sysfw.bin";
+   ti-secure-rom {
+   content = <&ti_sci_cert>;
+   core = "secure";
+   load = <0x4>;
+   keyfile = "custMpk.pem";
+   countersign;
+   };
+   ti_sci_cert: ti-sci-cert.bin {
+   filename = 
"ti-sysfw/ti-sci-firmware-am65x_sr2-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   ti-sci-firmware-am65x-hs-enc.bin {
+   filename = 
"ti-sysfw/ti-sci-firmware-am65x_sr2-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   };
+   itb {
+   filename = "sysfw-am65x_sr2-hs-evm.itb";
+   fit {
+   description = "SYSFW and Config fragments";
+   #address-cells = <1>;
+   images {
+   sysfw.bin {
+   description = "sysfw";
+   type = "firmware";
+   arch = "arm";
+   compression = "none";
+   blob-ext {
+   filename = "sysfw.bin";
+   };
+   };
+   board-cfg.bin {
+   description = "board-cfg";
+   type = "firmware";
+   arch = "arm";
+   compression = "none";
+   ti-secure {
+ 

[PATCH v7 10/23] am64x: yaml: Add board configs for AM64x

2023-07-14 Thread Neha Malcom Francis
Added YAML configs for AM64xx

Signed-off-by: Neha Malcom Francis 
---
 board/ti/am64x/board-cfg.yaml |   36 +
 board/ti/am64x/pm-cfg.yaml|   12 +
 board/ti/am64x/rm-cfg.yaml| 1400 +
 board/ti/am64x/sec-cfg.yaml   |  380 +
 4 files changed, 1828 insertions(+)
 create mode 100644 board/ti/am64x/board-cfg.yaml
 create mode 100644 board/ti/am64x/pm-cfg.yaml
 create mode 100644 board/ti/am64x/rm-cfg.yaml
 create mode 100644 board/ti/am64x/sec-cfg.yaml

diff --git a/board/ti/am64x/board-cfg.yaml b/board/ti/am64x/board-cfg.yaml
new file mode 100644
index 00..62947c0820
--- /dev/null
+++ b/board/ti/am64x/board-cfg.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM64x
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x0
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
diff --git a/board/ti/am64x/pm-cfg.yaml b/board/ti/am64x/pm-cfg.yaml
new file mode 100644
index 00..83c6a039f2
--- /dev/null
+++ b/board/ti/am64x/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM64x
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/am64x/rm-cfg.yaml b/board/ti/am64x/rm-cfg.yaml
new file mode 100644
index 00..1f4c6cf770
--- /dev/null
+++ b/board/ti/am64x/rm-cfg.yaml
@@ -0,0 +1,1400 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for AM64x
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 12
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 30
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 36
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 38
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #5
+host_id: 41
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x

[PATCH v7 11/23] am64x: dts: binman: Package tiboot3.bin, tispl.bin u-boot.img

2023-07-14 Thread Neha Malcom Francis
Support added for HS and GP boot binaries for AM64x.

HS-SE:
* tiboot3-am64x_sr2-hs-evm.bin
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-am64x_sr2-hs-fs-evm.bin
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-am64x-gp-evm.bin
* tispl.bin_unsigned
* u-boot.img_unsigned

Note that the bootflow followed by AM64x requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* sysfw
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* ATF
* OPTEE
* A53 SPL
* A53 SPL dtbs

u-boot.img:
* A53 U-Boot
* A53 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-am642-evm-u-boot.dtsi |   2 +
 arch/arm/dts/k3-am642-r5-evm.dts  |   1 +
 arch/arm/dts/k3-am642-sk-u-boot.dtsi  |   2 +
 arch/arm/dts/k3-am64x-binman.dtsi | 515 ++
 board/ti/am64x/Kconfig|   2 +
 5 files changed, 522 insertions(+)
 create mode 100644 arch/arm/dts/k3-am64x-binman.dtsi

diff --git a/arch/arm/dts/k3-am642-evm-u-boot.dtsi 
b/arch/arm/dts/k3-am642-evm-u-boot.dtsi
index 64857b0909..73577e8cfd 100644
--- a/arch/arm/dts/k3-am642-evm-u-boot.dtsi
+++ b/arch/arm/dts/k3-am642-evm-u-boot.dtsi
@@ -3,6 +3,8 @@
  * Copyright (C) 2020-2021 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include "k3-am64x-binman.dtsi"
+
 / {
chosen {
stdout-path = "serial2:115200n8";
diff --git a/arch/arm/dts/k3-am642-r5-evm.dts b/arch/arm/dts/k3-am642-r5-evm.dts
index e870492a69..b49064181a 100644
--- a/arch/arm/dts/k3-am642-r5-evm.dts
+++ b/arch/arm/dts/k3-am642-r5-evm.dts
@@ -8,6 +8,7 @@
 #include "k3-am642.dtsi"
 #include "k3-am64-evm-ddr4-1600MTs.dtsi"
 #include "k3-am64-ddr.dtsi"
+#include "k3-am64x-binman.dtsi"
 
 / {
chosen {
diff --git a/arch/arm/dts/k3-am642-sk-u-boot.dtsi 
b/arch/arm/dts/k3-am642-sk-u-boot.dtsi
index 69dbe943bd..3d6be025bd 100644
--- a/arch/arm/dts/k3-am642-sk-u-boot.dtsi
+++ b/arch/arm/dts/k3-am642-sk-u-boot.dtsi
@@ -3,6 +3,8 @@
  * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include "k3-am64x-binman.dtsi"
+
 / {
chosen {
stdout-path = "serial2:115200n8";
diff --git a/arch/arm/dts/k3-am64x-binman.dtsi 
b/arch/arm/dts/k3-am64x-binman.dtsi
new file mode 100644
index 00..ebc8101ee0
--- /dev/null
+++ b/arch/arm/dts/k3-am64x-binman.dtsi
@@ -0,0 +1,515 @@
+// SPDX-License-Identifier: GPL-2.0+
+// Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_AM642_R5_EVM
+
+&binman {
+   tiboot3-am64x_sr2-hs-evm.bin {
+   filename = "tiboot3-am64x_sr2-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>, <&ti_sci_enc>,
+   <&combined_sysfw_cfg>, <&sysfw_inner_cert>;
+   combined;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl>;
+   content-sysfw = <&ti_sci_enc>;
+   content-sysfw-data = <&combined_sysfw_cfg>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert>;
+   load = <0x7000>;
+   load-sysfw = <0x44000>;
+   load-sysfw-data = <0x7b000>;
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   ti_sci_enc: ti-fs-enc.bin {
+   filename = 
"ti-sysfw/ti-sci-firmware-am64x_sr2-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_sysfw_cfg: combined-sysfw-cfg.bin {
+   filename = "combined-sysfw-cfg.bin";
+   type = "blob-ext";
+   };
+   sysfw_inner_cert: sysfw-inner-cert {
+   filename = 
"ti-sysfw/ti-sci-firmware-am64x_sr2-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+
+   };
+};
+
+&binman {
+   tiboot3-am64x_sr2-hs-fs-evm.bin {
+   filename = "tiboot3-am64x_sr2-hs-fs-evm.bin";
+   symlink = "tiboot3.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl_fs>, <&ti_sci_enc_fs>,
+   

[PATCH v7 12/23] j721s2: yaml: Add board configs for J721S2

2023-07-14 Thread Neha Malcom Francis
Added YAML configs for J721S2

Signed-off-by: Neha Malcom Francis 
---
 board/ti/j721s2/board-cfg.yaml |   36 +
 board/ti/j721s2/pm-cfg.yaml|   12 +
 board/ti/j721s2/rm-cfg.yaml| 2901 
 board/ti/j721s2/sec-cfg.yaml   |  379 +
 4 files changed, 3328 insertions(+)
 create mode 100644 board/ti/j721s2/board-cfg.yaml
 create mode 100644 board/ti/j721s2/pm-cfg.yaml
 create mode 100644 board/ti/j721s2/rm-cfg.yaml
 create mode 100644 board/ti/j721s2/sec-cfg.yaml

diff --git a/board/ti/j721s2/board-cfg.yaml b/board/ti/j721s2/board-cfg.yaml
new file mode 100644
index 00..dd024110e7
--- /dev/null
+++ b/board/ti/j721s2/board-cfg.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for J721S2
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x0
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
diff --git a/board/ti/j721s2/pm-cfg.yaml b/board/ti/j721s2/pm-cfg.yaml
new file mode 100644
index 00..a640460d30
--- /dev/null
+++ b/board/ti/j721s2/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for J721S2
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/j721s2/rm-cfg.yaml b/board/ti/j721s2/rm-cfg.yaml
new file mode 100644
index 00..f772832f19
--- /dev/null
+++ b/board/ti/j721s2/rm-cfg.yaml
@@ -0,0 +1,2901 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for J721S2
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 3
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 5
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 12
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 13
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #5
+host_id: 21
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #6
+host_id: 23
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #7
+host_id: 35
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #8
+host_id: 37
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #9
+host_id: 40
+allowed_atype : 0x2A

[PATCH v7 13/23] j721s2: dts: binman: Package tiboot3.bin, tispl.bin and u-boot.img

2023-07-14 Thread Neha Malcom Francis
Support has been added for both HS-SE, HS-FS  and GP images.

HS-SE:
* tiboot3-j721s2-hs-evm.bin
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-j721s2-hs-fs-evm.bin
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-j721s2-gp-evm.bin
* tispl.bin_unsigned
* u-boot.img_unsigned

It is to be noted that the bootflow followed by J721S2 requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 .../arm/dts/k3-am68-sk-base-board-u-boot.dtsi |   2 +
 arch/arm/dts/k3-j721s2-binman.dtsi| 546 ++
 .../k3-j721s2-common-proc-board-u-boot.dtsi   |   2 +
 .../dts/k3-j721s2-r5-common-proc-board.dts|   1 +
 board/ti/j721s2/Kconfig   |   2 +
 5 files changed, 553 insertions(+)
 create mode 100644 arch/arm/dts/k3-j721s2-binman.dtsi

diff --git a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
index ee31b1ebe7..79faa1b573 100644
--- a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
@@ -3,6 +3,8 @@
  * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include "k3-j721s2-binman.dtsi"
+
 / {
chosen {
stdout-path = "serial2:115200n8";
diff --git a/arch/arm/dts/k3-j721s2-binman.dtsi 
b/arch/arm/dts/k3-j721s2-binman.dtsi
new file mode 100644
index 00..e0307e596b
--- /dev/null
+++ b/arch/arm/dts/k3-j721s2-binman.dtsi
@@ -0,0 +1,546 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_J721S2_R5_EVM
+
+&binman {
+   tiboot3-j721s2-hs-evm.bin {
+   filename = "tiboot3-j721s2-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>, <&ti_fs_enc>, 
<&combined_tifs_cfg>,
+   <&combined_dm_cfg>, <&sysfw_inner_cert>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl>;
+   content-sysfw = <&ti_fs_enc>;
+   content-sysfw-data = <&combined_tifs_cfg>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert>;
+   content-dm-data = <&combined_dm_cfg>;
+   load = <0x41c0>;
+   load-sysfw = <0x4>;
+   load-sysfw-data = <0x67000>;
+   load-dm-data = <0x41c8>;
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   ti_fs_enc: ti-fs-enc.bin {
+   filename = "ti-sysfw/ti-fs-firmware-j721s2-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_tifs_cfg: combined-tifs-cfg.bin {
+   filename = "combined-tifs-cfg.bin";
+   type = "blob-ext";
+   };
+   sysfw_inner_cert: sysfw-inner-cert {
+   filename = "ti-sysfw/ti-fs-firmware-j721s2-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_dm_cfg: combined-dm-cfg.bin {
+   filename = "combined-dm-cfg.bin";
+   type = "blob-ext";
+   };
+   };
+};
+
+&binman {
+   tiboot3-j721s2-hs-fs-evm.bin {
+   filename = "tiboot3-j721s2-hs-fs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl_fs>, <&ti_fs_enc_fs>, 
<&combined_tifs_cfg_fs>,
+   <&combined_dm_cfg_fs>, <&sysfw_inner_cert_fs>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl_fs>;
+   content-sysfw = <&ti_f

[PATCH v7 14/23] am62: yaml: Add board configs for AM62

2023-07-14 Thread Neha Malcom Francis
Added YAML configs for AM62

Signed-off-by: Neha Malcom Francis 
---
 board/ti/am62x/board-cfg.yaml |   36 ++
 board/ti/am62x/pm-cfg.yaml|   12 +
 board/ti/am62x/rm-cfg.yaml| 1088 +
 board/ti/am62x/sec-cfg.yaml   |  379 
 4 files changed, 1515 insertions(+)
 create mode 100644 board/ti/am62x/board-cfg.yaml
 create mode 100644 board/ti/am62x/pm-cfg.yaml
 create mode 100644 board/ti/am62x/rm-cfg.yaml
 create mode 100644 board/ti/am62x/sec-cfg.yaml

diff --git a/board/ti/am62x/board-cfg.yaml b/board/ti/am62x/board-cfg.yaml
new file mode 100644
index 00..36cfb550ad
--- /dev/null
+++ b/board/ti/am62x/board-cfg.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM62
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x0
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
diff --git a/board/ti/am62x/pm-cfg.yaml b/board/ti/am62x/pm-cfg.yaml
new file mode 100644
index 00..5d04cf82ef
--- /dev/null
+++ b/board/ti/am62x/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM62
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/am62x/rm-cfg.yaml b/board/ti/am62x/rm-cfg.yaml
new file mode 100644
index 00..c28707be8e
--- /dev/null
+++ b/board/ti/am62x/rm-cfg.yaml
@@ -0,0 +1,1088 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for AM62
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 12
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 30
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 36
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #5
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #6
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #7
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #8
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #9
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0

[PATCH v7 15/23] am625: dts: binman: Package tiboot3.bin, tispl.bin and u-boot.img

2023-07-14 Thread Neha Malcom Francis
Support added for HS-SE, HS-FS and GP boot binaries for AM62.

HS-SE:
* tiboot3-am62x-hs-evm.bin
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-am62x-hs-fs-evm.bin
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-am62x-gp-evm.bin
* tispl.bin_unsigned
* u-boot.img_unsigned

It is to be noted that the bootflow followed by AM62 requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-am625-r5-sk.dts  |   1 +
 arch/arm/dts/k3-am625-sk-binman.dtsi | 463 +++
 arch/arm/dts/k3-am625-sk-u-boot.dtsi |   2 +
 board/ti/am62x/Kconfig   |   2 +
 4 files changed, 468 insertions(+)
 create mode 100644 arch/arm/dts/k3-am625-sk-binman.dtsi

diff --git a/arch/arm/dts/k3-am625-r5-sk.dts b/arch/arm/dts/k3-am625-r5-sk.dts
index 78df7cec3f..3ec5bad735 100644
--- a/arch/arm/dts/k3-am625-r5-sk.dts
+++ b/arch/arm/dts/k3-am625-r5-sk.dts
@@ -9,6 +9,7 @@
 #include "k3-am62-ddr.dtsi"
 
 #include "k3-am625-sk-u-boot.dtsi"
+#include "k3-am625-sk-binman.dtsi"
 
 / {
aliases {
diff --git a/arch/arm/dts/k3-am625-sk-binman.dtsi 
b/arch/arm/dts/k3-am625-sk-binman.dtsi
new file mode 100644
index 00..5bdf685c20
--- /dev/null
+++ b/arch/arm/dts/k3-am625-sk-binman.dtsi
@@ -0,0 +1,463 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_AM625_R5_EVM
+
+&binman {
+   tiboot3-am62x-hs-evm.bin {
+   filename = "tiboot3-am62x-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>, <&ti_fs_enc>, 
<&combined_tifs_cfg>,
+   <&combined_dm_cfg>, <&sysfw_inner_cert>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl>;
+   content-sysfw = <&ti_fs_enc>;
+   content-sysfw-data = <&combined_tifs_cfg>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert>;
+   content-dm-data = <&combined_dm_cfg>;
+   load = <0x43c0>;
+   load-sysfw = <0x4>;
+   load-sysfw-data = <0x67000>;
+   load-dm-data = <0x43c3a800>;
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   ti_fs_enc: ti-fs-enc.bin {
+   filename = "ti-sysfw/ti-fs-firmware-am62x-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_tifs_cfg: combined-tifs-cfg.bin {
+   filename = "combined-tifs-cfg.bin";
+   type = "blob-ext";
+   };
+   sysfw_inner_cert: sysfw-inner-cert {
+   filename = "ti-sysfw/ti-fs-firmware-am62x-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_dm_cfg: combined-dm-cfg.bin {
+   filename = "combined-dm-cfg.bin";
+   type = "blob-ext";
+   };
+   };
+};
+
+&binman {
+   tiboot3-am62x-hs-fs-evm.bin {
+   filename = "tiboot3-am62x-hs-fs-evm.bin";
+   symlink = "tiboot3.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl_fs>, <&ti_fs_enc_fs>, 
<&combined_tifs_cfg_fs>,
+   <&combined_dm_cfg_fs>, <&sysfw_inner_cert_fs>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl_fs>;
+   content-sysfw = <&ti_fs_enc_fs>;
+   content-sysfw-data = <&combined_tifs_cfg_fs>;
+   content-sysfw-in

[PATCH v7 16/23] am62a: yaml: Add board configs for AM62ax

2023-07-14 Thread Neha Malcom Francis
Added YAML configs for AM62ax

Signed-off-by: Neha Malcom Francis 
---
 board/ti/am62ax/board-cfg.yaml   |   36 +
 board/ti/am62ax/pm-cfg.yaml  |   12 +
 board/ti/am62ax/rm-cfg.yaml  | 1151 ++
 board/ti/am62ax/sec-cfg.yaml |  379 ++
 board/ti/am62ax/tifs-rm-cfg.yaml | 1011 ++
 5 files changed, 2589 insertions(+)
 create mode 100644 board/ti/am62ax/board-cfg.yaml
 create mode 100644 board/ti/am62ax/pm-cfg.yaml
 create mode 100644 board/ti/am62ax/rm-cfg.yaml
 create mode 100644 board/ti/am62ax/sec-cfg.yaml
 create mode 100644 board/ti/am62ax/tifs-rm-cfg.yaml

diff --git a/board/ti/am62ax/board-cfg.yaml b/board/ti/am62ax/board-cfg.yaml
new file mode 100644
index 00..4aa8ddd104
--- /dev/null
+++ b/board/ti/am62ax/board-cfg.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM62ax
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable : 0x5A
+main_isolation_hostid : 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor : 0x1
+scaling_profile : 0x1
+disable_main_nav_secure_proxy : 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size : 0x10
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables : 0x00
+trace_src_enables : 0x00
diff --git a/board/ti/am62ax/pm-cfg.yaml b/board/ti/am62ax/pm-cfg.yaml
new file mode 100644
index 00..3ad182ae17
--- /dev/null
+++ b/board/ti/am62ax/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM62ax
+#
+
+---
+
+pm-cfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
diff --git a/board/ti/am62ax/rm-cfg.yaml b/board/ti/am62ax/rm-cfg.yaml
new file mode 100644
index 00..15c4017bda
--- /dev/null
+++ b/board/ti/am62ax/rm-cfg.yaml
@@ -0,0 +1,1151 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Resource management configuration for AM62ax
+#
+
+---
+
+rm-cfg:
+rm_boardcfg:
+rev:
+boardcfg_abi_maj : 0x0
+boardcfg_abi_min : 0x1
+host_cfg:
+subhdr:
+magic: 0x4C41
+size : 356
+host_cfg_entries:
+- #1
+host_id: 12
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #2
+host_id: 30
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #3
+host_id: 36
+allowed_atype : 0x2A
+allowed_qos : 0x
+allowed_orderid : 0x
+allowed_priority : 0x
+allowed_sched_priority : 0xAA
+- #4
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #5
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #6
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #7
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #8
+host_id: 0
+allowed_atype : 0
+allowed_qos : 0
+allowed_orderid : 0
+allowed_priority : 0
+allowed_sched_priority : 0
+- #9
+host_id: 0
+allowed_atype : 0

[PATCH v7 17/23] am62a: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img

2023-07-14 Thread Neha Malcom Francis
Support added for HS-SE, HS-FS and GP boot binaries for AM62ax.

HS-SE:
* tiboot3-am62ax-hs-evm.bin
* tispl.bin
* u-boot.img

HS-FS:
* tiboot3-am62ax-hs-fs-evm.bin
* tispl.bin
* u-boot.img

GP:
* tiboot3.bin --> tiboot3-am62ax-gp-evm.bin
* tispl.bin_unsigned
* u-boot.img_unsigned

It is to be noted that the bootflow followed by AM62ax requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
[a...@ti.com: changed output binary names appropriately]
Signed-off-by: Andrew Davis 
---
 arch/arm/dts/k3-am62a-sk-binman.dtsi | 466 +++
 arch/arm/dts/k3-am62a7-r5-sk.dts |   1 +
 arch/arm/dts/k3-am62a7-sk.dts|   1 +
 board/ti/am62ax/Kconfig  |   2 +
 4 files changed, 470 insertions(+)
 create mode 100644 arch/arm/dts/k3-am62a-sk-binman.dtsi

diff --git a/arch/arm/dts/k3-am62a-sk-binman.dtsi 
b/arch/arm/dts/k3-am62a-sk-binman.dtsi
new file mode 100644
index 00..a1c9ef6fa4
--- /dev/null
+++ b/arch/arm/dts/k3-am62a-sk-binman.dtsi
@@ -0,0 +1,466 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+
+#ifdef CONFIG_TARGET_AM62A7_R5_EVM
+
+&rcfg_yaml_tifs {
+   config = "tifs-rm-cfg.yaml";
+};
+
+&binman {
+   tiboot3-am62ax-hs-evm.bin {
+   filename = "tiboot3-am62ax-hs-evm.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl>, <&ti_fs_enc>, 
<&combined_tifs_cfg>,
+   <&combined_dm_cfg>, <&sysfw_inner_cert>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl>;
+   content-sysfw = <&ti_fs_enc>;
+   content-sysfw-data = <&combined_tifs_cfg>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert>;
+   content-dm-data = <&combined_dm_cfg>;
+   load = <0x43c0>;
+   load-sysfw = <0x4>;
+   load-sysfw-data = <0x67000>;
+   load-dm-data = <0x43c3a800>;
+   };
+   u_boot_spl: u-boot-spl {
+   no-expanded;
+   };
+   ti_fs_enc: ti-fs-enc.bin {
+   filename = "ti-sysfw/ti-fs-firmware-am62ax-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_tifs_cfg: combined-tifs-cfg.bin {
+   filename = "combined-tifs-cfg.bin";
+   type = "blob-ext";
+   };
+   sysfw_inner_cert: sysfw-inner-cert {
+   filename = "ti-sysfw/ti-fs-firmware-am62ax-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   combined_dm_cfg: combined-dm-cfg.bin {
+   filename = "combined-dm-cfg.bin";
+   type = "blob-ext";
+   };
+   };
+};
+
+&binman {
+   tiboot3-am62ax-hs-fs-evm.bin {
+   filename = "tiboot3-am62ax-hs-fs-evm.bin";
+   symlink = "tiboot3.bin";
+   ti-secure-rom {
+   content = <&u_boot_spl_fs>, <&ti_fs_enc_fs>, 
<&combined_tifs_cfg_fs>,
+   <&combined_dm_cfg_fs>, <&sysfw_inner_cert_fs>;
+   combined;
+   dm-data;
+   sysfw-inner-cert;
+   keyfile = "custMpk.pem";
+   sw-rev = <1>;
+   content-sbl = <&u_boot_spl_fs>;
+   content-sysfw = <&ti_fs_enc_fs>;
+   content-sysfw-data = <&combined_tifs_cfg_fs>;
+   content-sysfw-inner-cert = <&sysfw_inner_cert_fs>;
+   content-dm-data = <&combined_dm_cfg_fs>;
+   load = <0x43c0>;
+   load-sysfw = <0x4>;
+

[PATCH v7 18/23] arm: k3-am65x-iot2050: Use binman for tispl.bin for iot2050

2023-07-14 Thread Neha Malcom Francis
Move to using binman to generate tispl.bin which is used to generate the
final flash.bin bootloader for iot2050 boards.

Signed-off-by: Neha Malcom Francis 
Cc: Jan Kiszka 
Reviewed-by: Simon Glass 
---
 arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 75 +++-
 1 file changed, 74 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi 
b/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi
index 03ccc54329..4e14c0fb82 100644
--- a/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi
+++ b/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi
@@ -26,9 +26,82 @@
missing-msg = "iot2050-seboot";
};
 
-   blob@0x18 {
+   fit@0x18 {
offset = <0x18>;
filename = "tispl.bin";
+   pad-byte = <0xff>;
+   description = "Configuration to load ATF and SPL";
+
+   images {
+   atf {
+   description = "ARM Trusted Firmware";
+   type = "firmware";
+   arch = "arm64";
+   compression = "none";
+   os = "arm-trusted-firmware";
+   load = ;
+   entry = ;
+   atf: atf-bl31 {
+   };
+   };
+
+   tee {
+   description = "OPTEE";
+   type = "tee";
+   arch = "arm64";
+   compression = "none";
+   os = "tee";
+   load = <0x9e80>;
+   entry = <0x9e80>;
+   tee: tee-os {
+   };
+   };
+
+   dm {
+   description = "DM binary";
+   type = "firmware";
+   arch = "arm32";
+   compression = "none";
+   os = "DM";
+   load = <0x8900>;
+   entry = <0x8900>;
+   blob-ext {
+   filename = "/dev/null";
+   };
+   };
+
+   spl {
+   description = "SPL (64-bit)";
+   type = "standalone";
+   os = "U-Boot";
+   arch = "arm64";
+   compression = "none";
+   load = ;
+   entry = ;
+   u_boot_spl_nodtb: blob-ext {
+   filename = 
"spl/u-boot-spl-nodtb.bin";
+   };
+   };
+
+   fdt-0 {
+   description = "k3-am65-iot2050-spl.dtb";
+   type = "flat_dt";
+   arch = "arm";
+   compression = "none";
+   spl_am65x_evm_dtb: blob-ext {
+   filename = 
"spl/dts/k3-am65-iot2050-spl.dtb";
+   };
+   };
+   };
+
+   configurations {
+   default = "spl";
+   spl {
+   fdt = "fdt-0";
+   firmware = "atf";
+   loadables = "tee", "dm", "spl";
+   };
+   };
};
 
fit@0x38 {
-- 
2.34.1



[PATCH v7 19/23] k3: tools: config.mk: Update makefile and remove scripts

2023-07-14 Thread Neha Malcom Francis
Since binman is used to package bootloader images for all K3 devices, we
do not have to rely on the earlier methods to package them.

Scripts that were used to generate x509 certificate for tiboot3.bin and
generate tispl.bin, u-boot.img have been removed.

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
---
 arch/arm/mach-k3/config.mk | 103 ---
 tools/k3_fit_atf.sh| 123 -
 tools/k3_gen_x509_cert.sh  | 262 -
 3 files changed, 488 deletions(-)
 delete mode 100644 arch/arm/mach-k3/config.mk
 delete mode 100755 tools/k3_fit_atf.sh
 delete mode 100755 tools/k3_gen_x509_cert.sh

diff --git a/arch/arm/mach-k3/config.mk b/arch/arm/mach-k3/config.mk
deleted file mode 100644
index cbf9c10210..00
--- a/arch/arm/mach-k3/config.mk
+++ /dev/null
@@ -1,103 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Copyright (C) 2017-2018 Texas Instruments Incorporated - http://www.ti.com/
-#  Lokesh Vutla 
-
-ifdef CONFIG_SPL_BUILD
-
-# Openssl is required to generate x509 certificate.
-# Error out if openssl is not available.
-ifeq ($(shell which openssl),)
-$(error "No openssl in $(PATH), consider installing openssl")
-endif
-
-IMAGE_SIZE= $(shell cat $(obj)/u-boot-spl.bin | wc -c)
-MAX_SIZE= $(shell printf "%d" $(CONFIG_SYS_K3_MAX_DOWNLODABLE_IMAGE_SIZE))
-
-ifeq ($(CONFIG_SYS_K3_KEY), "")
-KEY=""
-# On HS use real key or warn if not available
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
-ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/keys/custMpk.pem),)
-KEY=$(TI_SECURE_DEV_PKG)/keys/custMpk.pem
-else
-$(warning "WARNING: signing key not found. Random key will NOT work on HS 
hardware!")
-endif
-endif
-else
-KEY=$(patsubst "%",$(srctree)/%,$(CONFIG_SYS_K3_KEY))
-endif
-
-# X509 SWRV default
-SWRV = $(CONFIG_K3_X509_SWRV)
-# On HS use SECDEV provided software revision or warn if not available
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
-ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/keys/swrv.txt),)
-SWRV= $(shell cat $(TI_SECURE_DEV_PKG)/keys/swrv.txt)
-else
-$(warning "WARNING: Software revision file not found. Default may not work on 
HS hardware.")
-endif
-endif
-
-# tiboot3.bin is mandated by ROM and ROM only supports R5 boot.
-# So restrict tiboot3.bin creation for CPU_V7R.
-ifdef CONFIG_CPU_V7R
-image_check: $(obj)/u-boot-spl.bin FORCE
-   @if [ $(IMAGE_SIZE) -gt $(MAX_SIZE) ]; then \
-   echo "===" >&2; \
-   echo "ERROR: Final Image too big. " >&2;\
-   echo "$< size = $(IMAGE_SIZE), max size = $(MAX_SIZE)" >&2; \
-   echo "===" >&2; \
-   exit 1; \
-   fi
-
-tiboot3.bin: image_check FORCE
-   $(srctree)/tools/k3_gen_x509_cert.sh -c 16 -b $(obj)/u-boot-spl.bin \
-   -o $@ -l $(CONFIG_SPL_TEXT_BASE) -r $(SWRV) -k 
$(KEY)
-
-INPUTS-y   += tiboot3.bin
-endif
-
-ifdef CONFIG_ARM64
-
-ifeq ($(CONFIG_SOC_K3_J721E),)
-export DM := /dev/null
-endif
-
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
-SPL_ITS := u-boot-spl-k3_HS.its
-$(SPL_ITS): export IS_HS=1
-INPUTS-y   += tispl.bin_HS
-INPUTS-y   += tispl.bin
-tispl.bin: $(obj)/u-boot-spl-nodtb.bin_HS $(patsubst 
%,$(obj)/dts/%.dtb_HS,$(subst ",,$(CONFIG_SPL_OF_LIST)))
-else
-SPL_ITS := u-boot-spl-k3.its
-INPUTS-y   += tispl.bin
-endif
-
-ifeq ($(CONFIG_SPL_OF_LIST),)
-LIST_OF_DTB := $(CONFIG_DEFAULT_DEVICE_TREE)
-else
-LIST_OF_DTB := $(CONFIG_SPL_OF_LIST)
-endif
-
-quiet_cmd_k3_mkits = MKITS   $@
-cmd_k3_mkits = \
-   $(srctree)/tools/k3_fit_atf.sh \
-   $(CONFIG_K3_ATF_LOAD_ADDR) \
-   $(patsubst %,$(obj)/dts/%.dtb,$(subst ",,$(LIST_OF_DTB))) > $@
-
-$(SPL_ITS): FORCE
-   $(call cmd,k3_mkits)
-endif
-
-else
-
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
-INPUTS-y   += u-boot.img_HS
-else
-INPUTS-y   += u-boot.img
-endif
-endif
-
-include $(srctree)/arch/arm/mach-k3/config_secure.mk
diff --git a/tools/k3_fit_atf.sh b/tools/k3_fit_atf.sh
deleted file mode 100755
index 7bc07ad074..00
--- a/tools/k3_fit_atf.sh
+++ /dev/null
@@ -1,123 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0+
-#
-# script to generate FIT image source for K3 Family boards with
-# ATF, OPTEE, SPL and multiple device trees (given on the command line).
-# Inspired from board/sunxi/mksunxi_fit_atf.sh
-#
-# usage: $0   [ [&2
-   ATF=/dev/null
-fi
-
-[ -z "$TEE" ] && TEE="bl32.bin"
-
-if [ ! -f $TEE ]; then
-   echo "WARNING OPTEE file $TEE NOT found, resulting might be 
non-functional" >&2
-   TEE=/dev/null
-fi
-
-[ -z "$DM" ] && DM="dm.bin"
-
-if [ ! -e $DM ]; then
-   echo "W

[PATCH v7 20/23] doc: board: ti: Update documentation for binman flow

2023-07-14 Thread Neha Malcom Francis
Earlier documentation specified builds for generating bootloader images
using an external TI repository k3-image-gen and core-secdev-k3. Modify
this to using the binman flow so that user understands how to build the
final boot images.

Signed-off-by: Neha Malcom Francis 
Reviewed-by: Simon Glass 
---
 doc/board/ti/am62x_sk.rst  |  54 +--
 doc/board/ti/j7200_evm.rst |  55 +--
 doc/board/ti/j721e_evm.rst |  58 +---
 doc/board/ti/k3.rst| 107 +
 4 files changed, 113 insertions(+), 161 deletions(-)

diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst
index 27d7b527c6..bf23022b95 100644
--- a/doc/board/ti/am62x_sk.rst
+++ b/doc/board/ti/am62x_sk.rst
@@ -90,9 +90,9 @@ Below is the pictorial representation of boot flow:
  |||--|---|>| Reset rls | |
  |||  |   | +---+ |
  ||  TIFS  |  |   |  :|
- ||Services|  |   | +---+ |
- |||<-|---|>|*ATF/OPTEE*| |
- |||  |   | +---+ |
+ ||Services|  |   | ++|
+ |||<-|---|>|*TF-A/OPTEE*||
+ |||  |   | ++|
  |||  |   |  :|
  |||  |   | +---+ |
  |||<-|---|>| *A53 SPL* | |
@@ -115,59 +115,57 @@ Below is the pictorial representation of boot flow:
 
 Sources:
 
-1. SYSFW:
-   Tree: git://git.ti.com/k3-image-gen/k3-image-gen.git
-   Branch: master
-
-2. ATF:
-   Tree: https://github.com/ARM-software/arm-trusted-firmware.git
+1. Trusted Firmware-A:
+   Tree: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/
Branch: master
 
-3. OPTEE:
+2. OPTEE:
Tree: https://github.com/OP-TEE/optee_os.git
Branch: master
 
-4. U-Boot:
+3. U-Boot:
Tree: https://source.denx.de/u-boot/u-boot
Branch: master
 
-5. TI Linux Firmware:
+4. TI Linux Firmware:
Tree: git://git.ti.com/processor-firmware/ti-linux-firmware.git
Branch: ti-linux-firmware
 
 Build procedure:
 
-1. ATF:
+1. Trusted Firmware-A:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make CROSS_COMPILE=aarch64-none-linux-gnu- ARCH=aarch64 PLAT=k3 
TARGET_BOARD=lite SPD=opteed
+ $ make CROSS_COMPILE=aarch64-none-linux-gnu- ARCH=aarch64 PLAT=k3 \
+TARGET_BOARD=lite SPD=opteed
 
 2. OPTEE:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make PLATFORM=k3 CFG_ARM64_core=y CROSS_COMPILE=arm-none-linux-gnueabihf- 
CROSS_COMPILE64=aarch64-none-linux-gnu-
+ $ make PLATFORM=k3 CFG_ARM64_core=y CROSS_COMPILE=arm-none-linux-gnueabihf- \
+CROSS_COMPILE64=aarch64-none-linux-gnu-
 
 3. U-Boot:
 
 * 3.1 R5:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- 
am62x_evm_r5_defconfig O=/tmp/r5
- $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=/tmp/r5
- $ cd 
- $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- SOC=am62x 
SBL=/tmp/r5/spl/u-boot-spl.bin SYSFW_PATH=/ti-sysfw/ti-fs-firmware-am62x-gp.bin
-
-Use the tiboot3.bin generated from last command
+ $ make ARCH=arm am62x_evm_r5_defconfig
+ $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- \
+BINMAN_INDIRS=
 
 * 3.2 A53:
 
-.. code-block:: text
+.. code-block:: bash
 
- $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- am62x_evm_a53_defconfig 
O=/tmp/a53
- $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- ATF=/build/k3/lite/release/bl31.bin TEE=/out/arm-plat-k3/core/tee-pager_v2.bin DM=/ti-dm/am62xx/ipc_echo_testb_mcu1_0_release_strip.xer5f 
O=/tmp/a53
+ $ make ARCH=arm am62x_evm_a53_defconfig
+ $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- \
+BL31=/build/k3/lite/release/bl31.bin \
+TEE=/out/arm-plat-k3/core/tee-raw.bin \
+BINMAN_INDIRS=
 
 Target Images
 --
@@ -214,7 +212,7 @@ Image formats:
 |   FIT HEADER  |
 | +---+ |
 | |   | |
-| |  A53 ATF  | |
+| | A53 TF-A  | |
 | +---+ |
 | |   | |
 | | A53 OPTEE | |
diff --git a/doc/board/ti/j7200_evm.rst b/doc/board/ti/j7200_evm.rst
index 0d3a526516..8f6d13ab8c 100644
--- a/doc/board/ti/j7200_evm.rst
+++ b/doc/board/ti/j7200_evm.rst
@@ -83,9 +83,9 @@ Below is the pictorial repres

[PATCH v7 21/23] binman: Overwrite symlink if it already exists

2023-07-14 Thread Neha Malcom Francis
From: Andrew Davis 

Without this re-building will fail with an error when trying to create
the symlink for the second time with an already exists error.

Signed-off-by: Andrew Davis 
[n-fran...@ti.com: Added support for test output dir and testcase]
Signed-off-by: Neha Malcom Francis 
---
 tools/binman/ftest.py | 18 --
 tools/binman/image.py |  2 ++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index f4bff50aaf..6280eb92c4 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -353,7 +353,7 @@ class TestFunctional(unittest.TestCase):
 use_expanded=False, verbosity=None, allow_missing=False,
 allow_fake_blobs=False, extra_indirs=None, threads=None,
 test_section_timeout=False, update_fdt_in_elf=None,
-force_missing_bintools='', ignore_missing=False):
+force_missing_bintools='', ignore_missing=False, 
output_dir=None):
 """Run binman with a given test file
 
 Args:
@@ -384,6 +384,7 @@ class TestFunctional(unittest.TestCase):
 update_fdt_in_elf: Value to pass with --update-fdt-in-elf=xxx
 force_missing_tools (str): comma-separated list of bintools to
 regard as missing
+output_dir: Specific output directory to use for image using -O
 
 Returns:
 int return code, 0 on success
@@ -430,6 +431,8 @@ class TestFunctional(unittest.TestCase):
 if extra_indirs:
 for indir in extra_indirs:
 args += ['-I', indir]
+if output_dir:
+args += ['-O', output_dir]
 return self._DoBinman(*args)
 
 def _SetupDtb(self, fname, outfile='u-boot.dtb'):
@@ -6113,7 +6116,7 @@ fdt fdtmapExtract the devicetree 
blob from the fdtmap
   str(e.exception))
 
 def testSymlink(self):
-"""Test that image files can be named"""
+"""Test that image files can be symlinked"""
 retcode = self._DoTestFile('259_symlink.dts', debug=True, map=True)
 self.assertEqual(0, retcode)
 image = control.images['test_image']
@@ -6122,6 +6125,17 @@ fdt fdtmapExtract the devicetree 
blob from the fdtmap
 self.assertTrue(os.path.islink(sname))
 self.assertEqual(os.readlink(sname), fname)
 
+def testSymlinkOverwrite(self):
+"""Test that symlinked images can be overwritten"""
+testdir = TestFunctional._MakeInputDir('symlinktest')
+self._DoTestFile('259_symlink.dts', debug=True, map=True, 
output_dir=testdir)
+# build the same image again in the same directory so that existing 
symlink is present
+self._DoTestFile('259_symlink.dts', debug=True, map=True, 
output_dir=testdir)
+fname = tools.get_output_filename('test_image.bin')
+sname = tools.get_output_filename('symlink_to_test.bin')
+self.assertTrue(os.path.islink(sname))
+self.assertEqual(os.readlink(sname), fname)
+
 def testSymbolsElf(self):
 """Test binman can assign symbols embedded in an ELF file"""
 if not elf.ELF_TOOLS:
diff --git a/tools/binman/image.py b/tools/binman/image.py
index 8ebf71d61a..e77b5d0d97 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -182,6 +182,8 @@ class Image(section.Entry_section):
 # Create symlink to file if symlink given
 if self._symlink is not None:
 sname = tools.get_output_filename(self._symlink)
+if os.path.islink(sname):
+os.remove(sname)
 os.symlink(fname, sname)
 
 def WriteMap(self):
-- 
2.34.1



[PATCH v7 22/23] buildman: Create a requirements.txt file

2023-07-14 Thread Neha Malcom Francis
From: Tom Rini 

At this point, buildman requires a few different modules and so we need
a requirements.txt to track what modules are needed.

Cc: Simon Glass 
Cc: Neha Malcom Francis 
Signed-off-by: Tom Rini 
Reviewed-by: Simon Glass 
Signed-off-by: Neha Malcom Francis 
---
 tools/buildman/requirements.txt | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 tools/buildman/requirements.txt

diff --git a/tools/buildman/requirements.txt b/tools/buildman/requirements.txt
new file mode 100644
index 00..a1efcb9d4b
--- /dev/null
+++ b/tools/buildman/requirements.txt
@@ -0,0 +1,2 @@
+jsonschema==4.17.3
+pyyaml==6.0
-- 
2.34.1



[PATCH v7 23/23] CI: Make use of buildman requirements.txt

2023-07-14 Thread Neha Malcom Francis
From: Tom Rini 

Now that buildman has a requirements.txt file we need to make use of it.

Signed-off-by: Tom Rini 
Reviewed-by: Simon Glass 
[n-fran...@ti.com: Adding missing command from .azure-pipelines.yml]
Signed-off-by: Neha Malcom Francis 
---
 .azure-pipelines.yml | 4 
 .gitlab-ci.yml   | 4 
 2 files changed, 8 insertions(+)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 06c46b681c..8626b27d4b 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -162,6 +162,7 @@ stages:
   virtualenv -p /usr/bin/python3 /tmp/venv
   . /tmp/venv/bin/activate
   pip install -r test/py/requirements.txt
+  pip install -r tools/buildman/requirements.txt
   export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl
   export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
   export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}
@@ -209,6 +210,7 @@ stages:
   git config --global --add safe.directory $(work_dir)
   export USER=azure
   pip install -r test/py/requirements.txt
+  pip install -r tools/buildman/requirements.txt
   pip install asteval pylint==2.12.2 pyopenssl
   export PATH=${PATH}:~/.local/bin
   echo "[MASTER]" >> .pylintrc
@@ -404,6 +406,7 @@ stages:
   if [ -n "${BUILD_ENV}" ]; then
   export ${BUILD_ENV};
   fi
+  pip install -r tools/buildman/requirements.txt
   tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e 
--board ${TEST_PY_BD} ${OVERRIDE}
   cp ~/grub_x86.efi ${UBOOT_TRAVIS_BUILD_DIR}/
   cp ~/grub_x64.efi ${UBOOT_TRAVIS_BUILD_DIR}/
@@ -583,6 +586,7 @@ stages:
   # make environment variables available as tests are running inside a 
container
   export BUILDMAN="${BUILDMAN}"
   git config --global --add safe.directory ${WORK_DIR}
+  pip install -r tools/buildman/requirements.txt
   EOF
   cat << "EOF" >> build.sh
   if [[ "${BUILDMAN}" != "" ]]; then
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cfd58513c3..07d8ba5ac2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -97,6 +97,7 @@ build all 32bit ARM platforms:
   script:
 - ret=0;
   git config --global --add safe.directory "${CI_PROJECT_DIR}";
+  pip install -r tools/buildman/requirements.txt;
   ./tools/buildman/buildman -o /tmp -PEWM arm -x aarch64 || ret=$?;
   if [[ $ret -ne 0 ]]; then
 ./tools/buildman/buildman -o /tmp -seP;
@@ -110,6 +111,7 @@ build all 64bit ARM platforms:
 - . /tmp/venv/bin/activate
 - ret=0;
   git config --global --add safe.directory "${CI_PROJECT_DIR}";
+  pip install -r tools/buildman/requirements.txt;
   ./tools/buildman/buildman -o /tmp -PEWM aarch64 || ret=$?;
   if [[ $ret -ne 0 ]]; then
 ./tools/buildman/buildman -o /tmp -seP;
@@ -208,6 +210,7 @@ Run binman, buildman, dtoc, Kconfig and patman testsuites:
   virtualenv -p /usr/bin/python3 /tmp/venv;
   . /tmp/venv/bin/activate;
   pip install -r test/py/requirements.txt;
+  pip install -r tools/buildman/requirements.txt;
   export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl;
   export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
   export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
@@ -240,6 +243,7 @@ Run pylint:
   script:
 - git config --global --add safe.directory "${CI_PROJECT_DIR}"
 - pip install -r test/py/requirements.txt
+- pip install -r tools/buildman/requirements.txt
 - pip install asteval pylint==2.12.2 pyopenssl
 - export PATH=${PATH}:~/.local/bin
 - echo "[MASTER]" >> .pylintrc
-- 
2.34.1



[PATCH v7 04/23] j721e: schema: yaml: Add general schema and J721E board config files

2023-07-14 Thread Neha Malcom Francis
Schema file in YAML must be provided in board/ti/common for validating
input config files and packaging system firmware. The schema includes
entries for rm-cfg, board-cfg, pm-cfg and sec-cfg.

Board config files must be provided in board/ti/ in YAML.
These can then be consumed for generation of binaries to package system
firmware. Added YAML configs for J721E in particular.

Signed-off-by: Tarun Sahu 
[n-fran...@ti.com: prepared patch for upstreaming]
Signed-off-by: Neha Malcom Francis 
---
 board/ti/common/schema.yaml   |  436 +
 board/ti/j721e/board-cfg.yaml |   36 +
 board/ti/j721e/pm-cfg.yaml|   12 +
 board/ti/j721e/rm-cfg.yaml| 3174 +
 board/ti/j721e/sec-cfg.yaml   |  380 
 5 files changed, 4038 insertions(+)
 create mode 100644 board/ti/common/schema.yaml
 create mode 100644 board/ti/j721e/board-cfg.yaml
 create mode 100644 board/ti/j721e/pm-cfg.yaml
 create mode 100644 board/ti/j721e/rm-cfg.yaml
 create mode 100644 board/ti/j721e/sec-cfg.yaml

diff --git a/board/ti/common/schema.yaml b/board/ti/common/schema.yaml
new file mode 100644
index 00..c8dd2e79e7
--- /dev/null
+++ b/board/ti/common/schema.yaml
@@ -0,0 +1,436 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Config schema for TI K3 devices
+#
+
+---
+
+definitions:
+u8:
+type: integer
+minimum: 0
+maximum: 0xff
+u16:
+type: integer
+minimum: 0
+maximum: 0x
+u32:
+type: integer
+minimum: 0
+maximum: 0x
+
+
+
+type: object
+properties:
+pm-cfg:
+type: object
+properties:
+rev:
+type: object
+properties:
+boardcfg_abi_maj:
+$ref: "#/definitions/u8"
+boardcfg_abi_min:
+$ref: "#/definitions/u8"
+board-cfg:
+type: object
+properties:
+rev:
+type: object
+properties:
+boardcfg_abi_maj:
+$ref: "#/definitions/u8"
+boardcfg_abi_min:
+$ref: "#/definitions/u8"
+control:
+type: object
+properties:
+subhdr:
+type: object
+properties:
+magic:
+$ref: "#/definitions/u16"
+size:
+$ref: "#/definitions/u16"
+main_isolation_enable:
+$ref: "#/definitions/u8"
+main_isolation_hostid:
+$ref: "#/definitions/u16"
+
+
+secproxy:
+type: object
+properties:
+subhdr:
+type: object
+properties:
+magic:
+$ref: "#/definitions/u16"
+size:
+$ref: "#/definitions/u16"
+scaling_factor:
+$ref: "#/definitions/u8"
+scaling_profile:
+$ref: "#/definitions/u8"
+disable_main_nav_secure_proxy:
+$ref: "#/definitions/u8"
+
+msmc:
+type: object
+properties:
+subhdr:
+type: object
+properties:
+magic:
+$ref: "#/definitions/u16"
+size:
+$ref: "#/definitions/u16"
+msmc_cache_size:
+$ref: "#/definitions/u8"
+debug_cfg:
+type: object
+properties:
+subhdr:
+type: object
+properties:
+magic:
+$ref: "#/definitions/u16"
+size:
+$ref: "#/definitions/u16"
+trace_dst_enables:
+$ref: "#/definitions/u16"
+trace_src_enables:
+$ref: "#/definitions/u16"
+
+sec-cfg:
+type: object
+properties:
+rev:
+type: object
+properties:
+boardcfg_abi_maj:
+$ref: "#/definitions/u8"
+boardcfg_abi_min:

Re: [PATCH v7 00/23] Migration to using binman for bootloader

2023-07-14 Thread Neha Malcom Francis

Hi Jerome

On 14/07/23 19:37, Jerome Forissier wrote:



On 7/14/23 15:50, Neha Malcom Francis wrote:

This series aims to eliminate the use of additional custom repositories
such as k3-image-gen (K3 Image Generation) repo and core-secdev-k3 (K3
Security Development Tools) that was plumbed into the U-Boot build flow
to generate boot images for TI K3 platform devices. And instead, we move
towards using binman that aligns better with the community standard build
flow.

This series uses binman for all K3 platforms supported on U-Boot currently;
both HS (High Security, both SE and FS) and GP (General Purpose) devices.

Background on using k3-image-gen:
* TI K3 devices require a SYSFW (System Firmware) image consisting
of a signed system firmware image and board configuration binaries,
this is needed to bring up system firmware during U-Boot R5 SPL
startup.
* Board configuration data contain board-specific information
such as resource management, power management and security.

Background on using core-secdev-k3:
* Contains resources to sign x509 certificates for HS devices

Series intends to use binman to take over the packaging and signing for
the R5 bootloader images tiboot3.bin (and sysfw.itb, for non-combined
boot flow) instead of k3-image-gen.

Series also packages the A72/A53 bootloader images (tispl.bin and
u-boot.img) using ATF, OPTEE and DM (Device Manager)

Changes in v7:
- corrected Texas Instruments copyright year
- k3-am65-iot2050 image fit@0x18 filename retained as
  tispl.bin

Changes in v6:
- addressed whitespace warnings
- added testcase for overwriting symlink functionality
- %s/Arm Trusted Firmware/Trusted Firmware-A
- %s/tee-pager_v2.bin/tee-raw.bin


I can still find quite a few occurrences of tee-pager_v2.bin in the patch
set (and in v7 too). Did you forget to change?

Another note applicable to several patches in v7:
'description = "OPTEE"' should be
'description = "OP-TEE"' (the official spelling has a hyphen).



Thanks for catching these, it was an oversight. Will change it.

--
Thanking You
Neha Malcom Francis


Re: [PATCH v7 05/23] j721e: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin, u-boot.img

2023-07-14 Thread Neha Malcom Francis

Hi Nishanth

On 15/07/23 11:44, Nishanth Menon wrote:

On 19:20-20230714, Neha Malcom Francis wrote:

Since you are going to respin anyways, I will complain about this:


+#ifdef CONFIG_TARGET_J721E_A72_EVM
+
+#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
+#define SPL_J721E_EVM_DTB "spl/dts/k3-j721e-common-proc-board.dtb"
+#define SPL_J721E_SK_DTB "spl/dts/k3-j721e-sk.dtb"
+
+#define UBOOT_NODTB "u-boot-nodtb.bin"
+#define J721E_EVM_DTB "arch/arm/dts/k3-j721e-common-proc-board.dtb"
+#define J721E_SK_DTB "arch/arm/dts/k3-j721e-sk.dtb"
+


I was trying to add beaglebone-ai64 support and discovered that this
messes the reuse of j721e-binman.dtsi for ai64. I am forced to introduce
j721e-sk.dtb - so why not just use SPL_NODTB SPL_J721E_BOARD_DTB,
UBOOT_NODTB J721E_EVM_BOARD_DTB (generic names) and drop the specific sk
stuff? And define the macros in the board.dtsi prior to including the
files?


I can do that, yes. Thanks for catching this.

--
Thanking You
Neha Malcom Francis


Re: [PATCH v7 05/23] j721e: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin, u-boot.img

2023-07-16 Thread Neha Malcom Francis

Hi Nishanth,

On 15/07/23 12:00, Neha Malcom Francis wrote:

Hi Nishanth

On 15/07/23 11:44, Nishanth Menon wrote:

On 19:20-20230714, Neha Malcom Francis wrote:

Since you are going to respin anyways, I will complain about this:


+#ifdef CONFIG_TARGET_J721E_A72_EVM
+
+#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
+#define SPL_J721E_EVM_DTB "spl/dts/k3-j721e-common-proc-board.dtb"
+#define SPL_J721E_SK_DTB "spl/dts/k3-j721e-sk.dtb"
+
+#define UBOOT_NODTB "u-boot-nodtb.bin"
+#define J721E_EVM_DTB "arch/arm/dts/k3-j721e-common-proc-board.dtb"
+#define J721E_SK_DTB "arch/arm/dts/k3-j721e-sk.dtb"
+


I was trying to add beaglebone-ai64 support and discovered that this
messes the reuse of j721e-binman.dtsi for ai64. I am forced to introduce
j721e-sk.dtb - so why not just use SPL_NODTB SPL_J721E_BOARD_DTB,
UBOOT_NODTB J721E_EVM_BOARD_DTB (generic names) and drop the specific sk
stuff? And define the macros in the board.dtsi prior to including the
files?


I can do that, yes. Thanks for catching this.



I'd like to just bring up that this would mean that the same A72 build and 
binaries will no longer work for both EVM and SK, rather will have to modify the 
CONFIG_DEFAULT_DEVICE_TREE for each. I am okay with this, but just putting it 
out there.


--
Thanking You
Neha Malcom Francis


Re: [PATCH v7 05/23] j721e: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin, u-boot.img

2023-07-17 Thread Neha Malcom Francis

Hi Nishanth

On 17/07/23 11:41, Neha Malcom Francis wrote:

Hi Nishanth,

On 15/07/23 12:00, Neha Malcom Francis wrote:

Hi Nishanth

On 15/07/23 11:44, Nishanth Menon wrote:

On 19:20-20230714, Neha Malcom Francis wrote:

Since you are going to respin anyways, I will complain about this:


+#ifdef CONFIG_TARGET_J721E_A72_EVM
+
+#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
+#define SPL_J721E_EVM_DTB "spl/dts/k3-j721e-common-proc-board.dtb"
+#define SPL_J721E_SK_DTB "spl/dts/k3-j721e-sk.dtb"
+
+#define UBOOT_NODTB "u-boot-nodtb.bin"
+#define J721E_EVM_DTB "arch/arm/dts/k3-j721e-common-proc-board.dtb"
+#define J721E_SK_DTB "arch/arm/dts/k3-j721e-sk.dtb"
+


I was trying to add beaglebone-ai64 support and discovered that this
messes the reuse of j721e-binman.dtsi for ai64. I am forced to introduce
j721e-sk.dtb - so why not just use SPL_NODTB SPL_J721E_BOARD_DTB,
UBOOT_NODTB J721E_EVM_BOARD_DTB (generic names) and drop the specific sk
stuff? And define the macros in the board.dtsi prior to including the
files?


I can do that, yes. Thanks for catching this.



I'd like to just bring up that this would mean that the same A72 build and 
binaries will no longer work for both EVM and SK, rather will have to modify the 
CONFIG_DEFAULT_DEVICE_TREE for each. I am okay with this, but just putting it 
out there.




An even better way would be to use the binman substitutions feature in FIT [1] 
to resolve both the beaglebone-ai64 not needing to have j721e-sk.dtb as well as 
continue having the same defconfig build supporting both J721E EVM as well as 
SK. I will work on this approach first.


[1] 
https://u-boot.readthedocs.io/en/latest/develop/package/entries.html#substitutions


--
Thanking You
Neha Malcom Francis


Re: [PATCH v7 00/23] Migration to using binman for bootloader

2023-07-17 Thread Neha Malcom Francis

Hi Maxime

On 17/07/23 18:19, Maxime Ripard wrote:

Hi,

On Fri, Jul 14, 2023 at 07:20:47PM +0530, Neha Malcom Francis wrote:

This series aims to eliminate the use of additional custom repositories
such as k3-image-gen (K3 Image Generation) repo and core-secdev-k3 (K3
Security Development Tools) that was plumbed into the U-Boot build flow
to generate boot images for TI K3 platform devices. And instead, we move
towards using binman that aligns better with the community standard build
flow.

This series uses binman for all K3 platforms supported on U-Boot currently;
both HS (High Security, both SE and FS) and GP (General Purpose) devices.

Background on using k3-image-gen:
* TI K3 devices require a SYSFW (System Firmware) image consisting
of a signed system firmware image and board configuration binaries,
this is needed to bring up system firmware during U-Boot R5 SPL
startup.
* Board configuration data contain board-specific information
such as resource management, power management and security.

Background on using core-secdev-k3:
* Contains resources to sign x509 certificates for HS devices

Series intends to use binman to take over the packaging and signing for
the R5 bootloader images tiboot3.bin (and sysfw.itb, for non-combined
boot flow) instead of k3-image-gen.

Series also packages the A72/A53 bootloader images (tispl.bin and
u-boot.img) using ATF, OPTEE and DM (Device Manager)


Tested-by: Maxime Ripard 



Thanks for testing!


It took a while to figure out that the tiboot3.bin file was for the
HS-FS variant now, while I was using a GP board.



Depends on the board, based on the commonly available boards tiboot3.bin is 
symlinked to either GP or HS-FS.



Maybe we should clarify that in the doc?


But yes, I will factor this into the docs.



Maxime


--
Thanking You
Neha Malcom Francis


Re: [PATCH v5 15/20] binman: Support simple templates

2023-07-19 Thread Neha Malcom Francis
ages {
atf {
ti-secure {
content = <&atf>;
keyfile = "key.pem";
};
atf: atf-bl31 {
};
};
};
};
};

ti-spl {
insert-template = <&ti_spl_template>;
fit {
images {
fdt-0 {
ti-secure {
content = <&foo_dtb>;
keyfile = "key.pem";
};
foo_dtb: blob-ext {
        filename = "foo.dtb";
};
};
};
};
};

The signing in the template node throws the error:
binman: Node '/binman/ti-spl/fit/images/atf/ti-secure': Cannot find entry for 
node 'atf-bl31'


I understand the phandle is not copied over. And I can work around this by 
moving the signing contents over to the target node instead of the template. But 
again, trying for least code duplication here; so any way around?


--
Thanking You
Neha Malcom Francis


Re: [PATCH 0/6] binman: Template fixes and improvements

2023-07-21 Thread Neha Malcom Francis

Hi Simon

On 21/07/23 21:37, Simon Glass wrote:

With the basic template feature in place, some problems have come to
light.

Firstly, keeping the template around while processing entries seems
unnecessary and perhaps confusing, so this is removed.

Secondly this series aims to support phandles in a more intuitive way,
rather than just ignoring them in templates. It includes an experimental
patch to copy phandles from template so that it is possible to so
something like:

template {
   some_node: some-node {
   };
};

image {
   insert-template = <&template>;
};

with the some_node phandle being copied to the 'image' node, to result in:

image {
   insert-template = <&template>;

   some_node: some-node {
   };
};




Thanks for this patch series! I will try using this.



Simon Glass (6):
   binman: Produce a template-file after processing
   dtoc: Make properties dirty when purging them
   dtoc: Add some debugging when copying nodes
   fdt: Allow copying phandles into templates
   binman: Remove templates after use
   WIP: binman: Support templates containing phandles

  tools/binman/binman.rst|  8 +++-
  tools/binman/control.py| 32 --
  tools/binman/ftest.py  | 31 +
  tools/binman/test/291_template_phandle.dts | 51 ++
  tools/dtoc/fdt.py  |  9 +++-
  tools/dtoc/test/dtoc_test_copy.dts |  6 ++-
  tools/dtoc/test_fdt.py | 34 ++-
  7 files changed, 153 insertions(+), 18 deletions(-)
  create mode 100644 tools/binman/test/291_template_phandle.dts



--
Thanking You
Neha Malcom Francis


[PATCH v8 00/23] Migration to using binman for bootloader

2023-07-21 Thread Neha Malcom Francis
This series aims to eliminate the use of additional custom repositories
such as k3-image-gen (K3 Image Generation) repo and core-secdev-k3 (K3
Security Development Tools) that was plumbed into the U-Boot build flow
to generate boot images for TI K3 platform devices. And instead, we move
towards using binman that aligns better with the community standard build
flow.

This series uses binman for all K3 platforms supported on U-Boot currently;
both HS (High Security, both SE and FS) and GP (General Purpose) devices.

Background on using k3-image-gen:
* TI K3 devices require a SYSFW (System Firmware) image consisting
of a signed system firmware image and board configuration binaries,
this is needed to bring up system firmware during U-Boot R5 SPL
startup.
* Board configuration data contain board-specific information
such as resource management, power management and security.

Background on using core-secdev-k3:
* Contains resources to sign x509 certificates for HS devices

Series intends to use binman to take over the packaging and signing for
the R5 bootloader images tiboot3.bin (and sysfw.itb, for non-combined
boot flow) instead of k3-image-gen.

Series also packages the A72/A53 bootloader images (tispl.bin and
u-boot.img) using TF-A, OP-TEE and DM (Device Manager)

Changes in v8:
- %s/tee-pager_v2.bin/tee-raw.bin missed in v7
- added AM65x doc
- %s/OPTEE/OP-TEE

Changes in v7:
- corrected Texas Instruments copyright year
- k3-am65-iot2050 image fit@0x18 filename retained as
  tispl.bin

Changes in v6:
- addressed whitespace warnings
- added testcase for overwriting symlink functionality
- %s/Arm Trusted Firmware/Trusted Firmware-A
- %s/tee-pager_v2.bin/tee-raw.bin

Changes in v5:
- updated all board configurations to latest
- changed output binary filenames
- fixed multiple certificate generation leading to packaging
  inconsistency in ti-secure*.py
- added patch to overwrite symlink if exists, patch 21/23
  ("binman: Overwrite symlink if it already exists")

Changes in v4:
- added support for iot2050
- documentation fixes
- move to using self.Raise in ti-board-config etype
- introduced common k3-binman.dtsi (further reduction in code
  duplication can be targeted, this as first step)

Changes in v3:
- added support for HS-FS devices
- added support for AM68-sk
- added back dropped documentation patch
- changed prefix for SYSFW and DM files to expected directory
  name
- extended test coverage to 100%
- documentation fixes
- corrected formatting changes

Changes in v2:
- removed all external scripts
- created ti-board-config etype to support generation of board
  config binaries
- created ti-secure and ti-secure-rom etypes to handle signing
  instead of using external TI_SECURE_DEV_PKG
- updated openssl btool to support x509 certificate generation
- dropped Makefile changes to obtain external binary components,
  moving to using BINMAN_INDIRS to achieve the same

CI/CD passes 100% (series based on -next) on v7 [1]
v8 was cosmetic changes but nevertheless, I have triggered CI/CD [2]

v1: 
https://patchwork.ozlabs.org/project/uboot/cover/20230120101903.179959-1-n-fran...@ti.com/
v2: 
https://patchwork.ozlabs.org/project/uboot/cover/20230404121342.446935-1-n-fran...@ti.com/
v3: 
https://patchwork.ozlabs.org/project/uboot/cover/20230421123203.1315330-1-n-fran...@ti.com/
 
v4: 
https://patchwork.ozlabs.org/project/uboot/cover/20230518142713.184164-1-n-fran...@ti.com/
v5: 
https://patchwork.ozlabs.org/project/uboot/cover/20230707123450.30329-1-n-fran...@ti.com/
v6: 
https://patchwork.ozlabs.org/project/uboot/cover/20230712183453.7623-1-n-fran...@ti.com/
v7: 
https://patchwork.ozlabs.org/project/uboot/cover/20230714135110.109928-1-n-fran...@ti.com/

[1] https://github.com/u-boot/u-boot/pull/363
[2] https://github.com/u-boot/u-boot/pull/391

Andrew Davis (1):
  binman: Overwrite symlink if it already exists

Neha Malcom Francis (20):
  binman: ti-board-config: Add support for TI board config binaries
  binman: ti-secure: Add support for TI signing
  arm: dts: k3: Add support for packaging sysfw.itb and tiboot3.bin
  j721e: schema: yaml: Add general schema and J721E board config files
  j721e: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin,
u-boot.img
  j7200: yaml: Add J7200 board config files
  j7200: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img
  am65x: yaml: Add AM65x board config files
  am65: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin,
u-boot.img
  am64x: yaml: Add board configs for AM64x
  am64x: dts: binman: Package tiboot3.bin, tispl.bin u-boot.img
  j721s2: yaml: Add board configs for J721S2
  j721s2: d

  1   2   3   4   5   6   7   >