1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2008 Freescale Semiconductor, Inc.
6 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
10 #include <linux/libfdt.h>
11 #include <fdt_support.h>
15 DECLARE_GLOBAL_DATA_PTR;
18 * If a QE firmware has been uploaded, then add the 'firmware' node under
21 void fdt_fixup_qe_firmware(void *blob)
23 struct qe_firmware_info *qe_fw_info;
26 qe_fw_info = qe_get_firmware_info();
30 node = fdt_path_offset(blob, "/qe");
34 /* We assume the node doesn't exist yet */
35 node = fdt_add_subnode(blob, node, "firmware");
39 ret = fdt_setprop(blob, node, "extended-modes",
40 &qe_fw_info->extended_modes, sizeof(u64));
44 ret = fdt_setprop_string(blob, node, "id", qe_fw_info->id);
48 ret = fdt_setprop(blob, node, "virtual-traps", qe_fw_info->vtraps,
49 sizeof(qe_fw_info->vtraps));
56 fdt_del_node(blob, node);
59 void ft_qe_setup(void *blob)
61 do_fixup_by_prop_u32(blob, "device_type", "qe", 4,
62 "bus-frequency", gd->arch.qe_clk, 1);
63 do_fixup_by_prop_u32(blob, "device_type", "qe", 4,
64 "brg-frequency", gd->arch.brg_clk, 1);
65 do_fixup_by_compat_u32(blob, "fsl,qe",
66 "clock-frequency", gd->arch.qe_clk, 1);
67 do_fixup_by_compat_u32(blob, "fsl,qe",
68 "bus-frequency", gd->arch.qe_clk, 1);
69 do_fixup_by_compat_u32(blob, "fsl,qe",
70 "brg-frequency", gd->arch.brg_clk, 1);
71 do_fixup_by_compat_u32(blob, "fsl,qe-gtm",
72 "clock-frequency", gd->arch.qe_clk / 2, 1);
73 fdt_fixup_qe_firmware(blob);