[PATCH v4 03/19] configs: am64x: Enable EFI capsule update

2024-05-09 Thread Jonathan Humphreys
Enable on disk, raw capsule update.

Signed-off-by: Jonathan Humphreys 
---
 configs/am64x_evm_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am64x_evm_a53_defconfig b/configs/am64x_evm_a53_defconfig
index e000549d6d0..c9bdd7b54cc 100644
--- a/configs/am64x_evm_a53_defconfig
+++ b/configs/am64x_evm_a53_defconfig
@@ -178,3 +178,5 @@ CONFIG_USB_FUNCTION_MASS_STORAGE=y
 CONFIG_SPL_DFU=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v4 02/19] board: am64x: Define capsule update firmware info

2024-05-09 Thread Jonathan Humphreys
Define the firmware components updatable via EFI capsule update, including
defining capsule GUIDs for the various firmware components for the AM64x
SK.

Signed-off-by: Jonathan Humphreys 
---
 board/ti/am64x/evm.c| 32 
 include/configs/am64x_evm.h | 24 
 2 files changed, 56 insertions(+)

diff --git a/board/ti/am64x/evm.c b/board/ti/am64x/evm.c
index b8de69da06c..c30e9e064ec 100644
--- a/board/ti/am64x/evm.c
+++ b/board/ti/am64x/evm.c
@@ -7,6 +7,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -27,6 +28,37 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = AM64X_SK_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"AM64X_SK_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = AM64X_SK_SPL_IMAGE_GUID,
+   .fw_name = u"AM64X_SK_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = AM64X_SK_UBOOT_IMAGE_GUID,
+   .fw_name = u"AM64X_SK_UBOOT",
+   .image_index = 3,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "sf 0:0=tiboot3.bin raw 0 10;"
+   "tispl.bin raw 10 20;u-boot.img raw 30 40",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT))
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+
 int board_init(void)
 {
return 0;
diff --git a/include/configs/am64x_evm.h b/include/configs/am64x_evm.h
index f9f8c7bc2f6..9db83621ea8 100644
--- a/include/configs/am64x_evm.h
+++ b/include/configs/am64x_evm.h
@@ -9,6 +9,30 @@
 #ifndef __CONFIG_AM642_EVM_H
 #define __CONFIG_AM642_EVM_H
 
+/**
+ * define AM64X_SK_TIBOOT3_IMAGE_GUID - firmware GUID for AM64X sk tiboot3.bin
+ * define AM64X_SK_SPL_IMAGE_GUID - firmware GUID for AM64X sk SPL
+ * define AM64X_SK_UBOOT_IMAGE_GUID   - firmware GUID for AM64X sk UBOOT
+ *
+ * These GUIDs are used in capsules updates to identify the corresponding
+ * firmware object.
+ *
+ * Board developers using this as a starting reference should
+ * define their own GUIDs to ensure that firmware repositories (like
+ * LVFS) do not confuse them.
+ */
+#define AM64X_SK_TIBOOT3_IMAGE_GUID \
+   EFI_GUID(0xede0a0d5, 0x9116, 0x4bfb, 0xaa, 0x54, \
+   0x09, 0xe9, 0x7b, 0x5a, 0xfe, 0x1a)
+
+#define AM64X_SK_SPL_IMAGE_GUID \
+   EFI_GUID(0x77678f5c, 0x64d4, 0x4910, 0xad, 0x75, \
+   0x52, 0xc9, 0xd9, 0x5c, 0xdb, 0x1d)
+
+#define AM64X_SK_UBOOT_IMAGE_GUID \
+   EFI_GUID(0xc6ad43a9, 0x7d31, 0x4f5d, 0x83, 0xe9, \
+   0xb8, 0xef, 0xec, 0xae, 0x05, 0xbf)
+
 /* Now for the remaining common defines */
 #include 
 
-- 
2.34.1



[PATCH v4 07/19] doc: board: ti: j721e: document OSPI layout

2024-05-09 Thread Jonathan Humphreys
Updated OSPI flash layout diagram.

Signed-off-by: Jonathan Humphreys 
---
 doc/board/ti/img/ospi_sysfw.svg | 1464 +--
 doc/board/ti/j721e_evm.rst  |   58 +-
 2 files changed, 847 insertions(+), 675 deletions(-)

diff --git a/doc/board/ti/img/ospi_sysfw.svg b/doc/board/ti/img/ospi_sysfw.svg
index 648f6fd03e5..2a2fd3f4863 100644
--- a/doc/board/ti/img/ospi_sysfw.svg
+++ b/doc/board/ti/img/ospi_sysfw.svg
@@ -1,725 +1,897 @@
 
 
 
-

[PATCH v4 12/19] board: am62x: Define capsule update firmware info

2024-05-09 Thread Jonathan Humphreys
Define the firmware components updatable via EFI capsule update, including
defining capsule GUIDs for the various firmware components for the AM62x
SK.

Signed-off-by: Jonathan Humphreys 
---
 board/ti/am62x/evm.c| 32 
 include/configs/am62x_evm.h | 24 
 2 files changed, 56 insertions(+)

diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
index b3e8680dfab..72f7c90aca3 100644
--- a/board/ti/am62x/evm.c
+++ b/board/ti/am62x/evm.c
@@ -7,6 +7,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -46,6 +47,37 @@ int splash_screen_prepare(void)
 }
 #endif
 
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = AM62X_SK_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"AM62X_SK_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = AM62X_SK_SPL_IMAGE_GUID,
+   .fw_name = u"AM62X_SK_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = AM62X_SK_UBOOT_IMAGE_GUID,
+   .fw_name = u"AM62X_SK_UBOOT",
+   .image_index = 3,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "sf 0:0=tiboot3.bin raw 0 8;"
+   "tispl.bin raw 8 20;u-boot.img raw 28 40",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT))
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+
 int board_init(void)
 {
return 0;
diff --git a/include/configs/am62x_evm.h b/include/configs/am62x_evm.h
index c8fe59b7531..0d98f14a4bc 100644
--- a/include/configs/am62x_evm.h
+++ b/include/configs/am62x_evm.h
@@ -9,6 +9,30 @@
 #ifndef __CONFIG_AM625_EVM_H
 #define __CONFIG_AM625_EVM_H
 
+/**
+ * define AM62X_SK_TIBOOT3_IMAGE_GUID - firmware GUID for AM62X sk tiboot3.bin
+ * define AM62X_SK_SPL_IMAGE_GUID - firmware GUID for AM62X sk SPL
+ * define AM62X_SK_UBOOT_IMAGE_GUID   - firmware GUID for AM62X sk UBOOT
+ *
+ * These GUIDs are used in capsules updates to identify the corresponding
+ * firmware object.
+ *
+ * Board developers using this as a starting reference should
+ * define their own GUIDs to ensure that firmware repositories (like
+ * LVFS) do not confuse them.
+ */
+#define AM62X_SK_TIBOOT3_IMAGE_GUID \
+   EFI_GUID(0xabcb83d2, 0x9cb6, 0x4351, 0xb8, 0xf1, \
+   0x64, 0x94, 0xbb, 0xe3, 0x70, 0x0a)
+
+#define AM62X_SK_SPL_IMAGE_GUID \
+   EFI_GUID(0xaee355fc, 0xbf97, 0x4264, 0x8c, 0x82, \
+   0x43, 0x72, 0x55, 0xef, 0xdc, 0x1d)
+
+#define AM62X_SK_UBOOT_IMAGE_GUID \
+   EFI_GUID(0x28ab8c6c, 0xfca8, 0x41d3, 0x8e, 0xa1, \
+   0x5f, 0x17, 0x1b, 0x7d, 0x29, 0x29)
+
 /* Now for the remaining common defines */
 #include 
 
-- 
2.34.1



[PATCH v4 04/19] doc: board: ti: am64x: document OSPI layout

2024-05-09 Thread Jonathan Humphreys
Added OSPI flash layout diagram, as well as example commands to flash
firmware to it.

Signed-off-by: Jonathan Humphreys 
---
 doc/board/ti/am64x_evm.rst   |  24 +
 doc/board/ti/img/ospi_sysfw-am64.svg | 802 +++
 2 files changed, 826 insertions(+)
 create mode 100644 doc/board/ti/img/ospi_sysfw-am64.svg

diff --git a/doc/board/ti/am64x_evm.rst b/doc/board/ti/am64x_evm.rst
index 6ae35b3fee3..88997b6a283 100644
--- a/doc/board/ti/am64x_evm.rst
+++ b/doc/board/ti/am64x_evm.rst
@@ -140,6 +140,30 @@ Image formats:
 .. image:: img/nodm_tispl.bin.svg
   :alt: tispl.bin image format
 
+OSPI:
+-
+ROM supports booting from OSPI from offset 0x0.
+
+Flashing images to OSPI:
+
+Below commands can be used to download tiboot3.bin, tispl.bin, and u-boot.img,
+over tftp and then flash those to OSPI at their respective addresses.
+
+.. prompt:: bash =>
+
+  sf probe
+  tftp ${loadaddr} tiboot3.bin
+  sf update $loadaddr 0x0 $filesize
+  tftp ${loadaddr} tispl.bin
+  sf update $loadaddr 0x10 $filesize
+  tftp ${loadaddr} u-boot.img
+  sf update $loadaddr 0x30 $filesize
+
+Flash layout for OSPI:
+
+.. image:: img/ospi_sysfw-am64.svg
+  :alt: OSPI flash partition layout
+
 Switch Setting for Boot Mode
 
 
diff --git a/doc/board/ti/img/ospi_sysfw-am64.svg 
b/doc/board/ti/img/ospi_sysfw-am64.svg
new file mode 100644
index 000..f6244dce596
--- /dev/null
+++ b/doc/board/ti/img/ospi_sysfw-am64.svg
@@ -0,0 +1,802 @@
+
+
+
+

[PATCH v4 14/19] doc: board: ti: am62x: document OSPI layout

2024-05-09 Thread Jonathan Humphreys
Added OSPI flash layout diagram, as well as example commands to flash
firmware to it.

Signed-off-by: Jonathan Humphreys 
---
 doc/board/ti/am62x_sk.rst|  24 +
 doc/board/ti/img/ospi_sysfw2.svg | 802 +++
 2 files changed, 826 insertions(+)
 create mode 100644 doc/board/ti/img/ospi_sysfw2.svg

diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst
index b12dc85f06b..3655826a274 100644
--- a/doc/board/ti/am62x_sk.rst
+++ b/doc/board/ti/am62x_sk.rst
@@ -150,6 +150,30 @@ Image formats:
 .. image:: img/dm_tispl.bin.svg
   :alt: tispl.bin image format
 
+OSPI:
+-
+ROM supports booting from OSPI from offset 0x0.
+
+Flashing images to OSPI:
+
+Below commands can be used to download tiboot3.bin, tispl.bin, and u-boot.img,
+over tftp and then flash those to OSPI at their respective addresses.
+
+.. prompt:: bash =>
+
+  sf probe
+  tftp ${loadaddr} tiboot3.bin
+  sf update $loadaddr 0x0 $filesize
+  tftp ${loadaddr} tispl.bin
+  sf update $loadaddr 0x8 $filesize
+  tftp ${loadaddr} u-boot.img
+  sf update $loadaddr 0x28 $filesize
+
+Flash layout for OSPI:
+
+.. image:: img/ospi_sysfw2.svg
+  :alt: OSPI flash partition layout
+
 A53 SPL DDR Memory Layout
 -
 
diff --git a/doc/board/ti/img/ospi_sysfw2.svg b/doc/board/ti/img/ospi_sysfw2.svg
new file mode 100644
index 000..06711df4117
--- /dev/null
+++ b/doc/board/ti/img/ospi_sysfw2.svg
@@ -0,0 +1,802 @@
+
+
+
+

[PATCH v4 19/19] configs: beagleboneai64: Enable EFI capsule update

2024-05-09 Thread Jonathan Humphreys
Enable on disk, raw capsule update.

Signed-off-by: Jonathan Humphreys 
---
 configs/j721e_beagleboneai64_a72_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/j721e_beagleboneai64_a72_defconfig 
b/configs/j721e_beagleboneai64_a72_defconfig
index a354876f8c2..ead1d8389c6 100644
--- a/configs/j721e_beagleboneai64_a72_defconfig
+++ b/configs/j721e_beagleboneai64_a72_defconfig
@@ -172,3 +172,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x6163
 CONFIG_SPL_DFU=y
 CONFIG_LZO=y
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v4 06/19] configs: j721e: Enable EFI capsule update

2024-05-09 Thread Jonathan Humphreys
Enable on disk, raw capsule update.

Signed-off-by: Jonathan Humphreys 
---
 configs/j721e_evm_a72_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
index 3d8e9391987..e2c2ad27ef8 100644
--- a/configs/j721e_evm_a72_defconfig
+++ b/configs/j721e_evm_a72_defconfig
@@ -210,3 +210,5 @@ CONFIG_UFS=y
 CONFIG_CADENCE_UFS=y
 CONFIG_TI_J721E_UFS=y
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v4 01/19] doc: uefi: capsules: Add Capsule Update porting section

2024-05-09 Thread Jonathan Humphreys
Created a capsule update porting section in the documentation that outlines
the steps a board developer must do when porting from an existing reference
board implementation.

In particular, added a big warning that new capsule GUID's need to be
defined.

Signed-off-by: Jonathan Humphreys 
---
 doc/develop/uefi/uefi.rst | 12 
 1 file changed, 12 insertions(+)

diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst
index 0389b269c01..36ac75278fa 100644
--- a/doc/develop/uefi/uefi.rst
+++ b/doc/develop/uefi/uefi.rst
@@ -631,6 +631,18 @@ where version.dtso looks like::
 The properties of image-type-id and image-index must match the value
 defined in the efi_fw_image array as image_type_id and image_index.
 
+Porting Capsule Updates to new boards
+*
+
+It is important, when using a reference board as a starting point for a custom
+board, that certain steps are taken to properly support Capsule Updates.
+
+Capsule GUIDs need to be unique for each firmware and board. That is, if two
+firmwares are built from the same source but result in different binaries
+because they are built for different boards, they should have different GUIDs.
+Therefore it is important when creating support for a new board, new GUIDs are
+defined in the board's header file.  *DO NOT* reuse capsule GUIDs.
+
 Executing the boot manager
 ~~
 
-- 
2.34.1



[PATCH v4 18/19] board: beagleboneai64: Define capsule update firmware info

2024-05-09 Thread Jonathan Humphreys
Define the firmware components updatable via EFI capsule update, including
defining capsule GUIDs for the various firmware components for the
BeagleBoneAI64.

Note this involved creating BeagleBoneAI64's own beagleboneai64.h board
header file instead of reusing j721e_evm's.

Signed-off-by: Jonathan Humphreys 
---
 board/beagle/beagleboneai64/Kconfig  |  4 +-
 board/beagle/beagleboneai64/beagleboneai64.c | 37 +
 include/configs/beagleboneai64.h | 55 
 3 files changed, 94 insertions(+), 2 deletions(-)
 create mode 100644 include/configs/beagleboneai64.h

diff --git a/board/beagle/beagleboneai64/Kconfig 
b/board/beagle/beagleboneai64/Kconfig
index 7cfccf9baf0..0f21582614d 100644
--- a/board/beagle/beagleboneai64/Kconfig
+++ b/board/beagle/beagleboneai64/Kconfig
@@ -37,7 +37,7 @@ config SYS_VENDOR
default "beagle"
 
 config SYS_CONFIG_NAME
-   default "j721e_evm"
+   default "beagleboneai64"
 
 source "board/ti/common/Kconfig"
 
@@ -52,7 +52,7 @@ config SYS_VENDOR
default "beagle"
 
 config SYS_CONFIG_NAME
-   default "j721e_evm"
+   default "beagleboneai64"
 
 source "board/ti/common/Kconfig"
 
