blob: fd827467b30a870079aab87ad6368c19311fd9d4 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Kever Yang0d3d7832016-07-19 21:16:59 +08002/*
3 * (C) Copyright 2016 Rockchip Electronics Co., Ltd
Kever Yang0d3d7832016-07-19 21:16:59 +08004 */
Philipp Tomsich3df66262017-09-29 19:27:54 +02005
Kever Yang6d26c062016-08-16 17:58:13 +08006#include <dm.h>
Sughosh Ganud5d2e8d2022-11-10 14:49:16 +05307#include <efi_loader.h>
Kever Yang0d3d7832016-07-19 21:16:59 +08008
Sughosh Ganud5d2e8d2022-11-10 14:49:16 +05309#define ROCKPI4_UPDATABLE_IMAGES 2
10
Simon Glassb8196212023-02-05 15:39:42 -070011#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
Sughosh Ganud5d2e8d2022-11-10 14:49:16 +053012static struct efi_fw_image fw_images[ROCKPI4_UPDATABLE_IMAGES] = {0};
13
14struct efi_capsule_update_info update_info = {
Masahisa Kojima5d2438b2023-06-07 14:41:51 +090015 .num_images = ROCKPI4_UPDATABLE_IMAGES,
Sughosh Ganud5d2e8d2022-11-10 14:49:16 +053016 .images = fw_images,
17};
18
Sughosh Ganud5d2e8d2022-11-10 14:49:16 +053019#endif
20
Simon Glass49c24a82024-09-29 19:49:47 -060021#ifndef CONFIG_XPL_BUILD
Jonas Karlman1ef12412024-03-12 23:36:14 +000022#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION)
Sughosh Ganud5d2e8d2022-11-10 14:49:16 +053023static bool board_is_rockpi_4b(void)
24{
Jonas Karlman1ef12412024-03-12 23:36:14 +000025 return of_machine_is_compatible("radxa,rockpi4b");
Sughosh Ganud5d2e8d2022-11-10 14:49:16 +053026}
27
28static bool board_is_rockpi_4c(void)
29{
Jonas Karlman1ef12412024-03-12 23:36:14 +000030 return of_machine_is_compatible("radxa,rockpi4c");
Sughosh Ganud5d2e8d2022-11-10 14:49:16 +053031}
32
33void 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 Glass49c24a82024-09-29 19:49:47 -060058#endif /* !CONFIG_XPL_BUILD */