Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Kever Yang | 0d3d783 | 2016-07-19 21:16:59 +0800 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2016 Rockchip Electronics Co., Ltd |
Kever Yang | 0d3d783 | 2016-07-19 21:16:59 +0800 | [diff] [blame] | 4 | */ |
Philipp Tomsich | 3df6626 | 2017-09-29 19:27:54 +0200 | [diff] [blame] | 5 | |
Kever Yang | 6d26c06 | 2016-08-16 17:58:13 +0800 | [diff] [blame] | 6 | #include <dm.h> |
Sughosh Ganu | d5d2e8d | 2022-11-10 14:49:16 +0530 | [diff] [blame] | 7 | #include <efi_loader.h> |
Kever Yang | 0d3d783 | 2016-07-19 21:16:59 +0800 | [diff] [blame] | 8 | |
Sughosh Ganu | d5d2e8d | 2022-11-10 14:49:16 +0530 | [diff] [blame] | 9 | #define ROCKPI4_UPDATABLE_IMAGES 2 |
| 10 | |
Simon Glass | b819621 | 2023-02-05 15:39:42 -0700 | [diff] [blame] | 11 | #if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) |
Sughosh Ganu | d5d2e8d | 2022-11-10 14:49:16 +0530 | [diff] [blame] | 12 | static struct efi_fw_image fw_images[ROCKPI4_UPDATABLE_IMAGES] = {0}; |
| 13 | |
| 14 | struct efi_capsule_update_info update_info = { |
Masahisa Kojima | 5d2438b | 2023-06-07 14:41:51 +0900 | [diff] [blame] | 15 | .num_images = ROCKPI4_UPDATABLE_IMAGES, |
Sughosh Ganu | d5d2e8d | 2022-11-10 14:49:16 +0530 | [diff] [blame] | 16 | .images = fw_images, |
| 17 | }; |
| 18 | |
Sughosh Ganu | d5d2e8d | 2022-11-10 14:49:16 +0530 | [diff] [blame] | 19 | #endif |
| 20 | |
Simon Glass | 49c24a8 | 2024-09-29 19:49:47 -0600 | [diff] [blame] | 21 | #ifndef CONFIG_XPL_BUILD |
Jonas Karlman | 1ef1241 | 2024-03-12 23:36:14 +0000 | [diff] [blame] | 22 | #if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION) |
Sughosh Ganu | d5d2e8d | 2022-11-10 14:49:16 +0530 | [diff] [blame] | 23 | static bool board_is_rockpi_4b(void) |
| 24 | { |
Jonas Karlman | 1ef1241 | 2024-03-12 23:36:14 +0000 | [diff] [blame] | 25 | return of_machine_is_compatible("radxa,rockpi4b"); |
Sughosh Ganu | d5d2e8d | 2022-11-10 14:49:16 +0530 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | static bool board_is_rockpi_4c(void) |
| 29 | { |
Jonas Karlman | 1ef1241 | 2024-03-12 23:36:14 +0000 | [diff] [blame] | 30 | return of_machine_is_compatible("radxa,rockpi4c"); |
Sughosh Ganu | d5d2e8d | 2022-11-10 14:49:16 +0530 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | void rockchip_capsule_update_board_setup(void) |
| 34 | { |
| 35 | if (board_is_rockpi_4b()) { |
| 36 | efi_guid_t idbldr_image_type_guid = |
| 37 | ROCKPI_4B_IDBLOADER_IMAGE_GUID; |
| 38 | efi_guid_t uboot_image_type_guid = ROCKPI_4B_UBOOT_IMAGE_GUID; |
| 39 | |
| 40 | guidcpy(&fw_images[0].image_type_id, &idbldr_image_type_guid); |
| 41 | guidcpy(&fw_images[1].image_type_id, &uboot_image_type_guid); |
| 42 | |
| 43 | fw_images[0].fw_name = u"ROCKPI4B-IDBLOADER"; |
| 44 | fw_images[1].fw_name = u"ROCKPI4B-UBOOT"; |
| 45 | } else if (board_is_rockpi_4c()) { |
| 46 | efi_guid_t idbldr_image_type_guid = |
| 47 | ROCKPI_4C_IDBLOADER_IMAGE_GUID; |
| 48 | efi_guid_t uboot_image_type_guid = ROCKPI_4C_UBOOT_IMAGE_GUID; |
| 49 | |
| 50 | guidcpy(&fw_images[0].image_type_id, &idbldr_image_type_guid); |
| 51 | guidcpy(&fw_images[1].image_type_id, &uboot_image_type_guid); |
| 52 | |
| 53 | fw_images[0].fw_name = u"ROCKPI4C-IDBLOADER"; |
| 54 | fw_images[1].fw_name = u"ROCKPI4C-UBOOT"; |
| 55 | } |
| 56 | } |
| 57 | #endif /* CONFIG_EFI_HAVE_CAPSULE_SUPPORT && CONFIG_EFI_PARTITION */ |
Simon Glass | 49c24a8 | 2024-09-29 19:49:47 -0600 | [diff] [blame] | 58 | #endif /* !CONFIG_XPL_BUILD */ |