diff --git a/board/beagle/beagleboneai64/beagleboneai64.c 
b/board/beagle/beagleboneai64/beagleboneai64.c
index c5b4ff7df47..882298e1546 100644
--- a/board/beagle/beagleboneai64/beagleboneai64.c
+++ b/board/beagle/beagleboneai64/beagleboneai64.c
@@ -7,6 +7,7 @@
  * Copyright (C) 2022-2023 Robert Nelson, BeagleBoard.org Foundation
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -14,6 +15,42 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = BEAGLEBONEAI64_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"BEAGLEBONEAI64_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = BEAGLEBONEAI64_SPL_IMAGE_GUID,
+   .fw_name = u"BEAGLEBONEAI64_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = BEAGLEBONEAI64_UBOOT_IMAGE_GUID,
+   .fw_name = u"BEAGLEBONEAI64_UBOOT",
+   .image_index = 3,
+   },
+   {
+   .image_type_id = BEAGLEBONEAI64_SYSFW_IMAGE_GUID,
+   .fw_name = u"BEAGLEBONEAI64_SYSFW",
+   .image_index = 4,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "mmc 0=tiboot3.bin raw 0 2000 mmcpart 1;"
+   "tispl.bin fat 0 1;u-boot.img fat 0 1; sysfw.itb fat 0 1",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT))
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+
 int board_init(void)
 {
return 0;
diff --git a/include/configs/beagleboneai64.h b/include/configs/beagleboneai64.h
new file mode 100644
index 000..85d57248bb6
--- /dev/null
+++ b/include/configs/beagleboneai64.h
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Configuration header file for BeagleBoneAI64
+ *
+ * https://beagleboard.org/ai-64
+ *
+ * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#ifndef __CONFIG_BEAGLEBONEAI64_H
+#define __CONFIG_BEAGLEBONEAI64_H
+
+/* FLASH Configuration */
+#define CFG_SYS_FLASH_BASE 0x0
+
+/* SPL Loader Configuration */
+#define CFG_SYS_UBOOT_BASE 0x5008
+
+/**
+ * define BEAGLEBONEAI64_TIBOOT3_IMAGE_GUID - firmware GUID for BeagleBoneAI64
+ *tiboot3.bin
+ * define BEAGLEBONEAI64_SPL_IMAGE_GUID - firmware GUID for BeagleBoneAI64
+ *SPL
+ * define BEAGLEBONEAI64_UBOOT_IMAGE_GUID   - firmware GUID for BeagleBoneAI64
+ *UBOOT
+ * define BEAGLEBONEAI64_SYSFW_IMAGE_GUID   - firmware GUID for BeagleBoneAI64
+ *SYSFW
+ *
+ * These GUIDs are used in capsules updates to identify the corresponding
+ * firmware object.
+ *
+ * Board developers using this as a starting reference should
+ * define their own GUIDs to ensure that firmware repositories (like
+ * LVFS) do not confuse them.
+ */
+#define BEAGLEBONEAI64_TIBOOT3_IMAGE_GUID \
+   EFI_GUID(0x772a4810, 0x2194, 0x4923, 0x87, 0x54, \
+   0x01, 0x15, 0x87, 0x0e, 0xf3, 0x67)
+
+#define BEAGLEBONEAI64_SPL_IMAGE_GUID \
+   EFI_GUID(0x83447222, 0x1e26, 0x40cd, 0xa3, 0x95, \
+   0xb7, 0xde, 0x09, 0x57, 0xe8, 0x75)
+
+#define BEAGLEBONEAI64_UBOOT_IMAGE_GUID \
+   EFI_GUID(0x4249ff77, 0xc17d, 0x4eb7, 0xa1, 0xdb, \
+   0x45, 0xaa, 0x98, 0x87, 0xd4, 0x9e)
+
+#define BEAGLEBONEAI64_SYSFW_IMAGE_GUID \
+   EFI_GUID

[PATCH v4 08/19] board: beagleplay: Define capsule update firmware info

2024-05-09 Thread Jonathan Humphreys
Define the firmware components updatable via EFI capsule update, including
defining capsule GUIDs for the various firmware components for the
BeaglePlay.

Note this involved creating BeaglePlay's own beagleplay.h board header file
instead of reusing am62_evm's.

Signed-off-by: Jonathan Humphreys 
---
 board/beagle/beagleplay/Kconfig  |  4 +--
 board/beagle/beagleplay/beagleplay.c | 32 ++
 include/configs/beagleplay.h | 41 
 3 files changed, 75 insertions(+), 2 deletions(-)
 create mode 100644 include/configs/beagleplay.h

diff --git a/board/beagle/beagleplay/Kconfig b/board/beagle/beagleplay/Kconfig
index 7dbd833acb4..b0e67dc8ef3 100644
--- a/board/beagle/beagleplay/Kconfig
+++ b/board/beagle/beagleplay/Kconfig
@@ -35,7 +35,7 @@ config SYS_VENDOR
default "beagle"
 
 config SYS_CONFIG_NAME
-   default "am62x_evm"
+   default "beagleplay"
 
 source "board/ti/common/Kconfig"
 
@@ -50,7 +50,7 @@ config SYS_VENDOR
default "beagle"
 
 config SYS_CONFIG_NAME
-   default "am62x_evm"
+   default "beagleplay"
 
 config SPL_LDSCRIPT
default "arch/arm/mach-omap2/u-boot-spl.lds"
diff --git a/board/beagle/beagleplay/beagleplay.c 
b/board/beagle/beagleplay/beagleplay.c
index af36439e2e2..650a95553d6 100644
--- a/board/beagle/beagleplay/beagleplay.c
+++ b/board/beagle/beagleplay/beagleplay.c
@@ -6,6 +6,7 @@
  * Copyright (C) 2022-2023 Robert Nelson, BeagleBoard.org Foundation
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -15,6 +16,37 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = BEAGLEPLAY_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"BEAGLEPLAY_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = BEAGLEPLAY_SPL_IMAGE_GUID,
+   .fw_name = u"BEAGLEPLAY_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = BEAGLEPLAY_UBOOT_IMAGE_GUID,
+   .fw_name = u"BEAGLEPLAY_UBOOT",
+   .image_index = 3,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "mmc 0=tiboot3.bin raw 0 2000 mmcpart 1;"
+   "tispl.bin fat 0 1;u-boot.img fat 0 1",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT))
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+
 int board_init(void)
 {
return 0;
diff --git a/include/configs/beagleplay.h b/include/configs/beagleplay.h
new file mode 100644
index 000..4baeab664af
--- /dev/null
+++ b/include/configs/beagleplay.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Configuration header file for BeaglePlay
+ *
+ * https://beagleplay.org/
+ *
+ * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#ifndef __CONFIG_BEAGLEPLAY_H
+#define __CONFIG_BEAGLEPLAY_H
+
+/**
+ * define BEAGLEPLAY_TIBOOT3_IMAGE_GUID - firmware GUID for BeaglePlay
+ *tiboot3.bin
+ * define BEAGLEPLAY_SPL_IMAGE_GUID - firmware GUID for BeaglePlay SPL
+ * define BEAGLEPLAY_UBOOT_IMAGE_GUID   - firmware GUID for BeaglePlay UBOOT
+ *
+ * These GUIDs are used in capsules updates to identify the corresponding
+ * firmware object.
+ *
+ * Board developers using this as a starting reference should
+ * define their own GUIDs to ensure that firmware repositories (like
+ * LVFS) do not confuse them.
+ */
+#define BEAGLEPLAY_TIBOOT3_IMAGE_GUID \
+   EFI_GUID(0x0e225a09, 0xf720, 0x4d57, 0x91, 0x20, \
+   0xe2, 0x8f, 0x73, 0x7f, 0x5a, 0x5e)
+
+#define BEAGLEPLAY_SPL_IMAGE_GUID \
+   EFI_GUID(0xb2e7cc49, 0x1a5a, 0x4036, 0xae, 0x01, \
+   0x33, 0x87, 0xc3, 0xbe, 0xf6, 0x57)
+
+#define BEAGLEPLAY_UBOOT_IMAGE_GUID \
+   EFI_GUID(0x92c92b11, 0xa7ee, 0x486f, 0xaa, 0xa2, \
+   0x71, 0x3d, 0x84, 0x42, 0x5b, 0x0e)
+
+/* Now for the remaining common defines */
+#include 
+
+#endif /* __CONFIG_BEAGLEPLAY_H */
-- 
2.34.1



[PATCH v4 05/19] board: j721e: Define capsule update firmware info

2024-05-09 Thread Jonathan Humphreys
Define the firmware components updatable via EFI capsule update, including
defining capsule GUIDs for the various firmware components for the
SK-TDA4VM.

Signed-off-by: Jonathan Humphreys 
---
 board/ti/j721e/evm.c| 38 +
 include/configs/j721e_evm.h | 29 
 2 files changed, 67 insertions(+)

diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index 539eaf47186..e4fa90e11e9 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -7,6 +7,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -32,6 +33,43 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = J721E_SK_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"J721E_SK_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = J721E_SK_SPL_IMAGE_GUID,
+   .fw_name = u"J721E_SK_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = J721E_SK_UBOOT_IMAGE_GUID,
+   .fw_name = u"J721E_SK_UBOOT",
+   .image_index = 3,
+   },
+   {
+   .image_type_id = J721E_SK_SYSFW_IMAGE_GUID,
+   .fw_name = u"J721E_SK_SYSFW",
+   .image_index = 4,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "sf 0:0=tiboot3.bin raw 0 8;"
+   "tispl.bin raw 8 20;u-boot.img raw 28 40;"
+   "sysfw.itb raw 6C 10",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT))
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+
 int board_init(void)
 {
return 0;
diff --git a/include/configs/j721e_evm.h b/include/configs/j721e_evm.h
index c26438c8684..a5140ea6a11 100644
--- a/include/configs/j721e_evm.h
+++ b/include/configs/j721e_evm.h
@@ -22,6 +22,35 @@
 #define CFG_SYS_UBOOT_BASE 0x5008
 #endif
 
+/**
+ * define J721E_SK_TIBOOT3_IMAGE_GUID - firmware GUID for J721e sk tiboot3.bin
+ * define J721E_SK_SPL_IMAGE_GUID - firmware GUID for J721e sk SPL
+ * define J721E_SK_UBOOT_IMAGE_GUID   - firmware GUID for J721e sk UBOOT
+ * define J721E_SK_SYSFW_IMAGE_GUID   - firmware GUID for J721e sk SYSFW
+ *
+ * These GUIDs are used in capsules updates to identify the corresponding
+ * firmware object.
+ *
+ * Board developers using this as a starting reference should
+ * define their own GUIDs to ensure that firmware repositories (like
+ * LVFS) do not confuse them.
+ */
+#define J721E_SK_TIBOOT3_IMAGE_GUID \
+   EFI_GUID(0xe672b518, 0x7cd7, 0x4014, 0xbd, 0x8d, \
+0x40, 0x72, 0x4d, 0x0a, 0xd4, 0xdc)
+
+#define J721E_SK_SPL_IMAGE_GUID \
+   EFI_GUID(0x86f710ad, 0x10cf, 0x46ea, 0xac, 0x67, \
+0x85, 0x6a, 0xe0, 0x6e, 0xfa, 0xd2)
+
+#define J721E_SK_UBOOT_IMAGE_GUID \
+   EFI_GUID(0x81b58fb0, 0x3b00, 0x4add, 0xa2, 0x0a, \
+0xc1, 0x85, 0xbb, 0xac, 0xa1, 0xed)
+
+#define J721E_SK_SYSFW_IMAGE_GUID \
+   EFI_GUID(0x6fd10680, 0x361b, 0x431f, 0x80, 0xaa, \
+0x89, 0x94, 0x55, 0x81, 0x9e, 0x11)
+
 /* Now for the remaining common defines */
 #include 
 
-- 
2.34.1



[PATCH v4 10/19] configs: beagleplay: Enable EFI capsule update

2024-05-09 Thread Jonathan Humphreys
Enable on disk, raw capsule update.

Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_beagleplay_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am62x_beagleplay_a53_defconfig 
b/configs/am62x_beagleplay_a53_defconfig
index 933baba9211..ef7d81b5379 100644
--- a/configs/am62x_beagleplay_a53_defconfig
+++ b/configs/am62x_beagleplay_a53_defconfig
@@ -124,3 +124,5 @@ CONFIG_EXT4_WRITE=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_LZO=y
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v4 09/19] configs: beagleplay: Enable DFU for MMC

2024-05-09 Thread Jonathan Humphreys
MMC DFU is required for capsule updates.

Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_beagleplay_a53_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/am62x_beagleplay_a53_defconfig 
b/configs/am62x_beagleplay_a53_defconfig
index 4f1be1df593..933baba9211 100644
--- a/configs/am62x_beagleplay_a53_defconfig
+++ b/configs/am62x_beagleplay_a53_defconfig
@@ -70,6 +70,9 @@ CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
 CONFIG_CLK_TI_SCI=y
+CONFIG_DFU_MMC=y
+CONFIG_SYS_DFU_DATA_BUF_SIZE=0x4
+CONFIG_SYS_DFU_MAX_FILE_SIZE=0x18
 CONFIG_DMA_CHANNELS=y
 CONFIG_TI_K3_NAVSS_UDMA=y
 CONFIG_TI_SCI_PROTOCOL=y
-- 
2.34.1



[PATCH v4 00/19] EFI: ti: Enable EFI capsule updates

2024-05-09 Thread Jonathan Humphreys
Enable on disk capsule updates, which includes defining the firmware
components (tiboot3, spl, u-boot) and enabling processing of raw capsule
updates.

This is enabled for several TI SoC based platforms: AM64, AM62, AM62p,
BeaglePlay, J7, and BeagleboneAI.

This series also includes enabling seral flash DFU for AM62 and MMC DFU for
beagleplay.

Changes from v1:
- Added sysfw.itb capsule definition to beagleboneai64
- removed extra commas in structure definitions

Changes from v2:
- Added documentation on OSPI flash layouts
- Improved comments for capsule GUIDs definitions
- Defined board unique capsule GUIDs and put definitions in board specific
  files
- Added a Capsule Update porting section to the documentation

Changes from v3:
- Added better commit messages based upon checkpatch warnings.
- Remove conditional inclusion of capsule update firmware info
- Converted OSPI layout diagram to svg format
Link to v3: https://lore.kernel.org/r/20240419205701.163821-1-j-humphr...@ti.com

Jonathan Humphreys (19):
  doc: uefi: capsules: Add Capsule Update porting section
  board: am64x: Define capsule update firmware info
  configs: am64x: Enable EFI capsule update
  doc: board: ti: am64x: document OSPI layout
  board: j721e: Define capsule update firmware info
  configs: j721e: Enable EFI capsule update
  doc: board: ti: j721e: document OSPI layout
  board: beagleplay: Define capsule update firmware info
  configs: beagleplay: Enable DFU for MMC
  configs: beagleplay: Enable EFI capsule update
  configs: am62x: Enable serial flash DFU
  board: am62x: Define capsule update firmware info
  configs: am62x: Enable EFI capsule update
  doc: board: ti: am62x: document OSPI layout
  board: am62px: Define capsule update firmware info
  configs: am62px: Enable EFI capsule update
  doc: board: ti: am62px: document OSPI layout
  board: beagleboneai64: Define capsule update firmware info
  configs: beagleboneai64: Enable EFI capsule update

 board/beagle/beagleboneai64/Kconfig  |4 +-
 board/beagle/beagleboneai64/beagleboneai64.c |   37 +
 board/beagle/beagleplay/Kconfig  |4 +-
 board/beagle/beagleplay/beagleplay.c |   32 +
 board/ti/am62px/evm.c|   32 +
 board/ti/am62x/evm.c |   32 +
 board/ti/am64x/evm.c |   32 +
 board/ti/j721e/evm.c |   38 +
 configs/am62px_evm_a53_defconfig |2 +
 configs/am62x_beagleplay_a53_defconfig   |5 +
 configs/am62x_evm_a53_defconfig  |3 +
 configs/am64x_evm_a53_defconfig  |2 +
 configs/j721e_beagleboneai64_a72_defconfig   |2 +
 configs/j721e_evm_a72_defconfig  |2 +
 doc/board/ti/am62px_sk.rst   |   24 +
 doc/board/ti/am62x_sk.rst|   24 +
 doc/board/ti/am64x_evm.rst   |   24 +
 doc/board/ti/img/ospi_sysfw-am64.svg |  802 ++
 doc/board/ti/img/ospi_sysfw.svg  | 1464 ++
 doc/board/ti/img/ospi_sysfw2.svg |  802 ++
 doc/board/ti/j721e_evm.rst   |   58 +-
 doc/develop/uefi/uefi.rst|   12 +
 include/configs/am62px_evm.h |   24 +
 include/configs/am62x_evm.h  |   24 +
 include/configs/am64x_evm.h  |   24 +
 include/configs/beagleboneai64.h |   55 +
 include/configs/beagleplay.h |   41 +
 include/configs/j721e_evm.h  |   29 +
 28 files changed, 2955 insertions(+), 679 deletions(-)
 create mode 100644 doc/board/ti/img/ospi_sysfw-am64.svg
 create mode 100644 doc/board/ti/img/ospi_sysfw2.svg
 create mode 100644 include/configs/beagleboneai64.h
 create mode 100644 include/configs/beagleplay.h

-- 
2.34.1



[PATCH v4 15/19] board: am62px: Define capsule update firmware info

2024-05-09 Thread Jonathan Humphreys
Define the firmware components updatable via EFI capsule update, including
defining capsule GUIDs for the various firmware components for the AM62px
SK.

Signed-off-by: Jonathan Humphreys 
---
 board/ti/am62px/evm.c| 32 
 include/configs/am62px_evm.h | 24 
 2 files changed, 56 insertions(+)

diff --git a/board/ti/am62px/evm.c b/board/ti/am62px/evm.c
index 97a95ce8cc2..6d0f66e5dc0 100644
--- a/board/ti/am62px/evm.c
+++ b/board/ti/am62px/evm.c
@@ -6,6 +6,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -13,6 +14,37 @@
 #include 
 #include 
 
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = AM62PX_SK_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"AM62PX_SK_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = AM62PX_SK_SPL_IMAGE_GUID,
+   .fw_name = u"AM62PX_SK_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = AM62PX_SK_UBOOT_IMAGE_GUID,
+   .fw_name = u"AM62PX_SK_UBOOT",
+   .image_index = 3,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "sf 0:0=tiboot3.bin raw 0 8;"
+   "tispl.bin raw 8 20;u-boot.img raw 28 40",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT))
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+
 int board_init(void)
 {
return 0;
diff --git a/include/configs/am62px_evm.h b/include/configs/am62px_evm.h
index 06b12860e21..57a1ba9dc3c 100644
--- a/include/configs/am62px_evm.h
+++ b/include/configs/am62px_evm.h
@@ -8,6 +8,30 @@
 #ifndef __CONFIG_AM62PX_EVM_H
 #define __CONFIG_AM62PX_EVM_H
 
+/**
+ * define AM62PX_SK_TIBOOT3_IMAGE_GUID - firmware GUID for AM62PX sk 
tiboot3.bin
+ * define AM62PX_SK_SPL_IMAGE_GUID - firmware GUID for AM62PX sk SPL
+ * define AM62PX_SK_UBOOT_IMAGE_GUID   - firmware GUID for AM62PX sk UBOOT
+ *
+ * These GUIDs are used in capsules updates to identify the corresponding
+ * firmware object.
+ *
+ * Board developers using this as a starting reference should
+ * define their own GUIDs to ensure that firmware repositories (like
+ * LVFS) do not confuse them.
+ */
+#define AM62PX_SK_TIBOOT3_IMAGE_GUID \
+   EFI_GUID(0xb08471b7, 0xbe2d, 0x4489, 0x87, 0xa1, \
+   0xca, 0xb2, 0x8a, 0x0c, 0xf7, 0x43)
+
+#define AM62PX_SK_SPL_IMAGE_GUID \
+   EFI_GUID(0xd02ed781, 0x6d71, 0x4c1a, 0xa9, 0x99, \
+   0x3c, 0x6a, 0x41, 0xc3, 0x63, 0x24)
+
+#define AM62PX_SK_UBOOT_IMAGE_GUID \
+   EFI_GUID(0x7e6aea51, 0x965c, 0x44ab, 0xb3, 0x88, \
+   0xda, 0xeb, 0x03, 0xb5, 0x4f, 0x66)
+
 /* Now for the remaining common defines */
 #include 
 
-- 
2.34.1



[PATCH v4 17/19] doc: board: ti: am62px: document OSPI layout

2024-05-09 Thread Jonathan Humphreys
Added OSPI flash layout diagram, as well as example commands to flash
firmware to it.

Signed-off-by: Jonathan Humphreys 
---
 doc/board/ti/am62px_sk.rst | 24 
 1 file changed, 24 insertions(+)

diff --git a/doc/board/ti/am62px_sk.rst b/doc/board/ti/am62px_sk.rst
index 1f2982c36f9..c80b5068117 100644
--- a/doc/board/ti/am62px_sk.rst
+++ b/doc/board/ti/am62px_sk.rst
@@ -156,6 +156,30 @@ Image formats:
 .. image:: img/dm_tispl.bin.svg
   :alt: tispl.bin image format
 
+OSPI:
+-
+ROM supports booting from OSPI from offset 0x0.
+
+Flashing images to OSPI:
+
+Below commands can be used to download tiboot3.bin, tispl.bin, and u-boot.img,
+over tftp and then flash those to OSPI at their respective addresses.
+
+.. prompt:: bash =>
+
+  sf probe
+  tftp ${loadaddr} tiboot3.bin
+  sf update $loadaddr 0x0 $filesize
+  tftp ${loadaddr} tispl.bin
+  sf update $loadaddr 0x8 $filesize
+  tftp ${loadaddr} u-boot.img
+  sf update $loadaddr 0x28 $filesize
+
+Flash layout for OSPI:
+
+.. image:: img/ospi_sysfw2.svg
+  :alt: OSPI flash partition layout
+
 A53 SPL DDR Memory Layout
 -
 
-- 
2.34.1



[PATCH v4 11/19] configs: am62x: Enable serial flash DFU

2024-05-09 Thread Jonathan Humphreys
Serial flash DFU is required by capsule updates.

Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_evm_a53_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig
index 6c708dcb052..515f23c2bcc 100644
--- a/configs/am62x_evm_a53_defconfig
+++ b/configs/am62x_evm_a53_defconfig
@@ -68,6 +68,7 @@ CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
 CONFIG_CLK_TI_SCI=y
+CONFIG_DFU_SF=y
 CONFIG_DMA_CHANNELS=y
 CONFIG_TI_K3_NAVSS_UDMA=y
 CONFIG_TI_SCI_PROTOCOL=y
-- 
2.34.1



[PATCH v4 13/19] configs: am62x: Enable EFI capsule update

2024-05-09 Thread Jonathan Humphreys
Enable on disk, raw capsule update.

Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_evm_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig
index 515f23c2bcc..1bc219666c1 100644
--- a/configs/am62x_evm_a53_defconfig
+++ b/configs/am62x_evm_a53_defconfig
@@ -112,3 +112,5 @@ CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v4 16/19] configs: am62px: Enable EFI capsule update

