]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
rockpi4: board: Add firmware image information for capsule updates
authorSughosh Ganu <sughosh.ganu@linaro.org>
Thu, 10 Nov 2022 09:19:16 +0000 (14:49 +0530)
committerKever Yang <kever.yang@rock-chips.com>
Mon, 19 Dec 2022 02:56:12 +0000 (10:56 +0800)
Add information that will be needed for enabling the UEFI capsule
update feature on the RockPi4 boards. With the feature enabled, it
would be possible to update the idbloader and u-boot.itb images on the
RockPi4B and RockPi4C variants.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
arch/arm/include/asm/arch-rockchip/misc.h
board/rockchip/evb_rk3399/evb-rk3399.c
include/configs/rk3399_common.h

index b6b03c934ed96b7ad908d45700a2a0f089b96e9f..4155af8c3b042372cf4341bf80e7e98410f5c6a2 100644 (file)
@@ -11,3 +11,4 @@ int rockchip_cpuid_from_efuse(const u32 cpuid_offset,
                              u8 *cpuid);
 int rockchip_cpuid_set(const u8 *cpuid, const u32 cpuid_length);
 int rockchip_setup_macaddr(void);
+void rockchip_capsule_update_board_setup(void);
index abb76585cf8eea0679e4d9db7f09f671236cd5c8..f56b379b937f68056122069cb5d884e703b9719b 100644 (file)
@@ -5,11 +5,25 @@
 
 #include <common.h>
 #include <dm.h>
+#include <efi_loader.h>
 #include <init.h>
 #include <log.h>
 #include <asm/arch-rockchip/periph.h>
+#include <linux/kernel.h>
 #include <power/regulator.h>
 
+#define ROCKPI4_UPDATABLE_IMAGES       2
+
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+static struct efi_fw_image fw_images[ROCKPI4_UPDATABLE_IMAGES] = {0};
+
+struct efi_capsule_update_info update_info = {
+       .images = fw_images,
+};
+
+u8 num_image_type_guids = ROCKPI4_UPDATABLE_IMAGES;
+#endif
+
 #ifndef CONFIG_SPL_BUILD
 int board_early_init_f(void)
 {
@@ -29,4 +43,43 @@ int board_early_init_f(void)
 out:
        return 0;
 }
-#endif
+
+#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION)
+static bool board_is_rockpi_4b(void)
+{
+       return CONFIG_IS_ENABLED(TARGET_EVB_RK3399) &&
+               of_machine_is_compatible("radxa,rockpi4b");
+}
+
+static bool board_is_rockpi_4c(void)
+{
+       return CONFIG_IS_ENABLED(TARGET_EVB_RK3399) &&
+               of_machine_is_compatible("radxa,rockpi4c");
+}
+
+void rockchip_capsule_update_board_setup(void)
+{
+       if (board_is_rockpi_4b()) {
+               efi_guid_t idbldr_image_type_guid =
+                       ROCKPI_4B_IDBLOADER_IMAGE_GUID;
+               efi_guid_t uboot_image_type_guid = ROCKPI_4B_UBOOT_IMAGE_GUID;
+
+               guidcpy(&fw_images[0].image_type_id, &idbldr_image_type_guid);
+               guidcpy(&fw_images[1].image_type_id, &uboot_image_type_guid);
+
+               fw_images[0].fw_name = u"ROCKPI4B-IDBLOADER";
+               fw_images[1].fw_name = u"ROCKPI4B-UBOOT";
+       } else if (board_is_rockpi_4c()) {
+               efi_guid_t idbldr_image_type_guid =
+                       ROCKPI_4C_IDBLOADER_IMAGE_GUID;
+               efi_guid_t uboot_image_type_guid = ROCKPI_4C_UBOOT_IMAGE_GUID;
+
+               guidcpy(&fw_images[0].image_type_id, &idbldr_image_type_guid);
+               guidcpy(&fw_images[1].image_type_id, &uboot_image_type_guid);
+
+               fw_images[0].fw_name = u"ROCKPI4C-IDBLOADER";
+               fw_images[1].fw_name = u"ROCKPI4C-UBOOT";
+       }
+}
+#endif /* CONFIG_EFI_HAVE_CAPSULE_SUPPORT && CONFIG_EFI_PARTITION */
+#endif /* !CONFIG_SPL_BUILD */
index 2f9aee58197b97b503f0f96ef7ce0e3aa7f8ad2a..f0a9ab8f83cd500b6502af6adc8e4043886593ff 100644 (file)
 #define CONFIG_SYS_SDRAM_BASE          0
 #define SDRAM_MAX_SIZE                 0xf8000000
 
+#define ROCKPI_4B_IDBLOADER_IMAGE_GUID \
+       EFI_GUID(0x02f4d760, 0xcfd5, 0x43bd, 0x8e, 0x2d, \
+                0xa4, 0x2a, 0xcb, 0x33, 0xc6, 0x60)
+
+#define ROCKPI_4B_UBOOT_IMAGE_GUID \
+       EFI_GUID(0x4ce292da, 0x1dd8, 0x428d, 0xa1, 0xc2, \
+                0x77, 0x74, 0x3e, 0xf8, 0xb9, 0x6e)
+
+#define ROCKPI_4C_IDBLOADER_IMAGE_GUID \
+       EFI_GUID(0xfd68510c, 0x12d3, 0x4f0a, 0xb8, 0xd3, \
+                0xd8, 0x79, 0xe1, 0xd3, 0xa5, 0x40)
+
+#define ROCKPI_4C_UBOOT_IMAGE_GUID \
+       EFI_GUID(0xb81fb4ae, 0xe4f3, 0x471b, 0x99, 0xb4, \
+                0x0b, 0x3d, 0xa5, 0x49, 0xce, 0x13)
+
 #ifndef CONFIG_SPL_BUILD
 
 #define ENV_MEM_LAYOUT_SETTINGS \