diff options
author | Tom Rini <trini@konsulko.com> | 2023-11-13 09:07:23 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-11-13 13:35:57 -0500 |
commit | be0724601a9dd6aebca04337b1299edd126bbb4e (patch) | |
tree | d5cd7b5f733e66f5fd2799503cccc98dfafd4c86 /board/st/stm32mp2/stm32mp2.c | |
parent | 3b6db6901ff5babbb9d21f0fca750996e29d85e0 (diff) | |
parent | 01a701994b0590b6452516a7c67353359d053c94 (diff) |
Merge tag 'u-boot-stm32-20231113' of https://source.denx.de/u-boot/custodians/u-boot-stm into next
Introduce STM32MP2 SoCs family support
Add STM32MP257F-EV1 board
[trini: Adjust some includes]
Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'board/st/stm32mp2/stm32mp2.c')
-rw-r--r-- | board/st/stm32mp2/stm32mp2.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/board/st/stm32mp2/stm32mp2.c b/board/st/stm32mp2/stm32mp2.c new file mode 100644 index 00000000000..c97a7efff46 --- /dev/null +++ b/board/st/stm32mp2/stm32mp2.c @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause +/* + * Copyright (C) 2023, STMicroelectronics - All Rights Reserved + */ + +#define LOG_CATEGORY LOGC_BOARD + +#include <config.h> +#include <env.h> +#include <fdt_support.h> +#include <asm/global_data.h> +#include <asm/arch/sys_proto.h> + +/* + * Get a global data pointer + */ +DECLARE_GLOBAL_DATA_PTR; + +/* board dependent setup after realloc */ +int board_init(void) +{ + return 0; +} + +int board_late_init(void) +{ + const void *fdt_compat; + int fdt_compat_len; + char dtb_name[256]; + int buf_len; + + if (IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG)) { + fdt_compat = fdt_getprop(gd->fdt_blob, 0, "compatible", + &fdt_compat_len); + if (fdt_compat && fdt_compat_len) { + if (strncmp(fdt_compat, "st,", 3) != 0) { + env_set("board_name", fdt_compat); + } else { + env_set("board_name", fdt_compat + 3); + + buf_len = sizeof(dtb_name); + strlcpy(dtb_name, fdt_compat + 3, buf_len); + buf_len -= strlen(fdt_compat + 3); + strlcat(dtb_name, ".dtb", buf_len); + env_set("fdtfile", dtb_name); + } + } + } + + return 0; +} |