2024-05-09 Thread Jonathan Humphreys
Enable on disk, raw capsule update.

Signed-off-by: Jonathan Humphreys 
---
 configs/am62px_evm_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am62px_evm_a53_defconfig b/configs/am62px_evm_a53_defconfig
index 9f40c9a0b3c..7494148c88b 100644
--- a/configs/am62px_evm_a53_defconfig
+++ b/configs/am62px_evm_a53_defconfig
@@ -179,3 +179,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
 CONFIG_SPL_DFU=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v2 6/7] dts: am62x: binman: Include firmware capsules binman nodes

2024-04-19 Thread Jonathan Humphreys
Fill in the am62x SK's capsule GUID properties of the base binman capsule
nodes.

Signed-off-by: Jonathan Humphreys 
---
 arch/arm/dts/k3-am625-sk-binman.dtsi | 30 
 1 file changed, 30 insertions(+)

diff --git a/arch/arm/dts/k3-am625-sk-binman.dtsi 
b/arch/arm/dts/k3-am625-sk-binman.dtsi
index dfd38d64f63..eadfa398fa3 100644
--- a/arch/arm/dts/k3-am625-sk-binman.dtsi
+++ b/arch/arm/dts/k3-am625-sk-binman.dtsi
@@ -137,6 +137,17 @@
};
 };
 
+#include "k3-binman-capsule-r5.dtsi"
+
+// Capsule update GUIDs in string form.  See am62x_evm.h
+#define AM62X_SK_TIBOOT3_IMAGE_GUID_STR "abcb83d2-9cb6-4351-b8f1-6494bbe3700a"
+
+_tiboot3 {
+   efi-capsule {
+   image-guid = AM62X_SK_TIBOOT3_IMAGE_GUID_STR;
+   };
+};
+
 #endif
 
 #ifdef CONFIG_TARGET_AM625_A53_EVM
@@ -452,4 +463,23 @@
};
};
 };
+
+#include "k3-binman-capsule.dtsi"
+
+// Capsule update GUIDs in string form.  See am62x_evm.h
+#define AM62X_SK_SPL_IMAGE_GUID_STR "aee355fc-bf97-4264-8c82-437255efdc1d"
+#define AM62X_SK_UBOOT_IMAGE_GUID_STR "28ab8c6c-fca8-41d3-8ea1-5f171b7d2929"
+
+_tispl {
+   efi-capsule {
+   image-guid = AM62X_SK_SPL_IMAGE_GUID_STR;
+   };
+};
+
+_uboot {
+   efi-capsule {
+   image-guid = AM62X_SK_UBOOT_IMAGE_GUID_STR;
+   };
+};
+
 #endif
-- 
2.34.1



[PATCH v2 4/7] dts: beagleplay: binman: Include firmware capsules binman nodes

2024-04-19 Thread Jonathan Humphreys
Fill in the BeaglePlay's capsule GUID properties of the base binman capsule
nodes.

Signed-off-by: Jonathan Humphreys 
---
 arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi | 27 
 arch/arm/dts/k3-am625-r5-beagleplay.dts  | 15 +++
 2 files changed, 42 insertions(+)

diff --git a/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi 
b/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi
index fb2032068d1..f7c21a1f0e0 100644
--- a/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi
+++ b/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi
@@ -205,4 +205,31 @@
};
};
 };
+
+#include "k3-binman-capsule.dtsi"
+
+// Capsule update GUIDs in string form.  See beagleplay.h
+#define BEAGLEPLAY_SPL_IMAGE_GUID_STR "b2e7cc49-1a5a-4036-ae01-3387c3bef657"
+#define BEAGLEPLAY_UBOOT_IMAGE_GUID_STR "92c92b11-a7ee-486f-aaa2-713d84425b0e"
+
+_tispl {
+   efi-capsule {
+   image-guid = BEAGLEPLAY_SPL_IMAGE_GUID_STR;
+
+   blob {
+   filename = "tispl.bin_unsigned";
+   };
+   };
+};
+
+_uboot {
+   efi-capsule {
+   image-guid = BEAGLEPLAY_UBOOT_IMAGE_GUID_STR;
+
+   blob {
+   filename = "u-boot.img_unsigned";
+   };
+   };
+};
+
 #endif
diff --git a/arch/arm/dts/k3-am625-r5-beagleplay.dts 
b/arch/arm/dts/k3-am625-r5-beagleplay.dts
index 9db58f093c8..162d4800b17 100644
--- a/arch/arm/dts/k3-am625-r5-beagleplay.dts
+++ b/arch/arm/dts/k3-am625-r5-beagleplay.dts
@@ -114,3 +114,18 @@
 
};
 };
+
+#include "k3-binman-capsule-r5.dtsi"
+
+// Capsule update GUIDs in string form.  See beagleplay.h
+#define BEAGLEPLAY_TIBOOT3_IMAGE_GUID_STR 
"0e225a09-f720-4d57-9120-e28f737f5a5e"
+
+_tiboot3 {
+   efi-capsule {
+   image-guid = BEAGLEPLAY_TIBOOT3_IMAGE_GUID_STR;
+
+   blob {
+   filename = "tiboot3-am62x-gp-evm.bin";
+   };
+   };
+};
-- 
2.34.1



[PATCH v2 0/7] binman: ti: create binman nodes for EFI capsules

2024-04-19 Thread Jonathan Humphreys
Add binman nodes for EFI capsules of firmware components so that capsules are
automatically created during the UBoot builds.

This is enabled for several TI SoC based platforms: AM64, AM62, AM62p,
BeaglePlay, J7, and BeagleboneAI.

Changes from v1:
- on GP devices, still use signed images in capsules where available
- Insert board specific capsule GUIDs into the capsule node's image-guid.

Jonathan Humphreys (7):
  dts: ti: binman: Add base K3 firmware capsule nodes
  dts: am64x: binman: Include firmware capsules binman nodes
  dts: j721e: binman: Include firmware capsules binman nodes
  dts: beagleplay: binman: Include firmware capsules binman nodes
  dts: am62px: binman: Include firmware capsules binman nodes
  dts: am62x: binman: Include firmware capsules binman nodes
  dts: beagleboneai64: binman: Include firmware capsules binman nodes

 arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi  | 27 ++
 arch/arm/dts/k3-am625-r5-beagleplay.dts   | 15 ++
 arch/arm/dts/k3-am625-sk-binman.dtsi  | 30 
 arch/arm/dts/k3-am62p-sk-binman.dtsi  | 29 +++
 arch/arm/dts/k3-am64x-binman.dtsi | 30 
 arch/arm/dts/k3-binman-capsule-r5.dtsi| 21 
 arch/arm/dts/k3-binman-capsule.dtsi   | 38 ++
 .../dts/k3-j721e-beagleboneai64-u-boot.dtsi   | 23 +
 arch/arm/dts/k3-j721e-binman.dtsi | 49 +++
 arch/arm/dts/k3-j721e-r5-beagleboneai64.dts   | 29 +++
 10 files changed, 291 insertions(+)
 create mode 100644 arch/arm/dts/k3-binman-capsule-r5.dtsi
 create mode 100644 arch/arm/dts/k3-binman-capsule.dtsi

-- 
2.34.1



[PATCH v2 2/7] dts: am64x: binman: Include firmware capsules binman nodes

2024-04-19 Thread Jonathan Humphreys
Fill in the am64x SK's capsule GUID properties of the base binman capsule
nodes.

Signed-off-by: Jonathan Humphreys 
---
 arch/arm/dts/k3-am64x-binman.dtsi | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/arch/arm/dts/k3-am64x-binman.dtsi 
b/arch/arm/dts/k3-am64x-binman.dtsi
index 37817ba60d2..f768c4d946d 100644
--- a/arch/arm/dts/k3-am64x-binman.dtsi
+++ b/arch/arm/dts/k3-am64x-binman.dtsi
@@ -114,6 +114,17 @@
};
 };
 
+#include "k3-binman-capsule-r5.dtsi"
+
+// Capsule update GUIDs in string form.  See am64x_evm.h
+#define AM64X_SK_TIBOOT3_IMAGE_GUID_STR "ede0a0d5-9116-4bfb-aa54-09e97b5afe1a"
+
+_tiboot3 {
+   efi-capsule {
+   image-guid = AM64X_SK_TIBOOT3_IMAGE_GUID_STR;
+   };
+};
+
 #endif
 
 #ifdef CONFIG_TARGET_AM642_A53_EVM
@@ -373,4 +384,23 @@
};
};
 };
+
+#include "k3-binman-capsule.dtsi"
+
+// Capsule update GUIDs in string form.  See am64x_evm.h
+#define AM64X_SK_SPL_IMAGE_GUID_STR "77678f5c-64d4-4910-ad75-52c9d95cdb1d"
+#define AM64X_SK_UBOOT_IMAGE_GUID_STR "c6ad43a9-7d31-4f5d-83e9-b8efecae05bf"
+
+_tispl {
+   efi-capsule {
+   image-guid = AM64X_SK_SPL_IMAGE_GUID_STR;
+   };
+};
+
+_uboot {
+   efi-capsule {
+   image-guid = AM64X_SK_UBOOT_IMAGE_GUID_STR;
+   };
+};
+
 #endif
-- 
2.34.1



[PATCH v2 5/7] dts: am62px: binman: Include firmware capsules binman nodes

2024-04-19 Thread Jonathan Humphreys
Fill in the am62px SK's capsule GUID properties of the base binman capsule
nodes.

Signed-off-by: Jonathan Humphreys 
---
 arch/arm/dts/k3-am62p-sk-binman.dtsi | 29 
 1 file changed, 29 insertions(+)

diff --git a/arch/arm/dts/k3-am62p-sk-binman.dtsi 
b/arch/arm/dts/k3-am62p-sk-binman.dtsi
index dea14945bf5..3ec73022c60 100644
--- a/arch/arm/dts/k3-am62p-sk-binman.dtsi
+++ b/arch/arm/dts/k3-am62p-sk-binman.dtsi
@@ -59,6 +59,17 @@
};
 };
 
+#include "k3-binman-capsule-r5.dtsi"
+
+// Capsule update GUIDs in string form.  See am62px_evm.h
+#define AM62PX_SK_TIBOOT3_IMAGE_GUID_STR "b08471b7-be2d-4489-87a1-cab28a0cf743"
+
+_tiboot3 {
+   efi-capsule {
+   image-guid = AM62PX_SK_TIBOOT3_IMAGE_GUID_STR;
+   };
+};
+
 #endif /* CONFIG_TARGET_AM62P5_R5_EVM */
 
 #if IS_ENABLED(CONFIG_TARGET_AM62P5_A53_EVM)
@@ -170,4 +181,22 @@
};
 };
 
+#include "k3-binman-capsule.dtsi"
+
+// Capsule update GUIDs in string form.  See am62px_evm.h
+#define AM62PX_SK_SPL_IMAGE_GUID_STR "d02ed781-6d71-4c1a-a999-3c6a41c36324"
+#define AM62PX_SK_UBOOT_IMAGE_GUID_STR "7e6aea51-965c-44ab-b388-daeb03b54f66"
+
+_tispl {
+   efi-capsule {
+   image-guid = AM62PX_SK_SPL_IMAGE_GUID_STR;
+   };
+};
+
+_uboot {
+   efi-capsule {
+   image-guid = AM62PX_SK_UBOOT_IMAGE_GUID_STR;
+   };
+};
+
 #endif /* CONFIG_TARGET_AM62P5_A53_EVM */
-- 
2.34.1



[PATCH v2 1/7] dts: ti: binman: Add base K3 firmware capsule nodes

2024-04-19 Thread Jonathan Humphreys
Create capsule files for tiboot3.bin, tispl.bin, and u-boot.img.

Signed-off-by: Jonathan Humphreys 
---
 arch/arm/dts/k3-binman-capsule-r5.dtsi | 21 ++
 arch/arm/dts/k3-binman-capsule.dtsi| 38 ++
 2 files changed, 59 insertions(+)
 create mode 100644 arch/arm/dts/k3-binman-capsule-r5.dtsi
 create mode 100644 arch/arm/dts/k3-binman-capsule.dtsi

diff --git a/arch/arm/dts/k3-binman-capsule-r5.dtsi 
b/arch/arm/dts/k3-binman-capsule-r5.dtsi
new file mode 100644
index 000..959ceb7479d
--- /dev/null
+++ b/arch/arm/dts/k3-binman-capsule-r5.dtsi
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+ {
+   capsule_tiboot3: capsule-tiboot3 {
+   filename = "tiboot3-capsule.bin";
+   efi-capsule {
+   image-index = <0x1>;
+   image-guid = "----";
+   private-key = "arch/arm/mach-k3/keys/custMpk.pem";
+   public-key-cert = "arch/arm/mach-k3/keys/custMpk.crt";
+   monotonic-count = <0x1>;
+
+   blob {
+   filename = "tiboot3.bin";
+   };
+   };
+   };
+};
diff --git a/arch/arm/dts/k3-binman-capsule.dtsi 
b/arch/arm/dts/k3-binman-capsule.dtsi
new file mode 100644
index 000..17e83c9fa44
--- /dev/null
+++ b/arch/arm/dts/k3-binman-capsule.dtsi
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+ {
+   capsule_tispl: capsule-tispl {
+   filename = "tispl-capsule.bin";
+   efi-capsule {
+   image-index = <0x2>;
+   image-guid = "----";
+   private-key = "arch/arm/mach-k3/keys/custMpk.pem";
+   public-key-cert = "arch/arm/mach-k3/keys/custMpk.crt";
+   monotonic-count = <0x1>;
+
+   blob {
+   filename = "tispl.bin";
+   };
+   };
+   };
+};
+
+ {
+   capsule_uboot: capsule-uboot {
+   filename = "uboot-capsule.bin";
+   efi-capsule {
+   image-index = <0x3>;
+   image-guid = "----";
+   private-key = "arch/arm/mach-k3/keys/custMpk.pem";
+   public-key-cert = "arch/arm/mach-k3/keys/custMpk.crt";
+   monotonic-count = <0x1>;
+
+   blob {
+   filename = "u-boot.img";
+   };
+   };
+   };
+};
-- 
2.34.1



[PATCH v2 7/7] dts: beagleboneai64: binman: Include firmware capsules binman nodes

2024-04-19 Thread Jonathan Humphreys
Fill in the BeagleBoneAI64's capsule GUID properties of the base binman capsule
nodes.
Also add it's SYSFW binman capsule node.

Signed-off-by: Jonathan Humphreys 
---
 .../dts/k3-j721e-beagleboneai64-u-boot.dtsi   | 23 +++
 arch/arm/dts/k3-j721e-r5-beagleboneai64.dts   | 29 +++
 2 files changed, 52 insertions(+)

diff --git a/arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi 
b/arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi
index e202ae16644..884f44239e1 100644
--- a/arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi
+++ b/arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi
@@ -351,4 +351,27 @@
};
};
 };
+
+#include "k3-binman-capsule.dtsi"
+
+// Capsule update GUIDs in string form.  See beagleboneai64.h
+#define BEAGLEBONEAI64_SPL_IMAGE_GUID_STR 
"83447222-1e26-40cd-a395-b7de0957e875"
+#define BEAGLEBONEAI64_UBOOT_IMAGE_GUID_STR 
"4249ff77-c17d-4eb7-a1db-45aa9887d49e"
+
+_tispl {
+   efi-capsule {
+   image-guid = BEAGLEBONEAI64_SPL_IMAGE_GUID_STR;
+
+   blob {
+   filename = "tispl.bin_unsigned";
+   };
+   };
+};
+
+_uboot {
+   efi-capsule {
+   image-guid = BEAGLEBONEAI64_UBOOT_IMAGE_GUID_STR;
+   };
+};
+
 #endif
diff --git a/arch/arm/dts/k3-j721e-r5-beagleboneai64.dts 
b/arch/arm/dts/k3-j721e-r5-beagleboneai64.dts
index 43da4dafba8..d4ef18248b0 100644
--- a/arch/arm/dts/k3-j721e-r5-beagleboneai64.dts
+++ b/arch/arm/dts/k3-j721e-r5-beagleboneai64.dts
@@ -183,3 +183,32 @@
};
};
 };
+
+#include "k3-binman-capsule-r5.dtsi"
+
+// Capsue update GUIDs.  See beagleboneai64.h.
+#define BEAGLEBONEAI64_TIBOOT3_IMAGE_GUID_STR 
"772a4810-2194-4923-8754-0115870ef367"
+#define BEAGLEBONEAI64_SYSFW_IMAGE_GUID_STR 
"dfc9c683-49b7-46bd-b3c1-3a3b2fdb135b"
+
+_tiboot3 {
+   efi-capsule {
+   image-guid = BEAGLEBONEAI64_TIBOOT3_IMAGE_GUID_STR;
+   };
+};
+
+ {
+   capsule-sysfw {
+   filename = "sysfw-capsule.bin";
+   efi-capsule {
+   image-index = <0x4>;
+   image-guid = BEAGLEBONEAI64_SYSFW_IMAGE_GUID_STR;
+   private-key = "arch/arm/mach-k3/keys/custMpk.pem";
+   public-key-cert = "arch/arm/mach-k3/keys/custMpk.crt";
+   monotonic-count = <0x1>;
+
+   blob {
+   filename = "sysfw.itb";
+   };
+   };
+   };
+};
-- 
2.34.1



[PATCH v2 3/7] dts: j721e: binman: Include firmware capsules binman nodes

2024-04-19 Thread Jonathan Humphreys
Fill in the J721e SK's capsule GUID properties of the base binman capsule
nodes.
Also add it's SYSFW binman capsule node.

Signed-off-by: Jonathan Humphreys 
---
 arch/arm/dts/k3-j721e-binman.dtsi | 49 +++
 1 file changed, 49 insertions(+)

diff --git a/arch/arm/dts/k3-j721e-binman.dtsi 
b/arch/arm/dts/k3-j721e-binman.dtsi
index 75a6e9599b9..32cfd545e5c 100644
--- a/arch/arm/dts/k3-j721e-binman.dtsi
+++ b/arch/arm/dts/k3-j721e-binman.dtsi
@@ -207,6 +207,36 @@
};
};
 };
