2 * Copyright 2014-2015 Freescale Semiconductor, Inc.
4 * SPDX-License-Identifier: GPL-2.0+
9 #include <fdt_support.h>
11 #ifdef CONFIG_FSL_LSCH3
12 #include <asm/arch/fdt.h>
14 #ifdef CONFIG_FSL_ESDHC
15 #include <fsl_esdhc.h>
17 #ifdef CONFIG_SYS_DPAA_FMAN
21 #include <asm/arch/mp.h>
24 #include <asm/arch-fsl-layerscape/soc.h>
25 #ifdef CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT
26 #include <asm/armv8/sec_firmware.h>
29 int fdt_fixup_phy_connection(void *blob, int offset, phy_interface_t phyc)
31 return fdt_setprop_string(blob, offset, "phy-connection-type",
32 phy_string_for_interface(phyc));
36 void ft_fixup_cpu(void *blob)
39 __maybe_unused u64 spin_tbl_addr = (u64)get_spin_tbl_addr();
43 size_t *boot_code_size = &(__secondary_boot_code_size);
44 #if defined(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT) && defined(CONFIG_ARMV8_PSCI)
48 /* Check the psci version to determine if the psci is supported */
49 psci_ver = sec_firmware_support_psci_version();
50 if (psci_ver == 0xffffffff) {
51 /* remove psci DT node */
52 node = fdt_path_offset(blob, "/psci");
54 goto remove_psci_node;
56 node = fdt_node_offset_by_compatible(blob, -1, "arm,psci");
58 goto remove_psci_node;
60 node = fdt_node_offset_by_compatible(blob, -1, "arm,psci-0.2");
62 goto remove_psci_node;
64 node = fdt_node_offset_by_compatible(blob, -1, "arm,psci-1.0");
66 goto remove_psci_node;
70 fdt_del_node(blob, node);
75 off = fdt_path_offset(blob, "/cpus");
77 puts("couldn't find /cpus node\n");
80 of_bus_default_count_cells(blob, off, &addr_cells, NULL);
82 off = fdt_node_offset_by_prop_value(blob, -1, "device_type", "cpu", 4);
83 while (off != -FDT_ERR_NOTFOUND) {
84 reg = (fdt32_t *)fdt_getprop(blob, off, "reg", 0);
86 core_id = of_read_number(reg, addr_cells);
87 if (core_id == 0 || (is_core_online(core_id))) {
89 val += id_to_core(core_id) *
91 val = cpu_to_fdt64(val);
92 fdt_setprop_string(blob, off, "enable-method",
94 fdt_setprop(blob, off, "cpu-release-addr",
97 debug("skipping offline core\n");
100 puts("Warning: found cpu node without reg property\n");
102 off = fdt_node_offset_by_prop_value(blob, off, "device_type",
106 fdt_add_mem_rsv(blob, (uintptr_t)&secondary_boot_code,
111 void ft_cpu_setup(void *blob, bd_t *bd)
113 #ifdef CONFIG_FSL_LSCH2
114 struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
115 unsigned int svr = in_be32(&gur->svr);
117 /* delete crypto node if not on an E-processor */
118 if (!IS_E_PROCESSOR(svr))
119 fdt_fixup_crypto_node(blob, 0);
120 #if CONFIG_SYS_FSL_SEC_COMPAT >= 4
122 ccsr_sec_t __iomem *sec;
124 sec = (void __iomem *)CONFIG_SYS_FSL_SEC_ADDR;
125 fdt_fixup_crypto_node(blob, sec_in32(&sec->secvid_ms));
134 #ifdef CONFIG_SYS_NS16550
135 do_fixup_by_compat_u32(blob, "fsl,ns16550",
136 "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
139 do_fixup_by_compat_u32(blob, "fixed-clock",
140 "clock-frequency", CONFIG_SYS_CLK_FREQ, 1);
143 ft_pci_setup(blob, bd);
146 #ifdef CONFIG_FSL_ESDHC
147 fdt_fixup_esdhc(blob, bd);
150 #ifdef CONFIG_SYS_DPAA_FMAN
151 fdt_fixup_fman_firmware(blob);