aboutsummaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-12-19 09:29:55 -0500
committerTom Rini <trini@konsulko.com>2022-12-21 13:09:01 -0500
commit14f43797d0a696248c09d298e2f2809dded345ba (patch)
tree23fc5bc462689f07f389cc0b8e7f7bedd35253ff /board
parent9c955393f7a27ded250fef7688e0065b44a3343f (diff)
parent2243922edca9f56a9d5519b9d6e36f5d7a18434d (diff)
downloadu-boot-14f43797d0a696248c09d298e2f2809dded345ba.zip
u-boot-14f43797d0a696248c09d298e2f2809dded345ba.tar.gz
u-boot-14f43797d0a696248c09d298e2f2809dded345ba.tar.bz2
Merge tag 'v2023.01-rc4' into next
Prepare v2023.01-rc4 Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'board')
-rw-r--r--board/Marvell/mvebu_armada-37xx/board.c20
-rw-r--r--board/rockchip/evb_rk3399/evb-rk3399.c55
-rw-r--r--board/sunxi/board.c24
3 files changed, 83 insertions, 16 deletions
diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c
index 45fe3e5..3ab6e88 100644
--- a/board/Marvell/mvebu_armada-37xx/board.c
+++ b/board/Marvell/mvebu_armada-37xx/board.c
@@ -99,9 +99,16 @@ int board_late_init(void)
if (!of_machine_is_compatible("globalscale,espressobin"))
return 0;
- /* Find free buffer in default_environment[] for new variables */
- while (*ptr != '\0' && *(ptr+1) != '\0') ptr++;
- ptr += 2;
+ /*
+ * Find free space for new variables in default_environment[] array.
+ * Free space is after the last variable, each variable is termined
+ * by nul byte and after the last variable is additional nul byte.
+ * Move ptr to the position where new variable can be filled.
+ */
+ while (*ptr != '\0') {
+ do { ptr++; } while (*ptr != '\0');
+ ptr++;
+ }
/*
* Ensure that 'env default -a' does not erase permanent MAC addresses
@@ -145,6 +152,13 @@ int board_late_init(void)
strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin-emmc.dtb");
else
strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin.dtb");
+ ptr += strlen(ptr) + 1;
+
+ /*
+ * After the last variable (which is nul term string) append another nul
+ * byte which terminates the list. So everything after ptr is ignored.
+ */
+ *ptr = '\0';
return 0;
}
diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c b/board/rockchip/evb_rk3399/evb-rk3399.c
index abb7658..f56b379 100644
--- a/board/rockchip/evb_rk3399/evb-rk3399.c
+++ b/board/rockchip/evb_rk3399/evb-rk3399.c
@@ -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 */
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 21a2407..827e545 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -184,10 +184,6 @@ enum env_location env_get_location(enum env_operation op, int prio)
return ENVL_UNKNOWN;
}
-#ifdef CONFIG_DM_MMC
-static void mmc_pinmux_setup(int sdc);
-#endif
-
/* add board specific code here */
int board_init(void)
{
@@ -355,7 +351,7 @@ void board_nand_init(void)
sunxi_nand_init();
#endif
}
-#endif
+#endif /* CONFIG_NAND_SUNXI */
#ifdef CONFIG_MMC
static void mmc_pinmux_setup(int sdc)
@@ -525,9 +521,14 @@ static void mmc_pinmux_setup(int sdc)
int board_mmc_init(struct bd_info *bis)
{
+ /*
+ * The BROM always accesses MMC port 0 (typically an SD card), and
+ * most boards seem to have such a slot. The others haven't reported
+ * any problem with unconditionally enabling this in the SPL.
+ */
if (!IS_ENABLED(CONFIG_UART0_PORT_F)) {
- mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
- if (!sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT))
+ mmc_pinmux_setup(0);
+ if (!sunxi_mmc_init(0))
return -1;
}
@@ -553,7 +554,7 @@ int mmc_get_env_dev(void)
}
}
#endif
-#endif
+#endif /* CONFIG_MMC */
#ifdef CONFIG_SPL_BUILD
@@ -669,7 +670,7 @@ void sunxi_board_init(void)
else
printf("Failed to set core voltage! Can't set CPU frequency\n");
}
-#endif
+#endif /* CONFIG_SPL_BUILD */
#ifdef CONFIG_USB_GADGET
int g_dnl_board_usb_cable_connected(void)
@@ -698,7 +699,7 @@ int g_dnl_board_usb_cable_connected(void)
return sun4i_usb_phy_vbus_detect(&phy);
}
-#endif
+#endif /* CONFIG_USB_GADGET */
#ifdef CONFIG_SERIAL_TAG
void get_board_serial(struct tag_serialnr *serialnr)
@@ -927,7 +928,6 @@ int ft_board_setup(void *blob, struct bd_info *bd)
}
#ifdef CONFIG_SPL_LOAD_FIT
-
static void set_spl_dt_name(const char *name)
{
struct boot_file_head *spl = get_spl_header(SPL_ENV_HEADER_VERSION);
@@ -995,4 +995,4 @@ int board_fit_config_name_match(const char *name)
return ret;
}
-#endif
+#endif /* CONFIG_SPL_LOAD_FIT */