+
+#include "k3-binman-capsule-r5.dtsi"
+
+// Capsule update GUIDs in string form.  See j721e_evm.h
+#define J721E_SK_TIBOOT3_IMAGE_GUID_STR "e672b518-7cd7-4014-bd8d-40724d0ad4dc"
+#define J721E_SK_SYSFW_IMAGE_GUID_STR "6fd10680-361b-431f-80aa-899455819e11"
+
+_tiboot3 {
+   efi-capsule {
+   image-guid = J721E_SK_TIBOOT3_IMAGE_GUID_STR;
+   };
+};
+
+ {
+   capsule-sysfw {
+   filename = "sysfw-capsule.bin";
+   efi-capsule {
+   image-index = <0x4>;
+   image-guid = J721E_SK_SYSFW_IMAGE_GUID_STR;
+   private-key = "arch/arm/mach-k3/keys/custMpk.pem";
+   public-key-cert = "arch/arm/mach-k3/keys/custMpk.crt";
+   monotonic-count = <0x1>;
+
+   blob {
+   filename = "sysfw.itb";
+   };
+   };
+   };
+};
+
 #endif
 
 #ifdef CONFIG_TARGET_J721E_A72_EVM
@@ -585,4 +615,23 @@
};
};
 };
+
+#include "k3-binman-capsule.dtsi"
+
+// Capsule update GUIDs in string form.  See j721e_evm.h
+#define J721E_SK_SPL_IMAGE_GUID_STR "86f710ad-10cf-46ea-ac67-856ae06efad2"
+#define J721E_SK_UBOOT_IMAGE_GUID_STR "81b58fb0-3b00-4add-a20a-c185bbaca1ed"
+
+_tispl {
+   efi-capsule {
+   image-guid = J721E_SK_SPL_IMAGE_GUID_STR;
+   };
+};
+
+_uboot {
+   efi-capsule {
+   image-guid = J721E_SK_UBOOT_IMAGE_GUID_STR;
+   };
+};
+
 #endif
-- 
2.34.1



[PATCH v3 00/19] EFI: ti: Enable EFI capsule updates

2024-04-19 Thread Jonathan Humphreys
Enable on disk capsule updates, which includes defining the firmware components
(tiboot3, spl, u-boot) and enabling processing of raw capsule updates.

This is enabled for several TI SoC based platforms: AM64, AM62, AM62p,
BeaglePlay, J7, and BeagleboneAI.

This series also includes enabling seral flash DFU for AM62 and MMC DFU for
beagleplay.

Changes from v1:
- Added sysfw.itb capsule definition to beagleboneai64
- removed extra commas in structure definitions

Changes from v2:
- Added documentation on OSPI flash layouts
- Improved comments for capsule GUIDs definitions
- Defined board unique capsule GUIDs and put definitions in board specific files
- Added a Capsule Update porting section to the documentation

Jonathan Humphreys (19):
  doc: uefi: capsules: Start Capsule Update porting section
  board: am64x: Define capsule update firmware info
  configs: am64x: Enable EFI capsule update
  doc: board: ti: am64x: document OSPI layout
  board: j721e: Define capsule update firmware info
  configs: j721e: Enable EFI capsule update
  doc: board: ti: j721e: document OSPI layout
  board: beagleplay: Define capsule update firmware info
  configs: beagleplay: Enable DFU for MMC
  configs: beagleplay: Enable EFI capsule update
  board: am62px: Define capsule update firmware info
  configs: am62px: Enable EFI capsule update
  doc: board: ti: am62px: document OSPI layout
  configs: am62x: Enable serial flash DFU
  board: am62x: Define capsule update firmware info
  configs: am62x: Enable EFI capsule update
  doc: board: ti: am62x: document OSPI layout
  board: beagleboneai64: Define capsule update firmware info
  configs: beagleboneai64: Enable EFI capsule update

 board/beagle/beagleboneai64/Kconfig  |  4 +-
 board/beagle/beagleboneai64/beagleboneai64.c | 38 +
 board/beagle/beagleplay/Kconfig  |  4 +-
 board/beagle/beagleplay/beagleplay.c | 33 
 board/ti/am62px/evm.c| 32 
 board/ti/am62x/evm.c | 32 
 board/ti/am64x/evm.c | 33 
 board/ti/j721e/evm.c | 38 +
 configs/am62px_evm_a53_defconfig |  2 +
 configs/am62x_beagleplay_a53_defconfig   |  5 ++
 configs/am62x_evm_a53_defconfig  |  3 +
 configs/am64x_evm_a53_defconfig  |  2 +
 configs/j721e_beagleboneai64_a72_defconfig   |  2 +
 configs/j721e_evm_a72_defconfig  |  2 +
 doc/board/ti/am62px_sk.rst   | 48 +++
 doc/board/ti/am62x_sk.rst| 48 +++
 doc/board/ti/am64x_evm.rst   | 48 +++
 doc/board/ti/j721e_evm.rst   | 85 +---
 doc/develop/uefi/uefi.rst| 12 +++
 include/configs/am62px_evm.h | 24 ++
 include/configs/am62x_evm.h  | 24 ++
 include/configs/am64x_evm.h  | 24 ++
 include/configs/beagleboneai64.h | 55 +
 include/configs/beagleplay.h | 41 ++
 include/configs/j721e_evm.h  | 29 +++
 25 files changed, 635 insertions(+), 33 deletions(-)
 create mode 100644 include/configs/beagleboneai64.h
 create mode 100644 include/configs/beagleplay.h

-- 
2.34.1



[PATCH v3 05/19] board: j721e: Define capsule update firmware info

2024-04-19 Thread Jonathan Humphreys
Define the firmware components updatable via EFI capsule update, including
defining capsule GUIDs for the various firmware components for the SK-TDA4VM.

Signed-off-by: Jonathan Humphreys 
---
 board/ti/j721e/evm.c| 38 +
 include/configs/j721e_evm.h | 29 
 2 files changed, 67 insertions(+)

diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index 9dc3ed6dfff..de70027b2df 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -7,6 +7,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -32,6 +33,43 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = J721E_SK_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"J721E_SK_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = J721E_SK_SPL_IMAGE_GUID,
+   .fw_name = u"J721E_SK_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = J721E_SK_UBOOT_IMAGE_GUID,
+   .fw_name = u"J721E_SK_UBOOT",
+   .image_index = 3,
+   },
+   {
+   .image_type_id = J721E_SK_SYSFW_IMAGE_GUID,
+   .fw_name = u"J721E_SK_SYSFW",
+   .image_index = 4,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "sf 0:0=tiboot3.bin raw 0 8;tispl.bin raw 8 
20;u-boot.img raw 28 40;sysfw.itb raw 6C 10",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_init(void)
 {
return 0;
diff --git a/include/configs/j721e_evm.h b/include/configs/j721e_evm.h
index c26438c8684..a5140ea6a11 100644
--- a/include/configs/j721e_evm.h
+++ b/include/configs/j721e_evm.h
@@ -22,6 +22,35 @@
 #define CFG_SYS_UBOOT_BASE 0x5008
 #endif
 
+/**
+ * define J721E_SK_TIBOOT3_IMAGE_GUID - firmware GUID for J721e sk tiboot3.bin
+ * define J721E_SK_SPL_IMAGE_GUID - firmware GUID for J721e sk SPL
+ * define J721E_SK_UBOOT_IMAGE_GUID   - firmware GUID for J721e sk UBOOT
+ * define J721E_SK_SYSFW_IMAGE_GUID   - firmware GUID for J721e sk SYSFW
+ *
+ * These GUIDs are used in capsules updates to identify the corresponding
+ * firmware object.
+ *
+ * Board developers using this as a starting reference should
+ * define their own GUIDs to ensure that firmware repositories (like
+ * LVFS) do not confuse them.
+ */
+#define J721E_SK_TIBOOT3_IMAGE_GUID \
+   EFI_GUID(0xe672b518, 0x7cd7, 0x4014, 0xbd, 0x8d, \
+0x40, 0x72, 0x4d, 0x0a, 0xd4, 0xdc)
+
+#define J721E_SK_SPL_IMAGE_GUID \
+   EFI_GUID(0x86f710ad, 0x10cf, 0x46ea, 0xac, 0x67, \
+0x85, 0x6a, 0xe0, 0x6e, 0xfa, 0xd2)
+
+#define J721E_SK_UBOOT_IMAGE_GUID \
+   EFI_GUID(0x81b58fb0, 0x3b00, 0x4add, 0xa2, 0x0a, \
+0xc1, 0x85, 0xbb, 0xac, 0xa1, 0xed)
+
+#define J721E_SK_SYSFW_IMAGE_GUID \
+   EFI_GUID(0x6fd10680, 0x361b, 0x431f, 0x80, 0xaa, \
+0x89, 0x94, 0x55, 0x81, 0x9e, 0x11)
+
 /* Now for the remaining common defines */
 #include 
 
-- 
2.34.1



[PATCH v3 19/19] configs: beagleboneai64: Enable EFI capsule update

2024-04-19 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/j721e_beagleboneai64_a72_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/j721e_beagleboneai64_a72_defconfig 
b/configs/j721e_beagleboneai64_a72_defconfig
index 3d234bc1a8f..e74ee68e23e 100644
--- a/configs/j721e_beagleboneai64_a72_defconfig
+++ b/configs/j721e_beagleboneai64_a72_defconfig
@@ -172,3 +172,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x6163
 CONFIG_SPL_DFU=y
 CONFIG_LZO=y
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v3 04/19] doc: board: ti: am64x: document OSPI layout

2024-04-19 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 doc/board/ti/am64x_evm.rst | 48 ++
 1 file changed, 48 insertions(+)

diff --git a/doc/board/ti/am64x_evm.rst b/doc/board/ti/am64x_evm.rst
index 6ae35b3fee3..a7468fbd254 100644
--- a/doc/board/ti/am64x_evm.rst
+++ b/doc/board/ti/am64x_evm.rst
@@ -140,6 +140,54 @@ Image formats:
 .. image:: img/nodm_tispl.bin.svg
   :alt: tispl.bin image format
 
+OSPI:
+-
+ROM supports booting from OSPI from offset 0x0.
+
+Flashing images to OSPI:
+
+Below commands can be used to download tiboot3.bin, tispl.bin, and u-boot.img,
+over tftp and then flash those to OSPI at their respective addresses.
+
+.. prompt:: bash =>
+
+  sf probe
+  tftp ${loadaddr} tiboot3.bin
+  sf update $loadaddr 0x0 $filesize
+  tftp ${loadaddr} tispl.bin
+  sf update $loadaddr 0x10 $filesize
+  tftp ${loadaddr} u-boot.img
+  sf update $loadaddr 0x30 $filesize
+
+Flash layout for OSPI:
+
+.. code-block:: console
+
+ 0x0 ++
+ | ospi.tiboot3(1m)   |
+ ||
+0x10 ++
+ | ospi.tispl(2m) |
+ ||
+0x30 ++
+ | ospi.u-boot(4m)|
+ ||
+0x70 ++
+ | ospi.env(128k) |
+ ||
+0x72 ++
+ |   ospi.env.backup(128k)|
+ ||
+0x74 ++
+ |  padding (768k)|
+0x80 ++
+ | ospi.rootfs(ubifs) |
+ ||
+   0x3fc ++
+ |   ospi.phypattern (256k)   |
+ ||
+ ++
+
 Switch Setting for Boot Mode
 
 
-- 
2.34.1



[PATCH v3 03/19] configs: am64x: Enable EFI capsule update

2024-04-19 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am64x_evm_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am64x_evm_a53_defconfig b/configs/am64x_evm_a53_defconfig
index e000549d6d0..c9bdd7b54cc 100644
--- a/configs/am64x_evm_a53_defconfig
+++ b/configs/am64x_evm_a53_defconfig
@@ -178,3 +178,5 @@ CONFIG_USB_FUNCTION_MASS_STORAGE=y
 CONFIG_SPL_DFU=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v3 14/19] configs: am62x: Enable serial flash DFU

2024-04-19 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_evm_a53_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig
index 6b37f8b4791..cc397f72d2c 100644
--- a/configs/am62x_evm_a53_defconfig
+++ b/configs/am62x_evm_a53_defconfig
@@ -68,6 +68,7 @@ CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
 CONFIG_CLK_TI_SCI=y
+CONFIG_DFU_SF=y
 CONFIG_DMA_CHANNELS=y
 CONFIG_TI_K3_NAVSS_UDMA=y
 CONFIG_TI_SCI_PROTOCOL=y
-- 
2.34.1



[PATCH v3 11/19] board: am62px: Define capsule update firmware info

2024-04-19 Thread Jonathan Humphreys
Define the firmware components updatable via EFI capsule update, including
defining capsule GUIDs for the various firmware components for the AM62px SK.

Signed-off-by: Jonathan Humphreys 
---
 board/ti/am62px/evm.c| 32 
 include/configs/am62px_evm.h | 24 
 2 files changed, 56 insertions(+)

