]>
Commit | Line | Data |
---|---|---|
69018ce2 KG |
1 | /* |
2 | * Copyright 2008 Freescale Semiconductor, Inc. | |
3 | * | |
4 | * (C) Copyright 2000 | |
5 | * Wolfgang Denk, DENX Software Engineering, [email protected]. | |
6 | * | |
7 | * See file CREDITS for list of people who contributed to this | |
8 | * project. | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or | |
11 | * modify it under the terms of the GNU General Public License as | |
12 | * published by the Free Software Foundation; either version 2 of | |
13 | * the License, or (at your option) any later version. | |
14 | * | |
15 | * This program is distributed in the hope that it will be useful, | |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | * GNU General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU General Public License | |
21 | * along with this program; if not, write to the Free Software | |
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
23 | * MA 02111-1307 USA | |
24 | */ | |
25 | ||
26 | #include <common.h> | |
27 | #include <libfdt.h> | |
28 | #include <fdt_support.h> | |
29 | #include "qe.h" | |
30 | ||
31 | DECLARE_GLOBAL_DATA_PTR; | |
32 | ||
33 | /* | |
34 | * If a QE firmware has been uploaded, then add the 'firmware' node under | |
35 | * the 'qe' node. | |
36 | */ | |
37 | void fdt_fixup_qe_firmware(void *blob) | |
38 | { | |
39 | struct qe_firmware_info *qe_fw_info; | |
40 | int node, ret; | |
41 | ||
42 | qe_fw_info = qe_get_firmware_info(); | |
43 | if (!qe_fw_info) | |
44 | return; | |
45 | ||
46 | node = fdt_path_offset(blob, "/qe"); | |
47 | if (node < 0) | |
48 | return; | |
49 | ||
50 | /* We assume the node doesn't exist yet */ | |
51 | node = fdt_add_subnode(blob, node, "firmware"); | |
52 | if (node < 0) | |
53 | return; | |
54 | ||
55 | ret = fdt_setprop(blob, node, "extended-modes", | |
56 | &qe_fw_info->extended_modes, sizeof(u64)); | |
57 | if (ret < 0) | |
58 | goto error; | |
59 | ||
60 | ret = fdt_setprop_string(blob, node, "id", qe_fw_info->id); | |
61 | if (ret < 0) | |
62 | goto error; | |
63 | ||
64 | ret = fdt_setprop(blob, node, "virtual-traps", qe_fw_info->vtraps, | |
65 | sizeof(qe_fw_info->vtraps)); | |
66 | if (ret < 0) | |
67 | goto error; | |
68 | ||
69 | return; | |
70 | ||
71 | error: | |
72 | fdt_del_node(blob, node); | |
73 | } | |
74 | ||
75 | void ft_qe_setup(void *blob) | |
76 | { | |
69018ce2 KG |
77 | do_fixup_by_prop_u32(blob, "device_type", "qe", 4, |
78 | "bus-frequency", gd->qe_clk, 1); | |
79 | do_fixup_by_prop_u32(blob, "device_type", "qe", 4, | |
80 | "brg-frequency", gd->brg_clk, 1); | |
81 | do_fixup_by_compat_u32(blob, "fsl,qe", | |
82 | "clock-frequency", gd->qe_clk, 1); | |
83 | do_fixup_by_compat_u32(blob, "fsl,qe", | |
84 | "bus-frequency", gd->qe_clk, 1); | |
85 | do_fixup_by_compat_u32(blob, "fsl,qe", | |
86 | "brg-frequency", gd->brg_clk, 1); | |
3fca8037 AV |
87 | do_fixup_by_compat_u32(blob, "fsl,qe-gtm", |
88 | "clock-frequency", gd->qe_clk / 2, 1); | |
69018ce2 | 89 | fdt_fixup_qe_firmware(blob); |
69018ce2 | 90 | } |