Nishanth Menon | ac205d8 | 2023-11-04 03:11:01 -0500 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * https://beagleboard.org/ai-64 |
| 4 | * |
| 5 | * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/ |
| 6 | * Copyright (C) 2022-2023 Jason Kridner, BeagleBoard.org Foundation |
| 7 | * Copyright (C) 2022-2023 Robert Nelson, BeagleBoard.org Foundation |
| 8 | */ |
| 9 | |
Jonathan Humphreys | c4b5f82 | 2024-06-14 11:35:46 -0500 | [diff] [blame] | 10 | #include <efi_loader.h> |
Nishanth Menon | ac205d8 | 2023-11-04 03:11:01 -0500 | [diff] [blame] | 11 | #include <cpu_func.h> |
| 12 | #include <env.h> |
| 13 | #include <fdt_support.h> |
| 14 | #include <spl.h> |
| 15 | |
| 16 | DECLARE_GLOBAL_DATA_PTR; |
| 17 | |
Jonathan Humphreys | c4b5f82 | 2024-06-14 11:35:46 -0500 | [diff] [blame] | 18 | struct efi_fw_image fw_images[] = { |
| 19 | { |
| 20 | .image_type_id = BEAGLEBONEAI64_TIBOOT3_IMAGE_GUID, |
| 21 | .fw_name = u"BEAGLEBONEAI64_TIBOOT3", |
| 22 | .image_index = 1, |
| 23 | }, |
| 24 | { |
| 25 | .image_type_id = BEAGLEBONEAI64_SPL_IMAGE_GUID, |
| 26 | .fw_name = u"BEAGLEBONEAI64_SPL", |
| 27 | .image_index = 2, |
| 28 | }, |
| 29 | { |
| 30 | .image_type_id = BEAGLEBONEAI64_UBOOT_IMAGE_GUID, |
| 31 | .fw_name = u"BEAGLEBONEAI64_UBOOT", |
| 32 | .image_index = 3, |
| 33 | }, |
| 34 | { |
| 35 | .image_type_id = BEAGLEBONEAI64_SYSFW_IMAGE_GUID, |
| 36 | .fw_name = u"BEAGLEBONEAI64_SYSFW", |
| 37 | .image_index = 4, |
| 38 | } |
| 39 | }; |
| 40 | |
| 41 | struct efi_capsule_update_info update_info = { |
| 42 | .dfu_string = "mmc 0=tiboot3.bin raw 0 2000 mmcpart 1;" |
| 43 | "tispl.bin fat 0 1;u-boot.img fat 0 1; sysfw.itb fat 0 1", |
| 44 | .num_images = ARRAY_SIZE(fw_images), |
| 45 | .images = fw_images, |
| 46 | }; |
| 47 | |
| 48 | #if IS_ENABLED(CONFIG_SET_DFU_ALT_INFO) |
| 49 | void set_dfu_alt_info(char *interface, char *devstr) |
| 50 | { |
| 51 | if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)) |
| 52 | env_set("dfu_alt_info", update_info.dfu_string); |
| 53 | } |
| 54 | #endif |
| 55 | |
Nishanth Menon | ac205d8 | 2023-11-04 03:11:01 -0500 | [diff] [blame] | 56 | int board_init(void) |
| 57 | { |
| 58 | return 0; |
| 59 | } |
| 60 | |
| 61 | int dram_init(void) |
| 62 | { |
| 63 | return fdtdec_setup_mem_size_base(); |
| 64 | } |
| 65 | |
| 66 | int dram_init_banksize(void) |
| 67 | { |
| 68 | return fdtdec_setup_memory_banksize(); |
| 69 | } |
Nishanth Menon | 9a94f2c | 2024-02-12 13:47:24 -0600 | [diff] [blame] | 70 | |
| 71 | #ifdef CONFIG_BOARD_LATE_INIT |
| 72 | int board_late_init(void) |
| 73 | { |
| 74 | char fdtfile[50]; |
| 75 | |
| 76 | snprintf(fdtfile, sizeof(fdtfile), "%s/%s.dtb", |
| 77 | CONFIG_TI_FDT_FOLDER_PATH, CONFIG_DEFAULT_DEVICE_TREE); |
| 78 | |
| 79 | env_set("fdtfile", fdtfile); |
| 80 | |
| 81 | return 0; |
| 82 | } |
| 83 | #endif |