diff --git a/board/ti/am62px/evm.c b/board/ti/am62px/evm.c
index 97a95ce8cc2..4caf3d5b3ba 100644
--- a/board/ti/am62px/evm.c
+++ b/board/ti/am62px/evm.c
@@ -6,6 +6,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -13,6 +14,37 @@
 #include 
 #include 
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = AM62PX_SK_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"AM62PX_SK_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = AM62PX_SK_SPL_IMAGE_GUID,
+   .fw_name = u"AM62PX_SK_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = AM62PX_SK_UBOOT_IMAGE_GUID,
+   .fw_name = u"AM62PX_SK_UBOOT",
+   .image_index = 3,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "sf 0:0=tiboot3.bin raw 0 8;tispl.bin raw 8 
20;u-boot.img raw 28 40",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_init(void)
 {
return 0;
diff --git a/include/configs/am62px_evm.h b/include/configs/am62px_evm.h
index 06b12860e21..57a1ba9dc3c 100644
--- a/include/configs/am62px_evm.h
+++ b/include/configs/am62px_evm.h
@@ -8,6 +8,30 @@
 #ifndef __CONFIG_AM62PX_EVM_H
 #define __CONFIG_AM62PX_EVM_H
 
+/**
+ * define AM62PX_SK_TIBOOT3_IMAGE_GUID - firmware GUID for AM62PX sk 
tiboot3.bin
+ * define AM62PX_SK_SPL_IMAGE_GUID - firmware GUID for AM62PX sk SPL
+ * define AM62PX_SK_UBOOT_IMAGE_GUID   - firmware GUID for AM62PX sk UBOOT
+ *
+ * These GUIDs are used in capsules updates to identify the corresponding
+ * firmware object.
+ *
+ * Board developers using this as a starting reference should
+ * define their own GUIDs to ensure that firmware repositories (like
+ * LVFS) do not confuse them.
+ */
+#define AM62PX_SK_TIBOOT3_IMAGE_GUID \
+   EFI_GUID(0xb08471b7, 0xbe2d, 0x4489, 0x87, 0xa1, \
+   0xca, 0xb2, 0x8a, 0x0c, 0xf7, 0x43)
+
+#define AM62PX_SK_SPL_IMAGE_GUID \
+   EFI_GUID(0xd02ed781, 0x6d71, 0x4c1a, 0xa9, 0x99, \
+   0x3c, 0x6a, 0x41, 0xc3, 0x63, 0x24)
+
+#define AM62PX_SK_UBOOT_IMAGE_GUID \
+   EFI_GUID(0x7e6aea51, 0x965c, 0x44ab, 0xb3, 0x88, \
+   0xda, 0xeb, 0x03, 0xb5, 0x4f, 0x66)
+
 /* Now for the remaining common defines */
 #include 
 
-- 
2.34.1



[PATCH v3 07/19] doc: board: ti: j721e: document OSPI layout

2024-04-19 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 doc/board/ti/j721e_evm.rst | 85 +-
 1 file changed, 56 insertions(+), 29 deletions(-)

diff --git a/doc/board/ti/j721e_evm.rst b/doc/board/ti/j721e_evm.rst
index a422a9bf1a0..a0fc37ab6d7 100644
--- a/doc/board/ti/j721e_evm.rst
+++ b/doc/board/ti/j721e_evm.rst
@@ -150,6 +150,60 @@ Image formats:
 .. image:: img/sysfw.itb.svg
   :alt: sysfw.itb image format
 
+OSPI:
+-
+ROM supports booting from OSPI from offset 0x0.
+
+Flashing images to OSPI:
+
+Below commands can be used to download tiboot3.bin, tispl.bin, u-boot.img,
+and sysfw.itb over tftp and then flash those to OSPI at their respective
+addresses.
+
+.. prompt:: bash =>
+
+  sf probe
+  tftp ${loadaddr} tiboot3.bin
+  sf update $loadaddr 0x0 $filesize
+  tftp ${loadaddr} tispl.bin
+  sf update $loadaddr 0x8 $filesize
+  tftp ${loadaddr} u-boot.img
+  sf update $loadaddr 0x28 $filesize
+  tftp ${loadaddr} sysfw.itb
+  sf update $loadaddr 0x6C $filesize
+
+Flash layout for OSPI:
+
+.. code-block:: console
+
+ 0x0 ++
+ | ospi.tiboot3(512K) |
+ ||
+ 0x8 ++
+ | ospi.tispl(2M) |
+ ||
+0x28 ++
+ | ospi.u-boot(4M)|
+ ||
+0x68 ++
+ | ospi.env(128K) |
+ ||
+0x6A ++
+ |   ospi.env.backup (128K)   |
+ ||
+0x6C ++
+ |  ospi.sysfw(1M)|
+ ||
+0x7C ++
+ |  padding (256k)|
+0x80 ++
+ | ospi.rootfs(UBIFS) |
+ ||
+   0x3FE ++
+ |   ospi.phypattern (128k)   |
+ ||
+ ++
+
 R5 Memory Map:
 --
 
@@ -193,35 +247,8 @@ R5 Memory Map:
  - 0x41cffbfc
  - 0x41cf
 
-OSPI:
--
-ROM supports booting from OSPI from offset 0x0.
-
-Flashing images to OSPI:
-
-Below commands can be used to download tiboot3.bin, tispl.bin, u-boot.img,
-and sysfw.itb over tftp and then flash those to OSPI at their respective
-addresses.
-
-.. prompt:: bash =>
-
-  sf probe
-  tftp ${loadaddr} tiboot3.bin
-  sf update $loadaddr 0x0 $filesize
-  tftp ${loadaddr} tispl.bin
-  sf update $loadaddr 0x8 $filesize
-  tftp ${loadaddr} u-boot.img
-  sf update $loadaddr 0x28 $filesize
-  tftp ${loadaddr} sysfw.itb
-  sf update $loadaddr 0x6C $filesize
-
-Flash layout for OSPI:
-
-.. image:: img/ospi_sysfw.svg
-  :alt: OSPI flash partition layout
-
-Firmwares:
---
+Firmware:
+-
 
 The J721e u-boot allows firmware to be loaded for the Cortex-R5 subsystem.
 The CPSW5G in J7200 and CPSW9G in J721E present in MAIN domain is configured
-- 
2.34.1



[PATCH v3 02/19] board: am64x: Define capsule update firmware info

2024-04-19 Thread Jonathan Humphreys
Define the firmware components updatable via EFI capsule update, including
defining capsule GUIDs for the various firmware components for the AM64x SK.

Signed-off-by: Jonathan Humphreys 
---
 board/ti/am64x/evm.c| 33 +
 include/configs/am64x_evm.h | 24 
 2 files changed, 57 insertions(+)

diff --git a/board/ti/am64x/evm.c b/board/ti/am64x/evm.c
index b8de69da06c..83df75a6911 100644
--- a/board/ti/am64x/evm.c
+++ b/board/ti/am64x/evm.c
@@ -7,6 +7,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -27,6 +28,38 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = AM64X_SK_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"AM64X_SK_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = AM64X_SK_SPL_IMAGE_GUID,
+   .fw_name = u"AM64X_SK_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = AM64X_SK_UBOOT_IMAGE_GUID,
+   .fw_name = u"AM64X_SK_UBOOT",
+   .image_index = 3,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "sf 0:0=tiboot3.bin raw 0 10;tispl.bin raw 10 
20;u-boot.img raw 30 40",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_init(void)
 {
return 0;
diff --git a/include/configs/am64x_evm.h b/include/configs/am64x_evm.h
index f9f8c7bc2f6..9db83621ea8 100644
--- a/include/configs/am64x_evm.h
+++ b/include/configs/am64x_evm.h
@@ -9,6 +9,30 @@
 #ifndef __CONFIG_AM642_EVM_H
 #define __CONFIG_AM642_EVM_H
 
+/**
+ * define AM64X_SK_TIBOOT3_IMAGE_GUID - firmware GUID for AM64X sk tiboot3.bin
+ * define AM64X_SK_SPL_IMAGE_GUID - firmware GUID for AM64X sk SPL
+ * define AM64X_SK_UBOOT_IMAGE_GUID   - firmware GUID for AM64X sk UBOOT
+ *
+ * These GUIDs are used in capsules updates to identify the corresponding
+ * firmware object.
+ *
+ * Board developers using this as a starting reference should
+ * define their own GUIDs to ensure that firmware repositories (like
+ * LVFS) do not confuse them.
+ */
+#define AM64X_SK_TIBOOT3_IMAGE_GUID \
+   EFI_GUID(0xede0a0d5, 0x9116, 0x4bfb, 0xaa, 0x54, \
+   0x09, 0xe9, 0x7b, 0x5a, 0xfe, 0x1a)
+
+#define AM64X_SK_SPL_IMAGE_GUID \
+   EFI_GUID(0x77678f5c, 0x64d4, 0x4910, 0xad, 0x75, \
+   0x52, 0xc9, 0xd9, 0x5c, 0xdb, 0x1d)
+
+#define AM64X_SK_UBOOT_IMAGE_GUID \
+   EFI_GUID(0xc6ad43a9, 0x7d31, 0x4f5d, 0x83, 0xe9, \
+   0xb8, 0xef, 0xec, 0xae, 0x05, 0xbf)
+
 /* Now for the remaining common defines */
 #include 
 
-- 
2.34.1



[PATCH v3 17/19] doc: board: ti: am62x: document OSPI layout

2024-04-19 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 doc/board/ti/am62x_sk.rst | 48 +++
 1 file changed, 48 insertions(+)

diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst
index b12dc85f06b..bf7ea754e32 100644
--- a/doc/board/ti/am62x_sk.rst
+++ b/doc/board/ti/am62x_sk.rst
@@ -150,6 +150,54 @@ Image formats:
 .. image:: img/dm_tispl.bin.svg
   :alt: tispl.bin image format
 
+OSPI:
+-
+ROM supports booting from OSPI from offset 0x0.
+
+Flashing images to OSPI:
+
+Below commands can be used to download tiboot3.bin, tispl.bin, and u-boot.img,
+over tftp and then flash those to OSPI at their respective addresses.
+
+.. prompt:: bash =>
+
+  sf probe
+  tftp ${loadaddr} tiboot3.bin
+  sf update $loadaddr 0x0 $filesize
+  tftp ${loadaddr} tispl.bin
+  sf update $loadaddr 0x8 $filesize
+  tftp ${loadaddr} u-boot.img
+  sf update $loadaddr 0x28 $filesize
+
+Flash layout for OSPI:
+
+.. code-block:: console
+
+ 0x0 ++
+ | ospi.tiboot3(512k) |
+ ||
+ 0x8 ++
+ | ospi.tispl(2m) |
+ ||
+0x28 ++
+ | ospi.u-boot(4m)|
+ ||
+0x68 ++
+ | ospi.env(128k) |
+ ||
+0x6c ++
+ |   ospi.env.backup(128k)|
+ ||
+0x74 ++
+ |  padding (768k)|
+0x80 ++
+ | ospi.rootfs(ubifs) |
+ ||
+   0x3fc ++
+ |   ospi.phypattern (256k)   |
+ ||
+ ++
+
 A53 SPL DDR Memory Layout
 -
 
-- 
2.34.1



[PATCH v3 10/19] configs: beagleplay: Enable EFI capsule update

2024-04-19 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_beagleplay_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am62x_beagleplay_a53_defconfig 
b/configs/am62x_beagleplay_a53_defconfig
index 68e103f58dc..23b9c466248 100644
--- a/configs/am62x_beagleplay_a53_defconfig
+++ b/configs/am62x_beagleplay_a53_defconfig
@@ -124,3 +124,5 @@ CONFIG_EXT4_WRITE=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_LZO=y
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v3 18/19] board: beagleboneai64: Define capsule update firmware info

2024-04-19 Thread Jonathan Humphreys
Define the firmware components updatable via EFI capsule update, including
defining capsule GUIDs for the various firmware components for the
BeagleBoneAI64.

Note this involved creating BeagleBoneAI64's own beagleboneai64.h board header
file instead of reusing j721e_evm's.

Signed-off-by: Jonathan Humphreys 
---
 board/beagle/beagleboneai64/Kconfig  |  4 +-
 board/beagle/beagleboneai64/beagleboneai64.c | 38 ++
 include/configs/beagleboneai64.h | 55 
 3 files changed, 95 insertions(+), 2 deletions(-)
 create mode 100644 include/configs/beagleboneai64.h

diff --git a/board/beagle/beagleboneai64/Kconfig 
b/board/beagle/beagleboneai64/Kconfig
index 7cfccf9baf0..0f21582614d 100644
--- a/board/beagle/beagleboneai64/Kconfig
+++ b/board/beagle/beagleboneai64/Kconfig
@@ -37,7 +37,7 @@ config SYS_VENDOR
default "beagle"
 
 config SYS_CONFIG_NAME
-   default "j721e_evm"
+   default "beagleboneai64"
 
 source "board/ti/common/Kconfig"
 
@@ -52,7 +52,7 @@ config SYS_VENDOR
default "beagle"
 
 config SYS_CONFIG_NAME
-   default "j721e_evm"
+   default "beagleboneai64"
 
 source "board/ti/common/Kconfig"
 
diff --git a/board/beagle/beagleboneai64/beagleboneai64.c 
b/board/beagle/beagleboneai64/beagleboneai64.c
index c5b4ff7df47..05dec405b81 100644
--- a/board/beagle/beagleboneai64/beagleboneai64.c
+++ b/board/beagle/beagleboneai64/beagleboneai64.c
@@ -7,6 +7,7 @@
  * Copyright (C) 2022-2023 Robert Nelson, BeagleBoard.org Foundation
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -14,6 +15,43 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = BEAGLEBONEAI64_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"BEAGLEBONEAI64_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = BEAGLEBONEAI64_SPL_IMAGE_GUID,
+   .fw_name = u"BEAGLEBONEAI64_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = BEAGLEBONEAI64_UBOOT_IMAGE_GUID,
+   .fw_name = u"BEAGLEBONEAI64_UBOOT",
+   .image_index = 3,
+   },
+   {
+   .image_type_id = BEAGLEBONEAI64_SYSFW_IMAGE_GUID,
+   .fw_name = u"BEAGLEBONEAI64_SYSFW",
+   .image_index = 4,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "mmc 0=tiboot3.bin raw 0 2000 mmcpart 1;tispl.bin fat 0 
1;u-boot.img fat 0 1; sysfw.itb fat 0 1",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_init(void)
 {
return 0;
diff --git a/include/configs/beagleboneai64.h b/include/configs/beagleboneai64.h
new file mode 100644
index 000..0fcf403c1c4
--- /dev/null
+++ b/include/configs/beagleboneai64.h
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Configuration header file for BeagleBoneAI64
+ *
+ * https://beagleboard.org/ai-64
+ *
+ * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#ifndef __CONFIG_BEAGLEBONEAI64_H
+#define __CONFIG_BEAGLEBONEAI64_H
+
+/* FLASH Configuration */
+#define CFG_SYS_FLASH_BASE 0x0
+
+/* SPL Loader Configuration */
+#define CFG_SYS_UBOOT_BASE 0x5008
+
+/**
+ * define BEAGLEBONEAI64_TIBOOT3_IMAGE_GUID - firmware GUID for BeagleBoneAI64
+ *tiboot3.bin
+ * define BEAGLEBONEAI64_SPL_IMAGE_GUID - firmware GUID for BeagleBoneAI64
+ *SPL
+ * define BEAGLEBONEAI64_UBOOT_IMAGE_GUID   - firmware GUID for BeagleBoneAI64
+ *UBOOT
+ * define BEAGLEBONEAI64_SYSFW_IMAGE_GUID   - firmware GUID for BeagleBoneAI64
+ *SYSFW
+ *
+ * These GUIDs are used in capsules updates to identify the corresponding
+ * firmware object.
+ *
+ * Board developers using this as a starting reference should
+ * define their own GUIDs to ensure that firmware repositories (like
+ * LVFS) do not confuse them.
+ */
+#define BEAGLEBONEAI64_TIBOOT3_IMAGE_GUID \
+   EFI_GUID(0x772a4810, 0x2194, 0x4923, 0x87, 0x54, \
+   0x01, 0x15, 0x87, 0x0e, 0xf3, 0x67)
+
+#define BEAGLEBONEAI64_SPL_IMAGE_GUID \
+   EFI_GUID(0x83447222, 0x1e26, 0x40cd, 0xa3, 0x95, \
+   0xb7, 0xde, 0x09, 0x57, 0xe8, 0x75)
+
+#define BEAGLEBONEAI64_UBOOT_IMAGE_GUID \
+   EFI_GUID(0x4249ff77, 0xc17d, 0x4eb7, 0xa1, 0xdb, \
+   0x45, 0xaa, 0x98, 0x87, 0xd4, 0x9e)
+
+#define BEAGLEBONEAI64_SYSFW_IMAGE_GUID \
+   EFI_G

[PATCH v3 01/19] doc: uefi: capsules: Start Capsule Update porting section

2024-04-19 Thread Jonathan Humphreys
Created a capsule update porting section in the documentation that outlines the
steps a board developer must do when porting from an existing reference board
implementation.

In particular, added a big warning that new capsule GUID's need to be defined.

Signed-off-by: Jonathan Humphreys 
---
 doc/develop/uefi/uefi.rst | 12 
 1 file changed, 12 insertions(+)

diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst
index 0389b269c01..36ac75278fa 100644
--- a/doc/develop/uefi/uefi.rst
+++ b/doc/develop/uefi/uefi.rst
@@ -631,6 +631,18 @@ where version.dtso looks like::
 The properties of image-type-id and image-index must match the value
 defined in the efi_fw_image array as image_type_id and image_index.
 
+Porting Capsule Updates to new boards
+*
+
+It is important, when using a reference board as a starting point for a custom
+board, that certain steps are taken to properly support Capsule Updates.
+
+Capsule GUIDs need to be unique for each firmware and board. That is, if two
+firmwares are built from the same source but result in different binaries
+because they are built for different boards, they should have different GUIDs.
+Therefore it is important when creating support for a new board, new GUIDs are
+defined in the board's header file.  *DO NOT* reuse capsule GUIDs.
+
 Executing the boot manager
 ~~
 
-- 
2.34.1



[PATCH v3 16/19] configs: am62x: Enable EFI capsule update

2024-04-19 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_evm_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig
index cc397f72d2c..d628535a4ed 100644
--- a/configs/am62x_evm_a53_defconfig
+++ b/configs/am62x_evm_a53_defconfig
@@ -112,3 +112,5 @@ CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v3 12/19] configs: am62px: Enable EFI capsule update

2024-04-19 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62px_evm_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am62px_evm_a53_defconfig b/configs/am62px_evm_a53_defconfig
index 638d2e90a6b..02500e205d1 100644
--- a/configs/am62px_evm_a53_defconfig
+++ b/configs/am62px_evm_a53_defconfig
@@ -177,3 +177,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
 CONFIG_SPL_DFU=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v3 08/19] board: beagleplay: Define capsule update firmware info

2024-04-19 Thread Jonathan Humphreys
Define the firmware components updatable via EFI capsule update, including
defining capsule GUIDs for the various firmware components for the BeaglePlay.

Note this involved creating BeaglePlay's own beagleplay.h board header file
instead of reusing am62_evm's.

Signed-off-by: Jonathan Humphreys 
---
 board/beagle/beagleplay/Kconfig  |  4 +--
 board/beagle/beagleplay/beagleplay.c | 33 ++
 include/configs/beagleplay.h | 41 
 3 files changed, 76 insertions(+), 2 deletions(-)
 create mode 100644 include/configs/beagleplay.h

diff --git a/board/beagle/beagleplay/Kconfig b/board/beagle/beagleplay/Kconfig
index 7dbd833acb4..b0e67dc8ef3 100644
--- a/board/beagle/beagleplay/Kconfig
+++ b/board/beagle/beagleplay/Kconfig
@@ -35,7 +35,7 @@ config SYS_VENDOR
default "beagle"
 
 config SYS_CONFIG_NAME
-   default "am62x_evm"
+   default "beagleplay"
 
 source "board/ti/common/Kconfig"
 
@@ -50,7 +50,7 @@ config SYS_VENDOR
default "beagle"
 
 config SYS_CONFIG_NAME
-   default "am62x_evm"
+   default "beagleplay"
 
 config SPL_LDSCRIPT
default "arch/arm/mach-omap2/u-boot-spl.lds"
diff --git a/board/beagle/beagleplay/beagleplay.c 
b/board/beagle/beagleplay/beagleplay.c
index af36439e2e2..fe873e9f2b8 100644
--- a/board/beagle/beagleplay/beagleplay.c
+++ b/board/beagle/beagleplay/beagleplay.c
@@ -6,6 +6,7 @@
  * Copyright (C) 2022-2023 Robert Nelson, BeagleBoard.org Foundation
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -15,6 +16,38 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = BEAGLEPLAY_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"BEAGLEPLAY_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = BEAGLEPLAY_SPL_IMAGE_GUID,
+   .fw_name = u"BEAGLEPLAY_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = BEAGLEPLAY_UBOOT_IMAGE_GUID,
+   .fw_name = u"BEAGLEPLAY_UBOOT",
+   .image_index = 3,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "mmc 0=tiboot3.bin raw 0 2000 mmcpart 1;tispl.bin fat 0 
1;u-boot.img fat 0 1",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_init(void)
 {
return 0;
diff --git a/include/configs/beagleplay.h b/include/configs/beagleplay.h
new file mode 100644
index 000..a1e196f10f5
--- /dev/null
+++ b/include/configs/beagleplay.h
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Configuration header file for BeaglePlay
+ *
+ * https://beagleplay.org/
+ *
+ * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#ifndef __CONFIG_BEAGLEPLAY_H
+#define __CONFIG_BEAGLEPLAY_H
+
+/**
+ * define BEAGLEPLAY_TIBOOT3_IMAGE_GUID - firmware GUID for BeaglePlay
+ *tiboot3.bin
+ * define BEAGLEPLAY_SPL_IMAGE_GUID - firmware GUID for BeaglePlay SPL
+ * define BEAGLEPLAY_UBOOT_IMAGE_GUID   - firmware GUID for BeaglePlay UBOOT
+ *
+ * These GUIDs are used in capsules updates to identify the corresponding
+ * firmware object.
+ *
+ * Board developers using this as a starting reference should
+ * define their own GUIDs to ensure that firmware repositories (like
+ * LVFS) do not confuse them.
+ */
+#define BEAGLEPLAY_TIBOOT3_IMAGE_GUID \
+   EFI_GUID(0x0e225a09, 0xf720, 0x4d57, 0x91, 0x20, \
+   0xe2, 0x8f, 0x73, 0x7f, 0x5a, 0x5e)
+
+#define BEAGLEPLAY_SPL_IMAGE_GUID \
+   EFI_GUID(0xb2e7cc49, 0x1a5a, 0x4036, 0xae, 0x01, \
+   0x33, 0x87, 0xc3, 0xbe, 0xf6, 0x57)
+
+#define BEAGLEPLAY_UBOOT_IMAGE_GUID \
+   EFI_GUID(0x92c92b11, 0xa7ee, 0x486f, 0xaa, 0xa2, \
+   0x71, 0x3d, 0x84, 0x42, 0x5b, 0x0e)
+
+/* Now for the remaining common defines */
+#include 
+
+#endif /* __CONFIG_BEAGLEPLAY_H */
-- 
2.34.1



[PATCH v3 13/19] doc: board: ti: am62px: document OSPI layout

2024-04-19 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 doc/board/ti/am62px_sk.rst | 48 ++
 1 file changed, 48 insertions(+)

diff --git a/doc/board/ti/am62px_sk.rst b/doc/board/ti/am62px_sk.rst
index 1f2982c36f9..7ff20fbf8e6 100644
--- a/doc/board/ti/am62px_sk.rst
+++ b/doc/board/ti/am62px_sk.rst
@@ -156,6 +156,54 @@ Image formats:
 .. image:: img/dm_tispl.bin.svg
   :alt: tispl.bin image format
 
+OSPI:
+-
+ROM supports booting from OSPI from offset 0x0.
+
+Flashing images to OSPI:
+
+Below commands can be used to download tiboot3.bin, tispl.bin, and u-boot.img,
+over tftp and then flash those to OSPI at their respective addresses.
+
+.. prompt:: bash =>
+
+  sf probe
+  tftp ${loadaddr} tiboot3.bin
+  sf update $loadaddr 0x0 $filesize
+  tftp ${loadaddr} tispl.bin
+  sf update $loadaddr 0x8 $filesize
+  tftp ${loadaddr} u-boot.img
+  sf update $loadaddr 0x28 $filesize
+
+Flash layout for OSPI:
+
+.. code-block:: console
+
+ 0x0 ++
+ | ospi.tiboot3(512k) |
+ ||
+ 0x8 ++
+ | ospi.tispl(2m) |
+ ||
+0x28 ++
+ | ospi.u-boot(4m)|
+ ||
+0x68 ++
+ | ospi.env(128k) |
+ ||
+0x6c ++
+ |   ospi.env.backup(128k)|
+ ||
+0x74 ++
+ |  padding (768k)|
+0x80 ++
+ | ospi.rootfs(ubifs) |
+ ||
+   0x3fc ++
+ |   ospi.phypattern (256k)   |
+ ||
+ ++
+
 A53 SPL DDR Memory Layout
 -
 
-- 
2.34.1



[PATCH v3 09/19] configs: beagleplay: Enable DFU for MMC

2024-04-19 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_beagleplay_a53_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/am62x_beagleplay_a53_defconfig 
b/configs/am62x_beagleplay_a53_defconfig
index 147967d3c11..68e103f58dc 100644
--- a/configs/am62x_beagleplay_a53_defconfig
+++ b/configs/am62x_beagleplay_a53_defconfig
@@ -70,6 +70,9 @@ CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
 CONFIG_CLK_TI_SCI=y
+CONFIG_DFU_MMC=y
+CONFIG_SYS_DFU_DATA_BUF_SIZE=0x4
+CONFIG_SYS_DFU_MAX_FILE_SIZE=0x18
 CONFIG_DMA_CHANNELS=y
 CONFIG_TI_K3_NAVSS_UDMA=y
 CONFIG_TI_SCI_PROTOCOL=y
-- 
2.34.1



[PATCH v3 06/19] configs: j721e: Enable EFI capsule update

2024-04-19 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/j721e_evm_a72_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
index 077bf508328..b8840a556e1 100644
--- a/configs/j721e_evm_a72_defconfig
+++ b/configs/j721e_evm_a72_defconfig
@@ -210,3 +210,5 @@ CONFIG_UFS=y
 CONFIG_CADENCE_UFS=y
 CONFIG_TI_J721E_UFS=y
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v3 15/19] board: am62x: Define capsule update firmware info

