mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-07-06 03:06:16 +09:00
board: stm32mp1: use IS_ENABLED to prevent ifdef in board_late_init
Use IS_ENABLED to prevent ifdef in board_late_init. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
This commit is contained in:
parent
e817c8eca5
commit
72b099897a
|
@ -654,25 +654,25 @@ int board_init(void)
|
||||||
|
|
||||||
int board_late_init(void)
|
int board_late_init(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
|
|
||||||
const void *fdt_compat;
|
const void *fdt_compat;
|
||||||
int fdt_compat_len;
|
int fdt_compat_len;
|
||||||
int ret;
|
int ret;
|
||||||
u32 otp;
|
u32 otp;
|
||||||
struct udevice *dev;
|
struct udevice *dev;
|
||||||
char buf[10];
|
char buf[10];
|
||||||
|
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 = fdt_getprop(gd->fdt_blob, 0, "compatible",
|
||||||
&fdt_compat_len);
|
&fdt_compat_len);
|
||||||
if (fdt_compat && fdt_compat_len) {
|
if (fdt_compat && fdt_compat_len) {
|
||||||
if (strncmp(fdt_compat, "st,", 3) != 0) {
|
if (strncmp(fdt_compat, "st,", 3) != 0) {
|
||||||
env_set("board_name", fdt_compat);
|
env_set("board_name", fdt_compat);
|
||||||
} else {
|
} else {
|
||||||
char dtb_name[256];
|
|
||||||
int buf_len = sizeof(dtb_name);
|
|
||||||
|
|
||||||
env_set("board_name", fdt_compat + 3);
|
env_set("board_name", fdt_compat + 3);
|
||||||
|
|
||||||
|
buf_len = sizeof(dtb_name);
|
||||||
strncpy(dtb_name, fdt_compat + 3, buf_len);
|
strncpy(dtb_name, fdt_compat + 3, buf_len);
|
||||||
buf_len -= strlen(fdt_compat + 3);
|
buf_len -= strlen(fdt_compat + 3);
|
||||||
strncat(dtb_name, ".dtb", buf_len);
|
strncat(dtb_name, ".dtb", buf_len);
|
||||||
|
@ -694,7 +694,7 @@ int board_late_init(void)
|
||||||
((otp >> 8) & 0xF) - 1 + 0xA);
|
((otp >> 8) & 0xF) - 1 + 0xA);
|
||||||
env_set("board_rev", buf);
|
env_set("board_rev", buf);
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
/* for DK1/DK2 boards */
|
/* for DK1/DK2 boards */
|
||||||
board_check_usb_power();
|
board_check_usb_power();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user