Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / arch / x86 / cpu / ivybridge / fsp_configs.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2016, Bin Meng <bmeng.cn@gmail.com>
4  */
5
6 #include <common.h>
7 #include <fdtdec.h>
8 #include <log.h>
9 #include <asm/fsp1/fsp_support.h>
10
11 DECLARE_GLOBAL_DATA_PTR;
12
13 void fsp_update_configs(struct fsp_config_data *config,
14                         struct fspinit_rtbuf *rt_buf)
15 {
16         struct platform_config *plat_config = &config->plat_config;
17         struct memory_config *mem_config = &config->mem_config;
18         const void *blob = gd->fdt_blob;
19         int node;
20
21         node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_IVYBRIDGE_FSP);
22         if (node < 0) {
23                 debug("%s: Cannot find FSP node\n", __func__);
24                 return;
25         }
26
27         plat_config->enable_ht =
28                 fdtdec_get_bool(blob, node, "fsp,enable-ht");
29         plat_config->enable_turbo =
30                 fdtdec_get_bool(blob, node, "fsp,enable-turbo");
31         plat_config->enable_memory_down =
32                 fdtdec_get_bool(blob, node, "fsp,enable-memory-down");
33         plat_config->enable_fast_boot =
34                 fdtdec_get_bool(blob, node, "fsp,enable-fast-boot");
35
36         /* Initialize runtime buffer for fsp_init() */
37         rt_buf->stack_top = config->common.stack_top - 32;
38         rt_buf->boot_mode = config->common.boot_mode;
39         rt_buf->plat_config = plat_config;
40
41         if (plat_config->enable_memory_down)
42                 rt_buf->mem_config = mem_config;
43         else
44                 rt_buf->mem_config = NULL;
45 }