2024-04-19 Thread Jonathan Humphreys
Define the firmware components updatable via EFI capsule update, including
defining capsule GUIDs for the various firmware components for the AM62x SK.

Signed-off-by: Jonathan Humphreys 
---
 board/ti/am62x/evm.c| 32 
 include/configs/am62x_evm.h | 24 
 2 files changed, 56 insertions(+)

diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
index b3e8680dfab..cfcfe6add77 100644
--- a/board/ti/am62x/evm.c
+++ b/board/ti/am62x/evm.c
@@ -7,6 +7,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -46,6 +47,37 @@ int splash_screen_prepare(void)
 }
 #endif
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = AM62X_SK_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"AM62X_SK_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = AM62X_SK_SPL_IMAGE_GUID,
+   .fw_name = u"AM62X_SK_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = AM62X_SK_UBOOT_IMAGE_GUID,
+   .fw_name = u"AM62X_SK_UBOOT",
+   .image_index = 3,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "sf 0:0=tiboot3.bin raw 0 8;tispl.bin raw 8 
20;u-boot.img raw 28 40",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_init(void)
 {
return 0;
diff --git a/include/configs/am62x_evm.h b/include/configs/am62x_evm.h
index c8fe59b7531..0d98f14a4bc 100644
--- a/include/configs/am62x_evm.h
+++ b/include/configs/am62x_evm.h
@@ -9,6 +9,30 @@
 #ifndef __CONFIG_AM625_EVM_H
 #define __CONFIG_AM625_EVM_H
 
+/**
+ * define AM62X_SK_TIBOOT3_IMAGE_GUID - firmware GUID for AM62X sk tiboot3.bin
+ * define AM62X_SK_SPL_IMAGE_GUID - firmware GUID for AM62X sk SPL
+ * define AM62X_SK_UBOOT_IMAGE_GUID   - firmware GUID for AM62X sk UBOOT
+ *
+ * These GUIDs are used in capsules updates to identify the corresponding
+ * firmware object.
+ *
+ * Board developers using this as a starting reference should
+ * define their own GUIDs to ensure that firmware repositories (like
+ * LVFS) do not confuse them.
+ */
+#define AM62X_SK_TIBOOT3_IMAGE_GUID \
+   EFI_GUID(0xabcb83d2, 0x9cb6, 0x4351, 0xb8, 0xf1, \
+   0x64, 0x94, 0xbb, 0xe3, 0x70, 0x0a)
+
+#define AM62X_SK_SPL_IMAGE_GUID \
+   EFI_GUID(0xaee355fc, 0xbf97, 0x4264, 0x8c, 0x82, \
+   0x43, 0x72, 0x55, 0xef, 0xdc, 0x1d)
+
+#define AM62X_SK_UBOOT_IMAGE_GUID \
+   EFI_GUID(0x28ab8c6c, 0xfca8, 0x41d3, 0x8e, 0xa1, \
+   0x5f, 0x17, 0x1b, 0x7d, 0x29, 0x29)
+
 /* Now for the remaining common defines */
 #include 
 
-- 
2.34.1



[PATCH v2 01/16] board: Define GUIDs for firmware images

2024-04-08 Thread Jonathan Humphreys
Define GUIDs for the different firmware images (tiboot3.bin, tispl.bin,
u-boot.img, sysfw).

Signed-off-by: Jonathan Humphreys 
---
 include/configs/ti_armv7_common.h | 17 +
 1 file changed, 17 insertions(+)

diff --git a/include/configs/ti_armv7_common.h 
b/include/configs/ti_armv7_common.h
index 3def7b1027e..4ce14a9b84c 100644
--- a/include/configs/ti_armv7_common.h
+++ b/include/configs/ti_armv7_common.h
@@ -16,6 +16,23 @@
 #ifndef __CONFIG_TI_ARMV7_COMMON_H__
 #define __CONFIG_TI_ARMV7_COMMON_H__
 
+/* GUIDs for capsule updatable firmware images */
+#define K3_TIBOOT3_IMAGE_GUID \
+   EFI_GUID(0xe672b518, 0x7cd7, 0x4014, 0xbd, 0x8d, \
+0x40, 0x72, 0x4d, 0x0a, 0xd4, 0xdc)
+
+#define K3_SPL_IMAGE_GUID \
+   EFI_GUID(0x86f710ad, 0x10cf, 0x46ea, 0xac, 0x67, \
+0x85, 0x6a, 0xe0, 0x6e, 0xfa, 0xd2)
+
+#define K3_UBOOT_IMAGE_GUID \
+   EFI_GUID(0x81b58fb0, 0x3b00, 0x4add, 0xa2, 0x0a, \
+0xc1, 0x85, 0xbb, 0xac, 0xa1, 0xed)
+
+#define K3_SYSFW_IMAGE_GUID \
+   EFI_GUID(0x6fd10680, 0x361b, 0x431f, 0x80, 0xaa, \
+0x89, 0x94, 0x55, 0x81, 0x9e, 0x11)
+
 /*
  * We setup defaults based on constraints from the Linux kernel, which should
  * also be safe elsewhere.  We have the default load at 32MB into DDR (for
-- 
2.34.1



[PATCH v2 15/16] board: beagleboneai64: Define capsule update firmware info

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 board/beagle/beagleboneai64/beagleboneai64.c | 38 
 1 file changed, 38 insertions(+)

diff --git a/board/beagle/beagleboneai64/beagleboneai64.c 
b/board/beagle/beagleboneai64/beagleboneai64.c
index c5b4ff7df47..b6ef1c137cb 100644
--- a/board/beagle/beagleboneai64/beagleboneai64.c
+++ b/board/beagle/beagleboneai64/beagleboneai64.c
@@ -7,6 +7,7 @@
  * Copyright (C) 2022-2023 Robert Nelson, BeagleBoard.org Foundation
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -14,6 +15,43 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = K3_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"K3_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = K3_SPL_IMAGE_GUID,
+   .fw_name = u"K3_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = K3_UBOOT_IMAGE_GUID,
+   .fw_name = u"K3_UBOOT",
+   .image_index = 3,
+   },
+   {
+   .image_type_id = K3_SYSFW_IMAGE_GUID,
+   .fw_name = u"K3_SYSFW",
+   .image_index = 4,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "mmc 0=tiboot3.bin raw 0 2000 mmcpart 1;tispl.bin fat 0 
1;u-boot.img fat 0 1; sysfw.itb fat 0 1",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_init(void)
 {
return 0;
-- 
2.34.1



[PATCH v2 11/16] configs: am62x: Enable serial flash DFU

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_evm_a53_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig
index d650b8575b6..0e6c94de538 100644
--- a/configs/am62x_evm_a53_defconfig
+++ b/configs/am62x_evm_a53_defconfig
@@ -67,6 +67,7 @@ CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
 CONFIG_CLK_TI_SCI=y
+CONFIG_DFU_SF=y
 CONFIG_DMA_CHANNELS=y
 CONFIG_TI_K3_NAVSS_UDMA=y
 CONFIG_TI_SCI_PROTOCOL=y
-- 
2.34.1



[PATCH v2 06/16] board: beagleplay: Define capsule update firmware info

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 board/beagle/beagleplay/beagleplay.c | 33 
 1 file changed, 33 insertions(+)

diff --git a/board/beagle/beagleplay/beagleplay.c 
b/board/beagle/beagleplay/beagleplay.c
index af36439e2e2..519c63d9608 100644
--- a/board/beagle/beagleplay/beagleplay.c
+++ b/board/beagle/beagleplay/beagleplay.c
@@ -6,6 +6,7 @@
  * Copyright (C) 2022-2023 Robert Nelson, BeagleBoard.org Foundation
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -15,6 +16,38 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = K3_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"K3_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = K3_SPL_IMAGE_GUID,
+   .fw_name = u"K3_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = K3_UBOOT_IMAGE_GUID,
+   .fw_name = u"K3_UBOOT",
+   .image_index = 3,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "mmc 0=tiboot3.bin raw 0 2000 mmcpart 1;tispl.bin fat 0 
1;u-boot.img fat 0 1",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_init(void)
 {
return 0;
-- 
2.34.1



[PATCH v2 16/16] configs: beagleboneai64: Enable EFI capsule update

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/j721e_beagleboneai64_a72_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/j721e_beagleboneai64_a72_defconfig 
b/configs/j721e_beagleboneai64_a72_defconfig
index 3d234bc1a8f..e74ee68e23e 100644
--- a/configs/j721e_beagleboneai64_a72_defconfig
+++ b/configs/j721e_beagleboneai64_a72_defconfig
@@ -172,3 +172,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x6163
 CONFIG_SPL_DFU=y
 CONFIG_LZO=y
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v2 05/16] configs: j721e: Enable EFI capsule update

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/j721e_evm_a72_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
index 077bf508328..b8840a556e1 100644
--- a/configs/j721e_evm_a72_defconfig
+++ b/configs/j721e_evm_a72_defconfig
@@ -210,3 +210,5 @@ CONFIG_UFS=y
 CONFIG_CADENCE_UFS=y
 CONFIG_TI_J721E_UFS=y
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v2 13/16] board: am62x: Define capsule update firmware info

2024-04-08 Thread Jonathan Humphreys
Define the firmwares updatable via EFI capsule update.

Signed-off-by: Jonathan Humphreys 
---
 board/ti/am62x/evm.c | 32 
 1 file changed, 32 insertions(+)

diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
index b3e8680dfab..3341308c9ae 100644
--- a/board/ti/am62x/evm.c
+++ b/board/ti/am62x/evm.c
@@ -7,6 +7,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -46,6 +47,37 @@ int splash_screen_prepare(void)
 }
 #endif
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = K3_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"K3_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = K3_SPL_IMAGE_GUID,
+   .fw_name = u"K3_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = K3_UBOOT_IMAGE_GUID,
+   .fw_name = u"K3_UBOOT",
+   .image_index = 3,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "sf 0:0=tiboot3.bin raw 0 8;tispl.bin raw 8 
20;u-boot.img raw 28 48",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_init(void)
 {
return 0;
-- 
2.34.1



[PATCH v2 09/16] board: am62px: Define capsule update firmware info

2024-04-08 Thread Jonathan Humphreys
Define the firmwares updatable via EFI capsule update.

Signed-off-by: Jonathan Humphreys 
---
 board/ti/am62px/evm.c | 32 
 1 file changed, 32 insertions(+)

diff --git a/board/ti/am62px/evm.c b/board/ti/am62px/evm.c
index 97a95ce8cc2..149ff8eedc7 100644
--- a/board/ti/am62px/evm.c
+++ b/board/ti/am62px/evm.c
@@ -6,6 +6,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -13,6 +14,37 @@
 #include 
 #include 
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = K3_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"K3_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = K3_SPL_IMAGE_GUID,
+   .fw_name = u"K3_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = K3_UBOOT_IMAGE_GUID,
+   .fw_name = u"K3_UBOOT",
+   .image_index = 3,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "sf 0:0=tiboot3.bin raw 0 8;tispl.bin raw 8 
20;u-boot.img raw 28 40",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_init(void)
 {
return 0;
-- 
2.34.1



[PATCH v2 03/16] configs: am64x: Enable EFI capsule update

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am64x_evm_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am64x_evm_a53_defconfig b/configs/am64x_evm_a53_defconfig
index 61b498b49a6..8ba17ea89f9 100644
--- a/configs/am64x_evm_a53_defconfig
+++ b/configs/am64x_evm_a53_defconfig
@@ -177,3 +177,5 @@ CONFIG_USB_FUNCTION_MASS_STORAGE=y
 CONFIG_SPL_DFU=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v2 02/16] board: am64x: Define capsule update firmware info

2024-04-08 Thread Jonathan Humphreys
Define the firmwares updatable via EFI capsule update.

Signed-off-by: Jonathan Humphreys 
---
 board/ti/am64x/evm.c | 33 +
 1 file changed, 33 insertions(+)

diff --git a/board/ti/am64x/evm.c b/board/ti/am64x/evm.c
index b8de69da06c..876c5c25d42 100644
--- a/board/ti/am64x/evm.c
+++ b/board/ti/am64x/evm.c
@@ -7,6 +7,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -27,6 +28,38 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = K3_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"K3_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = K3_SPL_IMAGE_GUID,
+   .fw_name = u"K3_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = K3_UBOOT_IMAGE_GUID,
+   .fw_name = u"K3_UBOOT",
+   .image_index = 3,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "sf 0:0=tiboot3.bin raw 0 10;tispl.bin raw 10 
20;u-boot.img raw 30 40",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_init(void)
 {
return 0;
-- 
2.34.1



[PATCH v2 04/16] board: j721e: Define capsule update firmware info

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 board/ti/j721e/evm.c | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index 9dc3ed6dfff..d345148be32 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -7,6 +7,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -32,6 +33,43 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = K3_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"K3_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = K3_SPL_IMAGE_GUID,
+   .fw_name = u"K3_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = K3_UBOOT_IMAGE_GUID,
+   .fw_name = u"K3_UBOOT",
+   .image_index = 3,
+   },
+   {
+   .image_type_id = K3_SYSFW_IMAGE_GUID,
+   .fw_name = u"K3_SYSFW",
+   .image_index = 4,
+   }
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "sf 0:0=tiboot3.bin raw 0 8;tispl.bin raw 8 
20;u-boot.img raw 28 40;sysfw.itb raw 6C 10",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_init(void)
 {
return 0;
-- 
2.34.1



[PATCH v2 07/16] configs: beagleplay: Enable DFU for MMC

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_beagleplay_a53_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/am62x_beagleplay_a53_defconfig 
b/configs/am62x_beagleplay_a53_defconfig
index 147967d3c11..68e103f58dc 100644
--- a/configs/am62x_beagleplay_a53_defconfig
+++ b/configs/am62x_beagleplay_a53_defconfig
@@ -70,6 +70,9 @@ CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
 CONFIG_CLK_TI_SCI=y
+CONFIG_DFU_MMC=y
+CONFIG_SYS_DFU_DATA_BUF_SIZE=0x4
+CONFIG_SYS_DFU_MAX_FILE_SIZE=0x18
 CONFIG_DMA_CHANNELS=y
 CONFIG_TI_K3_NAVSS_UDMA=y
 CONFIG_TI_SCI_PROTOCOL=y
-- 
2.34.1



[PATCH v2 08/16] configs: beagleplay: Enable EFI capsule update

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_beagleplay_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am62x_beagleplay_a53_defconfig 
b/configs/am62x_beagleplay_a53_defconfig
index 68e103f58dc..23b9c466248 100644
--- a/configs/am62x_beagleplay_a53_defconfig
+++ b/configs/am62x_beagleplay_a53_defconfig
@@ -124,3 +124,5 @@ CONFIG_EXT4_WRITE=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_LZO=y
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v2 10/16] configs: am62px: Enable EFI capsule update

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62px_evm_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am62px_evm_a53_defconfig b/configs/am62px_evm_a53_defconfig
index 65dfda19f18..15ba1079760 100644
--- a/configs/am62px_evm_a53_defconfig
+++ b/configs/am62px_evm_a53_defconfig
@@ -176,3 +176,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
 CONFIG_SPL_DFU=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v2 14/16] configs: am62x: Enable EFI capsule update

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_evm_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig
index 0e6c94de538..11af7b517d1 100644
--- a/configs/am62x_evm_a53_defconfig
+++ b/configs/am62x_evm_a53_defconfig
@@ -111,3 +111,5 @@ CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH v2 00/16] EFI: ti: Enable EFI capsule updates

2024-04-08 Thread Jonathan Humphreys
Enable on disk capsule updates, which includes defining the firmware components
(tiboot3, spl, u-boot) and enabling processing of raw capsule updates.

This is enabled for several TI SoC based platforms: AM64, AM62, AM62p,
BeaglePlay, J7, and BeagleboneAI.

This series also includes enabling seral flash DFU for AM62 and MMC DFU for
beagleplay, and adding the sysreset controller node for AM62 to enable system
reset.

Changes from v1:
- Added sysfw.itb capsule definition to beagleboneai64
- removed extra commas in structure definitions

Jonathan Humphreys (16):
  board: Define GUIDs for firmware images
  board: am64x: Define capsule update firmware info
  configs: am64x: Enable EFI capsule update
  board: j721e: Define capsule update firmware info
  configs: j721e: Enable EFI capsule update
  board: beagleplay: Define capsule update firmware info
  configs: beagleplay: Enable DFU for MMC
  configs: beagleplay: Enable EFI capsule update
  board: am62px: Define capsule update firmware info
  configs: am62px: Enable EFI capsule update
  configs: am62x: Enable serial flash DFU
  arm: dts: k3-am625-sk-u-boot: Add sysreset-controller node
  board: am62x: Define capsule update firmware info
  configs: am62x: Enable EFI capsule update
  board: beagleboneai64: Define capsule update firmware info
  configs: beagleboneai64: Enable EFI capsule update

 arch/arm/dts/k3-am625-sk-u-boot.dtsi |  9 +
 board/beagle/beagleboneai64/beagleboneai64.c | 38 
 board/beagle/beagleplay/beagleplay.c | 33 +
 board/ti/am62px/evm.c| 32 +
 board/ti/am62x/evm.c | 32 +
 board/ti/am64x/evm.c | 33 +
 board/ti/j721e/evm.c | 38 
 configs/am62px_evm_a53_defconfig |  2 ++
 configs/am62x_beagleplay_a53_defconfig   |  5 +++
 configs/am62x_evm_a53_defconfig  |  3 ++
 configs/am64x_evm_a53_defconfig  |  2 ++
 configs/j721e_beagleboneai64_a72_defconfig   |  2 ++
 configs/j721e_evm_a72_defconfig  |  2 ++
 include/configs/ti_armv7_common.h| 17 +
 14 files changed, 248 insertions(+)

-- 
2.34.1



[PATCH v2 12/16] arm: dts: k3-am625-sk-u-boot: Add sysreset-controller node

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 arch/arm/dts/k3-am625-sk-u-boot.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/dts/k3-am625-sk-u-boot.dtsi 
b/arch/arm/dts/k3-am625-sk-u-boot.dtsi
index fa778b0ff4c..35bfeae75a0 100644
--- a/arch/arm/dts/k3-am625-sk-u-boot.dtsi
+++ b/arch/arm/dts/k3-am625-sk-u-boot.dtsi
@@ -46,3 +46,12 @@
 _port2 {
status = "disabled";
 };
+
+ {
+   bootph-pre-ram;
+
+   k3_sysreset: sysreset-controller {
+   compatible = "ti,sci-sysreset";
+   bootph-pre-ram;
+   };
+};
-- 
2.34.1



[PATCH 4/7] dts: beagleplay: binman: Include firmware capsules binman nodes

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi | 9 +
 arch/arm/dts/k3-am625-r5-beagleplay.dts  | 5 +
 2 files changed, 14 insertions(+)

diff --git a/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi 
b/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi
index cca0f44b7d8..315f42e7464 100644
--- a/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi
+++ b/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi
@@ -212,4 +212,13 @@
};
};
 };
+
+#include "k3-binman-capsule.dtsi"
+_name {
+   filename = "tispl.bin_unsigned";
+};
+_name {
+   filename = "u-boot.img_unsigned";
+};
+
 #endif
diff --git a/arch/arm/dts/k3-am625-r5-beagleplay.dts 
b/arch/arm/dts/k3-am625-r5-beagleplay.dts
index 9db58f093c8..5ee0c2bd56d 100644
--- a/arch/arm/dts/k3-am625-r5-beagleplay.dts
+++ b/arch/arm/dts/k3-am625-r5-beagleplay.dts
@@ -114,3 +114,8 @@
 
};
 };
+
+#include "k3-binman-capsule-r5.dtsi"
+_name {
+   filename = "tiboot3-am62x-gp-evm.bin";
+};
-- 
2.34.1



[PATCH 5/7] dts: am62px: binman: Include base K3 firmware capsule binman nodes

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 arch/arm/dts/k3-am62p-sk-binman.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/dts/k3-am62p-sk-binman.dtsi 
b/arch/arm/dts/k3-am62p-sk-binman.dtsi
index dea14945bf5..9b27c879f79 100644
--- a/arch/arm/dts/k3-am62p-sk-binman.dtsi
+++ b/arch/arm/dts/k3-am62p-sk-binman.dtsi
@@ -59,6 +59,8 @@
};
 };
 
+#include "k3-binman-capsule-r5.dtsi"
+
 #endif /* CONFIG_TARGET_AM62P5_R5_EVM */
 
 #if IS_ENABLED(CONFIG_TARGET_AM62P5_A53_EVM)
@@ -170,4 +172,6 @@
};
 };
 
