1 // SPDX-License-Identifier: GPL-2.0+
8 #include <fdt_support.h>
9 #include <asm/global_data.h>
10 #include <linux/libfdt.h>
11 #include <env_internal.h>
12 #include <asm/arch-fsl-layerscape/soc.h>
13 #include <asm/arch-fsl-layerscape/fsl_icid.h>
15 #include <asm/arch/soc.h>
16 #include <fsl_immap.h>
24 DECLARE_GLOBAL_DATA_PTR;
26 int board_early_init_f(void)
28 fsl_lsch3_early_init_f();
37 int board_eth_init(struct bd_info *bis)
39 return pci_eth_init(bis);
42 static int __sl28cpld_read(uint reg)
47 ret = uclass_get_device_by_driver(UCLASS_NOP,
48 DM_DRIVER_GET(sl28cpld), &dev);
52 return sl28cpld_read(dev, reg);
55 static void print_cpld_version(void)
57 int version = __sl28cpld_read(SL28CPLD_VERSION);
60 printf("CPLD: error reading version (%d)\n", version);
62 printf("CPLD: v%d\n", version);
67 printf("EL: %d\n", current_el());
68 if (CONFIG_IS_ENABLED(SL28CPLD))
74 static void stop_recovery_watchdog(void)
79 ret = uclass_get_device_by_driver(UCLASS_WDT,
80 DM_DRIVER_GET(sl28cpld_wdt), &dev);
85 int fsl_board_late_init(void)
88 * Usually, the after a board reset, the watchdog is enabled by
89 * default. This is to supervise the bootloader boot-up. Therefore,
90 * to prevent a watchdog reset if we don't actively kick it, we have
93 * If the watchdog isn't enabled at reset (which is a configuration
94 * option) disabling it doesn't hurt either.
96 if (!CONFIG_IS_ENABLED(WATCHDOG_AUTOSTART))
97 stop_recovery_watchdog();
102 void detail_board_ddr_info(void)
107 int ft_board_setup(void *blob, struct bd_info *bd)
109 u64 base[CONFIG_NR_DRAM_BANKS];
110 u64 size[CONFIG_NR_DRAM_BANKS];
111 int nbanks = CONFIG_NR_DRAM_BANKS;
115 ft_cpu_setup(blob, bd);
117 /* fixup DT for the two GPP DDR banks */
118 for (i = 0; i < nbanks; i++) {
119 base[i] = gd->bd->bi_dram[i].start;
120 size[i] = gd->bd->bi_dram[i].size;
123 fdt_fixup_memory_banks(blob, base, size, nbanks);
125 fdt_fixup_icid(blob);
127 if (CONFIG_IS_ENABLED(SL28_SPL_LOADS_OPTEE_BL32)) {
128 node = fdt_node_offset_by_compatible(blob, -1, "linaro,optee-tz");
130 fdt_set_node_status(blob, node, FDT_STATUS_OKAY);