blob: e84b35691865dbb6234f921b845f6e7de9393373 [file] [log] [blame]
Michael Walle36ba7642020-10-15 23:08:57 +02001// SPDX-License-Identifier: GPL-2.0+
2
3#include <common.h>
4#include <malloc.h>
5#include <errno.h>
6#include <fsl_ddr.h>
7#include <fdt_support.h>
Simon Glass3ba929a2020-10-30 21:38:53 -06008#include <asm/global_data.h>
Michael Walle36ba7642020-10-15 23:08:57 +02009#include <linux/libfdt.h>
10#include <env_internal.h>
11#include <asm/arch-fsl-layerscape/soc.h>
12#include <asm/arch-fsl-layerscape/fsl_icid.h>
13#include <i2c.h>
14#include <asm/arch/soc.h>
15#include <fsl_immap.h>
16#include <netdev.h>
17
18#include <fdtdec.h>
19#include <miiphy.h>
20
21DECLARE_GLOBAL_DATA_PTR;
22
Michael Walle101410e2021-01-08 00:08:59 +010023int board_early_init_f(void)
24{
25 fsl_lsch3_early_init_f();
26 return 0;
27}
28
Michael Walle36ba7642020-10-15 23:08:57 +020029int board_init(void)
30{
31 if (CONFIG_IS_ENABLED(FSL_CAAM))
32 sec_init();
33
34 return 0;
35}
36
37int board_eth_init(struct bd_info *bis)
38{
39 return pci_eth_init(bis);
40}
41
42int checkboard(void)
43{
44 printf("EL: %d\n", current_el());
45 return 0;
46}
47
48void detail_board_ddr_info(void)
49{
50 puts("\nDDR ");
51 print_size(gd->bd->bi_dram[0].size + gd->bd->bi_dram[1].size, "");
52 print_ddr_info(0);
53}
54
55int ft_board_setup(void *blob, struct bd_info *bd)
56{
57 u64 base[CONFIG_NR_DRAM_BANKS];
58 u64 size[CONFIG_NR_DRAM_BANKS];
59 int nbanks = CONFIG_NR_DRAM_BANKS;
Michael Walle76427fb2020-11-18 17:46:02 +010060 int node;
Michael Walle36ba7642020-10-15 23:08:57 +020061 int i;
62
63 ft_cpu_setup(blob, bd);
64
65 /* fixup DT for the two GPP DDR banks */
66 for (i = 0; i < nbanks; i++) {
67 base[i] = gd->bd->bi_dram[i].start;
68 size[i] = gd->bd->bi_dram[i].size;
69 }
70
71 fdt_fixup_memory_banks(blob, base, size, nbanks);
72
73 fdt_fixup_icid(blob);
74
Michael Walle76427fb2020-11-18 17:46:02 +010075 if (CONFIG_IS_ENABLED(SL28_SPL_LOADS_OPTEE_BL32)) {
76 node = fdt_node_offset_by_compatible(blob, -1, "linaro,optee-tz");
77 if (node)
Marek BehĂșnf872e832021-11-26 14:57:08 +010078 fdt_set_node_status(blob, node, FDT_STATUS_OKAY);
Michael Walle76427fb2020-11-18 17:46:02 +010079 }
80
Michael Walle36ba7642020-10-15 23:08:57 +020081 return 0;
82}