+#include "k3-binman-capsule.dtsi"
+
 #endif /* CONFIG_TARGET_AM62P5_A53_EVM */
-- 
2.34.1



[PATCH 1/7] dts: ti: binman: Add base K3 firmware capsule nodes

2024-04-08 Thread Jonathan Humphreys
Create capsule files for tiboot3.bin, tispl.bin, and u-boot.img.

Signed-off-by: Jonathan Humphreys 
---
 arch/arm/dts/k3-binman-capsule-r5.dtsi | 24 +++
 arch/arm/dts/k3-binman-capsule.dtsi| 42 ++
 2 files changed, 66 insertions(+)
 create mode 100644 arch/arm/dts/k3-binman-capsule-r5.dtsi
 create mode 100644 arch/arm/dts/k3-binman-capsule.dtsi

diff --git a/arch/arm/dts/k3-binman-capsule-r5.dtsi 
b/arch/arm/dts/k3-binman-capsule-r5.dtsi
new file mode 100644
index 000..7a20afa46aa
--- /dev/null
+++ b/arch/arm/dts/k3-binman-capsule-r5.dtsi
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+// Capsue update GUIDs.  See ti_armv7_common.h.
+#define K3_TIBOOT3_IMAGE_UUID_STR "e672b518-7cd7-4014-bd8d-40724d0ad4dc"
+
+ {
+   capsule-tiboot3 {
+   filename = "tiboot3-capsule.bin";
+   efi-capsule {
+   image-index = <0x1>;
+   image-guid = K3_TIBOOT3_IMAGE_UUID_STR;
+   private-key = "arch/arm/mach-k3/keys/custMpk.pem";
+   public-key-cert = "arch/arm/mach-k3/keys/custMpk.crt";
+   monotonic-count = <0x1>;
+
+   tiboot3_name: blob {
+   filename = "tiboot3.bin";
+   };
+   };
+   };
+};
diff --git a/arch/arm/dts/k3-binman-capsule.dtsi 
b/arch/arm/dts/k3-binman-capsule.dtsi
new file mode 100644
index 000..4f11ca6f0ef
--- /dev/null
+++ b/arch/arm/dts/k3-binman-capsule.dtsi
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+// Capsue update GUIDs.  See ti_armv7_common.h.
+#define K3_SPL_IMAGE_UUID_STR "86f710ad-10cf-46ea-ac67-856ae06efad2"
+#define K3_UBOOT_IMAGE_UUID_STR "81b58fb0-3b00-4add-a20a-c185bbaca1ed"
+
+ {
+   capsule-tispl {
+   filename = "tispl-capsule.bin";
+   efi-capsule {
+   image-index = <0x2>;
+   image-guid = K3_SPL_IMAGE_UUID_STR;
+   private-key = "arch/arm/mach-k3/keys/custMpk.pem";
+   public-key-cert = "arch/arm/mach-k3/keys/custMpk.crt";
+   monotonic-count = <0x1>;
+
+   tispl_name: blob {
+   filename = "tispl.bin";
+   };
+   };
+   };
+};
+
+ {
+   capsule-uboot {
+   filename = "uboot-capsule.bin";
+   efi-capsule {
+   image-index = <0x3>;
+   image-guid = K3_UBOOT_IMAGE_UUID_STR;
+   private-key = "arch/arm/mach-k3/keys/custMpk.pem";
+   public-key-cert = "arch/arm/mach-k3/keys/custMpk.crt";
+   monotonic-count = <0x1>;
+
+   uboot_name: blob {
+   filename = "u-boot.img";
+   };
+   };
+   };
+};
-- 
2.34.1



[PATCH 3/7] dts: j721e: binman: Include firmware capsules binman nodes

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 arch/arm/dts/k3-j721e-binman.dtsi | 32 +++
 1 file changed, 32 insertions(+)

diff --git a/arch/arm/dts/k3-j721e-binman.dtsi 
b/arch/arm/dts/k3-j721e-binman.dtsi
index 75a6e9599b9..9169551c422 100644
--- a/arch/arm/dts/k3-j721e-binman.dtsi
+++ b/arch/arm/dts/k3-j721e-binman.dtsi
@@ -207,6 +207,29 @@
};
};
 };
+
+#include "k3-binman-capsule-r5.dtsi"
+
+// Capsue update GUIDs.  See ti_armv7_common.h.
+#define K3_SYSFW_IMAGE_UUID_STR "6fd10680-361b-431f-80aa-899455819e11"
+
+ {
+   capsule-sysfw {
+   filename = "sysfw-capsule.bin";
+   efi-capsule {
+   image-index = <0x4>;
+   image-guid = K3_SYSFW_IMAGE_UUID_STR;
+   private-key = "arch/arm/mach-k3/keys/custMpk.pem";
+   public-key-cert = "arch/arm/mach-k3/keys/custMpk.crt";
+   monotonic-count = <0x1>;
+
+   blob {
+   filename = "sysfw.itb";
+   };
+   };
+   };
+};
+
 #endif
 
 #ifdef CONFIG_TARGET_J721E_A72_EVM
@@ -585,4 +608,13 @@
};
};
 };
+
+#include "k3-binman-capsule.dtsi"
+_name {
+   filename = "tispl.bin_unsigned";
+};
+_name {
+   filename = "u-boot.img_unsigned";
+};
+
 #endif
-- 
2.34.1



[PATCH 6/7] dts: am62x: binman: Include base K3 firmware capsule binman nodes

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 arch/arm/dts/k3-am625-sk-binman.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/dts/k3-am625-sk-binman.dtsi 
b/arch/arm/dts/k3-am625-sk-binman.dtsi
index 5b058bd03a0..921c2bdcc5e 100644
--- a/arch/arm/dts/k3-am625-sk-binman.dtsi
+++ b/arch/arm/dts/k3-am625-sk-binman.dtsi
@@ -137,6 +137,8 @@
};
 };
 
+#include "k3-binman-capsule-r5.dtsi"
+
 #endif
 
 #ifdef CONFIG_TARGET_AM625_A53_EVM
@@ -315,4 +317,7 @@
};
};
 };
+
+#include "k3-binman-capsule.dtsi"
+
 #endif
-- 
2.34.1



[PATCH 2/7] dts: am64x: binman: Include base K3 firmware capsule binman nodes

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 arch/arm/dts/k3-am64x-binman.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/dts/k3-am64x-binman.dtsi 
b/arch/arm/dts/k3-am64x-binman.dtsi
index 37817ba60d2..89cf048db1f 100644
--- a/arch/arm/dts/k3-am64x-binman.dtsi
+++ b/arch/arm/dts/k3-am64x-binman.dtsi
@@ -114,6 +114,8 @@
};
 };
 
+#include "k3-binman-capsule-r5.dtsi"
+
 #endif
 
 #ifdef CONFIG_TARGET_AM642_A53_EVM
@@ -373,4 +375,7 @@
};
};
 };
+
+#include "k3-binman-capsule.dtsi"
+
 #endif
-- 
2.34.1



[PATCH 7/7] dts: beagleboneai64: binman: Include firmware capsules binman nodes

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 .../dts/k3-j721e-beagleboneai64-u-boot.dtsi   |  9 
 arch/arm/dts/k3-j721e-r5-beagleboneai64.dts   | 22 +++
 2 files changed, 31 insertions(+)

diff --git a/arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi 
b/arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi
index 116ee373118..a3c5fa1f0b5 100644
--- a/arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi
+++ b/arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi
@@ -355,4 +355,13 @@
};
};
 };
+
+#include "k3-binman-capsule.dtsi"
+_name {
+   filename = "tispl.bin_unsigned";
+};
+_name {
+   filename = "u-boot.img_unsigned";
+};
+
 #endif
diff --git a/arch/arm/dts/k3-j721e-r5-beagleboneai64.dts 
b/arch/arm/dts/k3-j721e-r5-beagleboneai64.dts
index 43da4dafba8..1a98ad9e34f 100644
--- a/arch/arm/dts/k3-j721e-r5-beagleboneai64.dts
+++ b/arch/arm/dts/k3-j721e-r5-beagleboneai64.dts
@@ -183,3 +183,25 @@
};
};
 };
+
+#include "k3-binman-capsule-r5.dtsi"
+
+// Capsue update GUIDs.  See ti_armv7_common.h.
+#define K3_SYSFW_IMAGE_UUID_STR "6fd10680-361b-431f-80aa-899455819e11"
+
+ {
+   capsule-sysfw {
+   filename = "sysfw-capsule.bin";
+   efi-capsule {
+   image-index = <0x4>;
+   image-guid = K3_SYSFW_IMAGE_UUID_STR;
+   private-key = "arch/arm/mach-k3/keys/custMpk.pem";
+   public-key-cert = "arch/arm/mach-k3/keys/custMpk.crt";
+   monotonic-count = <0x1>;
+
+   blob {
+   filename = "sysfw.itb";
+   };
+   };
+   };
+};
-- 
2.34.1



[PATCH 0/7] binman: ti: create binman nodes for EFI capsules

2024-04-08 Thread Jonathan Humphreys
Add binman nodes for EFI capsules of firmware components.

This is enabled for several TI SoC based platforms: AM64, AM62, AM62p,
BeaglePlay, J7, and BeagleboneAI.

Jonathan Humphreys (7):
  dts: ti: binman: Add base K3 firmware capsule nodes
  dts: am64x: binman: Include base K3 firmware capsule binman nodes
  dts: j721e: binman: Include firmware capsules binman nodes
  dts: beagleplay: binman: Include firmware capsules binman nodes
  dts: am62px: binman: Include base K3 firmware capsule binman nodes
  dts: am62x: binman: Include base K3 firmware capsule binman nodes
  dts: beagleboneai64: binman: Include firmware capsules binman nodes

 arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi  |  9 
 arch/arm/dts/k3-am625-r5-beagleplay.dts   |  5 +++
 arch/arm/dts/k3-am625-sk-binman.dtsi  |  5 +++
 arch/arm/dts/k3-am62p-sk-binman.dtsi  |  4 ++
 arch/arm/dts/k3-am64x-binman.dtsi |  5 +++
 arch/arm/dts/k3-binman-capsule-r5.dtsi| 24 +++
 arch/arm/dts/k3-binman-capsule.dtsi   | 42 +++
 .../dts/k3-j721e-beagleboneai64-u-boot.dtsi   |  9 
 arch/arm/dts/k3-j721e-binman.dtsi | 32 ++
 arch/arm/dts/k3-j721e-r5-beagleboneai64.dts   | 22 ++
 10 files changed, 157 insertions(+)
 create mode 100644 arch/arm/dts/k3-binman-capsule-r5.dtsi
 create mode 100644 arch/arm/dts/k3-binman-capsule.dtsi

-- 
2.34.1



[PATCH 05/13] configs: j721e: Enable capsule authentication

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/j721e_evm_a72_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
index 83bc0576821..c522d8cc9ee 100644
--- a/configs/j721e_evm_a72_defconfig
+++ b/configs/j721e_evm_a72_defconfig
@@ -212,4 +212,5 @@ CONFIG_TI_J721E_UFS=y
 CONFIG_EFI_SET_TIME=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
+CONFIG_EFI_CAPSULE_AUTHENTICATE=y
 CONFIG_EFI_CAPSULE_ESL_FILE="arch/arm/mach-k3/keys/custMpk.esl"
-- 
2.34.1



[PATCH 13/13] configs: beagleboneai64: Enable capsule authentication

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/j721e_beagleboneai64_a72_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/j721e_beagleboneai64_a72_defconfig 
b/configs/j721e_beagleboneai64_a72_defconfig
index 5aeb4c08d31..c1d30b3db68 100644
--- a/configs/j721e_beagleboneai64_a72_defconfig
+++ b/configs/j721e_beagleboneai64_a72_defconfig
@@ -174,4 +174,5 @@ CONFIG_LZO=y
 CONFIG_EFI_SET_TIME=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
+CONFIG_EFI_CAPSULE_AUTHENTICATE=y
 CONFIG_EFI_CAPSULE_ESL_FILE="arch/arm/mach-k3/keys/custMpk.esl"
-- 
2.34.1



[PATCH 08/13] configs: am62px: Set capsule update signature list file

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62px_evm_a53_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/am62px_evm_a53_defconfig b/configs/am62px_evm_a53_defconfig
index 15ba1079760..ea72eaf2d42 100644
--- a/configs/am62px_evm_a53_defconfig
+++ b/configs/am62px_evm_a53_defconfig
@@ -178,3 +178,4 @@ CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
+CONFIG_EFI_CAPSULE_ESL_FILE="arch/arm/mach-k3/keys/custMpk.esl"
-- 
2.34.1



[PATCH 10/13] configs: am62x: Set capsule update signature list file

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_evm_a53_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig
index 11af7b517d1..1accae81564 100644
--- a/configs/am62x_evm_a53_defconfig
+++ b/configs/am62x_evm_a53_defconfig
@@ -113,3 +113,4 @@ CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
+CONFIG_EFI_CAPSULE_ESL_FILE="arch/arm/mach-k3/keys/custMpk.esl"
-- 
2.34.1



[PATCH 03/13] configs: am64x: Enable capsule authentication

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am64x_evm_a53_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/am64x_evm_a53_defconfig b/configs/am64x_evm_a53_defconfig
index 5594d26844e..8490d4e36a8 100644
--- a/configs/am64x_evm_a53_defconfig
+++ b/configs/am64x_evm_a53_defconfig
@@ -179,4 +179,5 @@ CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
+CONFIG_EFI_CAPSULE_AUTHENTICATE=y
 CONFIG_EFI_CAPSULE_ESL_FILE="arch/arm/mach-k3/keys/custMpk.esl"
-- 
2.34.1



[PATCH 11/13] configs: am62x: Enable capsule authentication

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_evm_a53_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig
index 1accae81564..772a6551ff2 100644
--- a/configs/am62x_evm_a53_defconfig
+++ b/configs/am62x_evm_a53_defconfig
@@ -113,4 +113,5 @@ CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
+CONFIG_EFI_CAPSULE_AUTHENTICATE=y
 CONFIG_EFI_CAPSULE_ESL_FILE="arch/arm/mach-k3/keys/custMpk.esl"
-- 
2.34.1



[PATCH 06/13] configs: beagleplay: Set capsule update signature list file

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_beagleplay_a53_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/am62x_beagleplay_a53_defconfig 
b/configs/am62x_beagleplay_a53_defconfig
index 23b9c466248..4e0dcf70b25 100644
--- a/configs/am62x_beagleplay_a53_defconfig
+++ b/configs/am62x_beagleplay_a53_defconfig
@@ -126,3 +126,4 @@ CONFIG_LZO=y
 CONFIG_EFI_SET_TIME=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
+CONFIG_EFI_CAPSULE_ESL_FILE="arch/arm/mach-k3/keys/custMpk.esl"
-- 
2.34.1



[PATCH 07/13] configs: beagleplay: Enable capsule authentication

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_beagleplay_a53_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/am62x_beagleplay_a53_defconfig 
b/configs/am62x_beagleplay_a53_defconfig
index 4e0dcf70b25..99258804f92 100644
--- a/configs/am62x_beagleplay_a53_defconfig
+++ b/configs/am62x_beagleplay_a53_defconfig
@@ -126,4 +126,5 @@ CONFIG_LZO=y
 CONFIG_EFI_SET_TIME=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
+CONFIG_EFI_CAPSULE_AUTHENTICATE=y
 CONFIG_EFI_CAPSULE_ESL_FILE="arch/arm/mach-k3/keys/custMpk.esl"
-- 
2.34.1



[PATCH 09/13] configs: am62px: Enable capsule authentication

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62px_evm_a53_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/am62px_evm_a53_defconfig b/configs/am62px_evm_a53_defconfig
index ea72eaf2d42..9e633293d49 100644
--- a/configs/am62px_evm_a53_defconfig
+++ b/configs/am62px_evm_a53_defconfig
@@ -178,4 +178,5 @@ CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
+CONFIG_EFI_CAPSULE_AUTHENTICATE=y
 CONFIG_EFI_CAPSULE_ESL_FILE="arch/arm/mach-k3/keys/custMpk.esl"
-- 
2.34.1



[PATCH 12/13] configs: beagleboneai64: Set capsule update signature list file

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/j721e_beagleboneai64_a72_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/j721e_beagleboneai64_a72_defconfig 
b/configs/j721e_beagleboneai64_a72_defconfig
index e74ee68e23e..5aeb4c08d31 100644
--- a/configs/j721e_beagleboneai64_a72_defconfig
+++ b/configs/j721e_beagleboneai64_a72_defconfig
@@ -174,3 +174,4 @@ CONFIG_LZO=y
 CONFIG_EFI_SET_TIME=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
+CONFIG_EFI_CAPSULE_ESL_FILE="arch/arm/mach-k3/keys/custMpk.esl"
-- 
2.34.1



[PATCH 02/13] configs: am64x: Set capsule update signature list file

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am64x_evm_a53_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/am64x_evm_a53_defconfig b/configs/am64x_evm_a53_defconfig
index 8ba17ea89f9..5594d26844e 100644
--- a/configs/am64x_evm_a53_defconfig
+++ b/configs/am64x_evm_a53_defconfig
@@ -179,3 +179,4 @@ CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
+CONFIG_EFI_CAPSULE_ESL_FILE="arch/arm/mach-k3/keys/custMpk.esl"
-- 
2.34.1



[PATCH 00/13] EFI: capsule: ti: enable authenticated capsules

2024-04-08 Thread Jonathan Humphreys
Create an EFI signature list (.esl) file based on the TI dummy key.
Enable capsule authentication for several TI SoC based platforms: AM64, AM62,
AM62p, BeaglePlay, J7, and BeagleboneAI.

Jonathan Humphreys (13):
  ti:keys Add EFI signature list
  configs: am64x: Set capsule update signature list file
  configs: am64x: Enable capsule authentication
  configs: j721e: Set capsule update signature list file
  configs: j721e: Enable capsule authentication
  configs: beagleplay: Set capsule update signature list file
  configs: beagleplay: Enable capsule authentication
  configs: am62px: Set capsule update signature list file
  configs: am62px: Enable capsule authentication
  configs: am62x: Set capsule update signature list file
  configs: am62x: Enable capsule authentication
  configs: beagleboneai64: Set capsule update signature list file
  configs: beagleboneai64: Enable capsule authentication

 arch/arm/mach-k3/keys/custMpk.esl  | Bin 0 -> 1523 bytes
 configs/am62px_evm_a53_defconfig   |   2 ++
 configs/am62x_beagleplay_a53_defconfig |   2 ++
 configs/am62x_evm_a53_defconfig|   2 ++
 configs/am64x_evm_a53_defconfig|   2 ++
 configs/j721e_beagleboneai64_a72_defconfig |   2 ++
 configs/j721e_evm_a72_defconfig|   2 ++
 7 files changed, 12 insertions(+)
 create mode 100644 arch/arm/mach-k3/keys/custMpk.esl

-- 
2.34.1



[PATCH 01/13] ti:keys Add EFI signature list

2024-04-08 Thread Jonathan Humphreys
EFI signature list using TI dummy keys.

Signed-off-by: Jonathan Humphreys 
---
 arch/arm/mach-k3/keys/custMpk.esl | Bin 0 -> 1523 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-k3/keys/custMpk.esl

diff --git a/arch/arm/mach-k3/keys/custMpk.esl 
b/arch/arm/mach-k3/keys/custMpk.esl
new file mode 100644
index 
..2feb704e0a5fd126410de451d3c0fa4d3edccc52
GIT binary patch
literal 1523
zcmZ1^?2Da*aux2_hA(f&~MnUw(yu0v@E4?-F=u^u*PVqVQ8QZ((-^A*$m*Kg7c
z&78AJODc2mtxpELY@Awc9)w85y}*84Mcd8gd(OvN4CUun9AT2E#ZUJWL@GhWtR)
zKpA!(HkZVloWx>7bput902hy3NNPo5v4Uq_aY<2WZfaf$h@G5YRFGekSdyAzC~P1I
zQpnB26;PC)oLXF*UsMbeWai-t@l*_blshP#N9QH-w`BJNO+QS$x7=il`0?bc6sZ`Vxxl^6N{>i2E;SY*4-T$+0G;)5dxe+2CR
z@4+)sDPWdQb@%6KTpDVdm)v}?GSpG(w_UV)+#e3fJowDZO)JR83lIcbw(hMu}}Y
z2ZZwYAI-LVx@^G;HdkgxaX_l3&{H|3l7uX@Vl5di{>fQQ{pDynFlySp2(z~g)
z{LIBUzm_CMw_SIFfPdcT#zmg6g{#b(Lp`M3Uj
zGOKycyEe+n{G(Rmg}jB!)0ySk-!kkj_R7#OT+}pcG0VXh?f+ftRvnyw#hUea^Iyfn
ze|zgKPKrqe@jYWU?v<50X(n^lZ*G%j$JyCh`*Px|H*K=2WXP)hx>jng+}Q}N^KoDN
z8dh8T-~Dmrp2?yk3O6Gqbz7O@W=dcRVPvS;*B%(4`P|iK>Vg$XDgN9sr}Df{
z7X0es=RPHr8RB+*)}q}h%gn?x9PO4y*Qog};x<t%rn8xi;KBE9A!Dppb9yru|>RCb9PcXWpE>
zKlQ}fzw*izXI|}|r!O*nb#VhHRn;B`1LC^xvIctvLCYhRA_6yCS~2&!0SH1xwv(O~+5t
z^|E$S{MM^8j9J5`sQ6pud{2Lz?k`zncbjvHj%eutjusUol}8;%cbPLCO|e;ZJ^tXe
z_N{pmM}uCi3UWO3=hMciTPl?N16Xv@buq_d@TU`uX0_s{?
zt`1&)Tk-yb?sKMPI~!}xt*d*!tMat!r1`}jul#i@lDB8rnu>ba_-^4!iQ5{|tb3TX
z>fTMIw2!Me3{Dw*WZotC<4@h

[PATCH 04/13] configs: j721e: Set capsule update signature list file

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/j721e_evm_a72_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
index b8840a556e1..83bc0576821 100644
--- a/configs/j721e_evm_a72_defconfig
+++ b/configs/j721e_evm_a72_defconfig
@@ -212,3 +212,4 @@ CONFIG_TI_J721E_UFS=y
 CONFIG_EFI_SET_TIME=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
+CONFIG_EFI_CAPSULE_ESL_FILE="arch/arm/mach-k3/keys/custMpk.esl"
-- 
2.34.1



[PATCH] Makefile.lib: find capsule ESL dtsi file with CONFIG_OF_UPSTREAM

2024-04-08 Thread Jonathan Humphreys
When CONFIG_OF_UPSTREAM is enabled, DTS files are in SOC subdirectories (vs the
top level dts directory), but when CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
the dynamically created dtsi file containing the capsule ESL DT node is in the
parent directory. This results in a build failure because the #include inserted
in the DTS file is local to the current directory.  Update Makefile to have the
DT preprocessing of #includes search in the parent (dts top level) directory
too.

Signed-off-by: Jonathan Humphreys 
---
 scripts/Makefile.lib | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 12857316c58..62f87517c09 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -334,7 +334,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
(cat $< > $(pre-tmp)); \
$(foreach f,$(subst $(quote),,$(dtsi_include_list)), \
  echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
-   $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) 
$(pre-tmp) ; \
+   $(HOSTCC) -E $(dtc_cpp_flags) -I$(obj) -x assembler-with-cpp -o 
$(dtc-tmp) $(pre-tmp) ; \
$(DTC) -O dtb -o $@ -b 0 \
-i $(dir $<) -i $(u_boot_dtsi_loc) $(DTC_FLAGS) \
-d $(depfile).dtc.tmp $(dtc-tmp) || \
-- 
2.34.1



[PATCH 05/16] configs: j721e: Enable EFI capsule update

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/j721e_evm_a72_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
index 077bf508328..b8840a556e1 100644
--- a/configs/j721e_evm_a72_defconfig
+++ b/configs/j721e_evm_a72_defconfig
@@ -210,3 +210,5 @@ CONFIG_UFS=y
 CONFIG_CADENCE_UFS=y
 CONFIG_TI_J721E_UFS=y
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH 07/16] configs: beagleplay: Enable DFU for MMC

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_beagleplay_a53_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/am62x_beagleplay_a53_defconfig 
b/configs/am62x_beagleplay_a53_defconfig
index 147967d3c11..68e103f58dc 100644
--- a/configs/am62x_beagleplay_a53_defconfig
+++ b/configs/am62x_beagleplay_a53_defconfig
@@ -70,6 +70,9 @@ CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
 CONFIG_CLK_TI_SCI=y
+CONFIG_DFU_MMC=y
+CONFIG_SYS_DFU_DATA_BUF_SIZE=0x4
+CONFIG_SYS_DFU_MAX_FILE_SIZE=0x18
 CONFIG_DMA_CHANNELS=y
 CONFIG_TI_K3_NAVSS_UDMA=y
 CONFIG_TI_SCI_PROTOCOL=y
-- 
2.34.1



[PATCH 02/16] board: am64x: Define capsule update firmware info

2024-04-08 Thread Jonathan Humphreys
Define the firmwares updatable via EFI capsule update.

Signed-off-by: Jonathan Humphreys 
---
 board/ti/am64x/evm.c | 33 +
 1 file changed, 33 insertions(+)

diff --git a/board/ti/am64x/evm.c b/board/ti/am64x/evm.c
index b8de69da06c..a151023bb7e 100644
--- a/board/ti/am64x/evm.c
+++ b/board/ti/am64x/evm.c
@@ -7,6 +7,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -27,6 +28,38 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = K3_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"K3_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = K3_SPL_IMAGE_GUID,
+   .fw_name = u"K3_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = K3_UBOOT_IMAGE_GUID,
+   .fw_name = u"K3_UBOOT",
+   .image_index = 3,
+   },
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "sf 0:0=tiboot3.bin raw 0 10;tispl.bin raw 10 
20;u-boot.img raw 30 40",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_init(void)
 {
return 0;
-- 
2.34.1



[PATCH 04/16] board: j721e: Define capsule update firmware info

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 board/ti/j721e/evm.c | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index 9dc3ed6dfff..b8702b83547 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -7,6 +7,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -32,6 +33,43 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = K3_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"K3_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = K3_SPL_IMAGE_GUID,
+   .fw_name = u"K3_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = K3_UBOOT_IMAGE_GUID,
+   .fw_name = u"K3_UBOOT",
+   .image_index = 3,
+   },
+   {
+   .image_type_id = K3_SYSFW_IMAGE_GUID,
+   .fw_name = u"K3_SYSFW",
+   .image_index = 4,
+   },
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "sf 0:0=tiboot3.bin raw 0 8;tispl.bin raw 8 
20;u-boot.img raw 28 40;sysfw.itb raw 6C 10",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_init(void)
 {
return 0;
-- 
2.34.1



[PATCH 01/16] board: Define GUIDs for firmware images

2024-04-08 Thread Jonathan Humphreys
Define GUIDs for the different firmware images (tiboot3.bin, tispl.bin,
u-boot.img, sysfw).

Signed-off-by: Jonathan Humphreys 
---
 include/configs/ti_armv7_common.h | 17 +
 1 file changed, 17 insertions(+)

diff --git a/include/configs/ti_armv7_common.h 
b/include/configs/ti_armv7_common.h
index 3def7b1027e..4ce14a9b84c 100644
--- a/include/configs/ti_armv7_common.h
+++ b/include/configs/ti_armv7_common.h
@@ -16,6 +16,23 @@
 #ifndef __CONFIG_TI_ARMV7_COMMON_H__
 #define __CONFIG_TI_ARMV7_COMMON_H__
 
+/* GUIDs for capsule updatable firmware images */
+#define K3_TIBOOT3_IMAGE_GUID \
+   EFI_GUID(0xe672b518, 0x7cd7, 0x4014, 0xbd, 0x8d, \
+0x40, 0x72, 0x4d, 0x0a, 0xd4, 0xdc)
+
+#define K3_SPL_IMAGE_GUID \
+   EFI_GUID(0x86f710ad, 0x10cf, 0x46ea, 0xac, 0x67, \
+0x85, 0x6a, 0xe0, 0x6e, 0xfa, 0xd2)
+
+#define K3_UBOOT_IMAGE_GUID \
+   EFI_GUID(0x81b58fb0, 0x3b00, 0x4add, 0xa2, 0x0a, \
+0xc1, 0x85, 0xbb, 0xac, 0xa1, 0xed)
+
+#define K3_SYSFW_IMAGE_GUID \
+   EFI_GUID(0x6fd10680, 0x361b, 0x431f, 0x80, 0xaa, \
+0x89, 0x94, 0x55, 0x81, 0x9e, 0x11)
+
 /*
  * We setup defaults based on constraints from the Linux kernel, which should
  * also be safe elsewhere.  We have the default load at 32MB into DDR (for
-- 
2.34.1



[PATCH 00/16] EFI: ti: Enable EFI capsule updates

2024-04-08 Thread Jonathan Humphreys
Enable on disk capsule updates, which includes defining the firmware components
(tiboot3, spl, u-boot) and enabling processing of raw capsule updates.

This is enabled for several TI SoC based platforms: AM64, AM62, AM62p,
BeaglePlay, J7, and BeagleboneAI.

This series also includes enabling seral flash DFU for AM62 and MMC DFU for
beagleplay, and adding the sysreset controller node for AM62 to enable system
reset.

Jonathan Humphreys (16):
  board: Define GUIDs for firmware images
  board: am64x: Define capsule update firmware info
  configs: am64x: Enable EFI capsule update
  board: j721e: Define capsule update firmware info
  configs: j721e: Enable EFI capsule update
  board: beagleplay: Define capsule update firmware info
  configs: beagleplay: Enable DFU for MMC
  configs: beagleplay: Enable EFI capsule update
  board: am62px: Define capsule update firmware info
  configs: am62px: Enable EFI capsule update
  configs: am62x: Enable serial flash DFU
  arm: dts: k3-am625-sk-u-boot: Add sysreset-controller node
  board: am62x: Define capsule update firmware info
  configs: am62x: Enable EFI capsule update
  board: beagleboneai64: Define capsule update firmware info
  configs: beagleboneai64: Enable EFI capsule update

 arch/arm/dts/k3-am625-sk-u-boot.dtsi |  9 +
 board/beagle/beagleboneai64/beagleboneai64.c | 33 +
 board/beagle/beagleplay/beagleplay.c | 33 +
 board/ti/am62px/evm.c| 32 +
 board/ti/am62x/evm.c | 32 +
 board/ti/am64x/evm.c | 33 +
 board/ti/j721e/evm.c | 38 
 configs/am62px_evm_a53_defconfig |  2 ++
 configs/am62x_beagleplay_a53_defconfig   |  5 +++
 configs/am62x_evm_a53_defconfig  |  3 ++
 configs/am64x_evm_a53_defconfig  |  2 ++
 configs/j721e_beagleboneai64_a72_defconfig   |  2 ++
 configs/j721e_evm_a72_defconfig  |  2 ++
 include/configs/ti_armv7_common.h| 17 +
 14 files changed, 243 insertions(+)

-- 
2.34.1



[PATCH 08/16] configs: beagleplay: Enable EFI capsule update

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_beagleplay_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am62x_beagleplay_a53_defconfig 
b/configs/am62x_beagleplay_a53_defconfig
index 68e103f58dc..23b9c466248 100644
--- a/configs/am62x_beagleplay_a53_defconfig
+++ b/configs/am62x_beagleplay_a53_defconfig
@@ -124,3 +124,5 @@ CONFIG_EXT4_WRITE=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_LZO=y
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH 13/16] board: am62x: Define capsule update firmware info

2024-04-08 Thread Jonathan Humphreys
Define the firmwares updatable via EFI capsule update.

Signed-off-by: Jonathan Humphreys 
---
 board/ti/am62x/evm.c | 32 
 1 file changed, 32 insertions(+)

diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
index b3e8680dfab..595c98982bb 100644
--- a/board/ti/am62x/evm.c
+++ b/board/ti/am62x/evm.c
@@ -7,6 +7,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -46,6 +47,37 @@ int splash_screen_prepare(void)
 }
 #endif
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+   {
+   .image_type_id = K3_TIBOOT3_IMAGE_GUID,
+   .fw_name = u"K3_TIBOOT3",
+   .image_index = 1,
+   },
+   {
+   .image_type_id = K3_SPL_IMAGE_GUID,
+   .fw_name = u"K3_SPL",
+   .image_index = 2,
+   },
+   {
+   .image_type_id = K3_UBOOT_IMAGE_GUID,
+   .fw_name = u"K3_UBOOT",
+   .image_index = 3,
+   },
+};
+
+struct efi_capsule_update_info update_info = {
+   .dfu_string = "sf 0:0=tiboot3.bin raw 0 8;tispl.bin raw 8 
20;u-boot.img raw 28 48",
+   .num_images = ARRAY_SIZE(fw_images),
+   .images = fw_images,
+};
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   env_set("dfu_alt_info", update_info.dfu_string);
+}
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_init(void)
 {
return 0;
-- 
2.34.1



[PATCH 12/16] arm: dts: k3-am625-sk-u-boot: Add sysreset-controller node

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 arch/arm/dts/k3-am625-sk-u-boot.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/dts/k3-am625-sk-u-boot.dtsi 
b/arch/arm/dts/k3-am625-sk-u-boot.dtsi
index fa778b0ff4c..35bfeae75a0 100644
--- a/arch/arm/dts/k3-am625-sk-u-boot.dtsi
+++ b/arch/arm/dts/k3-am625-sk-u-boot.dtsi
@@ -46,3 +46,12 @@
 _port2 {
status = "disabled";
 };
+
+ {
+   bootph-pre-ram;
+
+   k3_sysreset: sysreset-controller {
+   compatible = "ti,sci-sysreset";
+   bootph-pre-ram;
+   };
+};
-- 
2.34.1



[PATCH 11/16] configs: am62x: Enable serial flash DFU

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_evm_a53_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig
index d650b8575b6..0e6c94de538 100644
--- a/configs/am62x_evm_a53_defconfig
+++ b/configs/am62x_evm_a53_defconfig
@@ -67,6 +67,7 @@ CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
 CONFIG_CLK_TI_SCI=y
+CONFIG_DFU_SF=y
 CONFIG_DMA_CHANNELS=y
 CONFIG_TI_K3_NAVSS_UDMA=y
 CONFIG_TI_SCI_PROTOCOL=y
-- 
2.34.1



[PATCH 14/16] configs: am62x: Enable EFI capsule update

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/am62x_evm_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig
index 0e6c94de538..11af7b517d1 100644
--- a/configs/am62x_evm_a53_defconfig
+++ b/configs/am62x_evm_a53_defconfig
@@ -111,3 +111,5 @@ CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



[PATCH 16/16] configs: beagleboneai64: Enable EFI capsule update

2024-04-08 Thread Jonathan Humphreys
Signed-off-by: Jonathan Humphreys 
---
 configs/j721e_beagleboneai64_a72_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/j721e_beagleboneai64_a72_defconfig 
b/configs/j721e_beagleboneai64_a72_defconfig
index 3d234bc1a8f..e74ee68e23e 100644
--- a/configs/j721e_beagleboneai64_a72_defconfig
+++ b/configs/j721e_beagleboneai64_a72_defconfig
@@ -172,3 +172,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x6163
 CONFIG_SPL_DFU=y
 CONFIG_LZO=y
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.34.1



  1   2   >