xref: /openbmc/u-boot/arch/arm/mach-uniphier/boards.c (revision e30d2bd4)
1 /*
2  * Copyright (C) 2015-2016 Socionext Inc.
3  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #include <common.h>
9 #include <libfdt.h>
10 #include <linux/kernel.h>
11 
12 #include "init.h"
13 
14 DECLARE_GLOBAL_DATA_PTR;
15 
16 #if defined(CONFIG_ARCH_UNIPHIER_SLD3)
17 static const struct uniphier_board_data uniphier_sld3_data = {
18 	.dram_freq = 1600,
19 	.dram_ch[0] = {
20 		.size = 0x20000000,
21 		.width = 32,
22 	},
23 	.dram_ch[1] = {
24 		.size = 0x20000000,
25 		.width = 16,
26 	},
27 	.dram_ch[2] = {
28 		.size = 0x10000000,
29 		.width = 16,
30 	},
31 	.flags = UNIPHIER_BD_DRAM_SPARSE,
32 };
33 #endif
34 
35 #if defined(CONFIG_ARCH_UNIPHIER_LD4)
36 static const struct uniphier_board_data uniphier_ld4_data = {
37 	.dram_freq = 1600,
38 	.dram_ch[0] = {
39 		.size = 0x10000000,
40 		.width = 16,
41 	},
42 	.dram_ch[1] = {
43 		.size = 0x10000000,
44 		.width = 16,
45 	},
46 	.flags = UNIPHIER_BD_DDR3PLUS,
47 };
48 #endif
49 
50 #if defined(CONFIG_ARCH_UNIPHIER_PRO4)
51 /* 1GB RAM board */
52 static const struct uniphier_board_data uniphier_pro4_data = {
53 	.dram_freq = 1600,
54 	.dram_ch[0] = {
55 		.size = 0x20000000,
56 		.width = 32,
57 	},
58 	.dram_ch[1] = {
59 		.size = 0x20000000,
60 		.width = 32,
61 	},
62 };
63 
64 /* 2GB RAM board */
65 static const struct uniphier_board_data uniphier_pro4_2g_data = {
66 	.dram_freq = 1600,
67 	.dram_ch[0] = {
68 		.size = 0x40000000,
69 		.width = 32,
70 	},
71 	.dram_ch[1] = {
72 		.size = 0x40000000,
73 		.width = 32,
74 	},
75 };
76 #endif
77 
78 #if defined(CONFIG_ARCH_UNIPHIER_SLD8)
79 static const struct uniphier_board_data uniphier_sld8_data = {
80 	.dram_freq = 1333,
81 	.dram_ch[0] = {
82 		.size = 0x10000000,
83 		.width = 16,
84 	},
85 	.dram_ch[1] = {
86 		.size = 0x10000000,
87 		.width = 16,
88 	},
89 	.flags = UNIPHIER_BD_DDR3PLUS,
90 };
91 #endif
92 
93 #if defined(CONFIG_ARCH_UNIPHIER_PRO5)
94 static const struct uniphier_board_data uniphier_pro5_data = {
95 	.dram_freq = 1866,
96 	.dram_ch[0] = {
97 		.size = 0x20000000,
98 		.width = 32,
99 	},
100 	.dram_ch[1] = {
101 		.size = 0x20000000,
102 		.width = 32,
103 	},
104 };
105 #endif
106 
107 #if defined(CONFIG_ARCH_UNIPHIER_PXS2)
108 static const struct uniphier_board_data uniphier_pxs2_data = {
109 	.dram_freq = 2133,
110 	.dram_ch[0] = {
111 		.size = 0x40000000,
112 		.width = 32,
113 	},
114 	.dram_ch[1] = {
115 		.size = 0x20000000,
116 		.width = 32,
117 	},
118 	.dram_ch[2] = {
119 		.size = 0x20000000,
120 		.width = 16,
121 	},
122 };
123 #endif
124 
125 #if defined(CONFIG_ARCH_UNIPHIER_LD6B)
126 static const struct uniphier_board_data uniphier_ld6b_data = {
127 	.dram_freq = 1866,
128 	.dram_ch[0] = {
129 		.size = 0x40000000,
130 		.width = 32,
131 	},
132 	.dram_ch[1] = {
133 		.size = 0x20000000,
134 		.width = 32,
135 	},
136 	.dram_ch[2] = {
137 		.size = 0x20000000,
138 		.width = 16,
139 	},
140 };
141 #endif
142 
143 #if defined(CONFIG_ARCH_UNIPHIER_LD11)
144 static const struct uniphier_board_data uniphier_ld11_data = {
145 	.dram_freq = 1600,
146 	.dram_ch[0] = {
147 		.size = 0x20000000,
148 		.width = 16,
149 	},
150 	.dram_ch[1] = {
151 		.size = 0x20000000,
152 		.width = 16,
153 	},
154 };
155 #endif
156 
157 #if defined(CONFIG_ARCH_UNIPHIER_LD20)
158 static const struct uniphier_board_data uniphier_ld20_ref_data = {
159 	.dram_freq = 1866,
160 	.dram_ch[0] = {
161 		.size = 0x40000000,
162 		.width = 32,
163 	},
164 	.dram_ch[1] = {
165 		.size = 0x40000000,
166 		.width = 32,
167 	},
168 	.dram_ch[2] = {
169 		.size = 0x40000000,
170 		.width = 32,
171 	},
172 	.flags = UNIPHIER_BD_BOARD_LD20_REF,
173 };
174 
175 static const struct uniphier_board_data uniphier_ld20_data = {
176 	.dram_freq = 1866,
177 	.dram_ch[0] = {
178 		.size = 0x40000000,
179 		.width = 32,
180 	},
181 	.dram_ch[1] = {
182 		.size = 0x40000000,
183 		.width = 32,
184 	},
185 	.dram_ch[2] = {
186 		.size = 0x40000000,
187 		.width = 32,
188 	},
189 	.flags = UNIPHIER_BD_BOARD_LD20_GLOBAL,
190 };
191 
192 static const struct uniphier_board_data uniphier_ld21_data = {
193 	.dram_freq = 1866,
194 	.dram_ch[0] = {
195 		.size = 0x20000000,
196 		.width = 32,
197 	},
198 	.dram_ch[1] = {
199 		.size = 0x40000000,
200 		.width = 32,
201 	},
202 	.flags = UNIPHIER_BD_DRAM_SPARSE | UNIPHIER_BD_BOARD_LD21_GLOBAL,
203 };
204 #endif
205 
206 struct uniphier_board_id {
207 	const char *compatible;
208 	const struct uniphier_board_data *param;
209 };
210 
211 static const struct uniphier_board_id uniphier_boards[] = {
212 #if defined(CONFIG_ARCH_UNIPHIER_SLD3)
213 	{ "socionext,uniphier-sld3", &uniphier_sld3_data, },
214 #endif
215 #if defined(CONFIG_ARCH_UNIPHIER_LD4)
216 	{ "socionext,uniphier-ld4", &uniphier_ld4_data, },
217 #endif
218 #if defined(CONFIG_ARCH_UNIPHIER_PRO4)
219 	{ "socionext,uniphier-pro4-ace", &uniphier_pro4_2g_data, },
220 	{ "socionext,uniphier-pro4-sanji", &uniphier_pro4_2g_data, },
221 	{ "socionext,uniphier-pro4", &uniphier_pro4_data, },
222 #endif
223 #if defined(CONFIG_ARCH_UNIPHIER_SLD8)
224 	{ "socionext,uniphier-sld8", &uniphier_sld8_data, },
225 #endif
226 #if defined(CONFIG_ARCH_UNIPHIER_PRO5)
227 	{ "socionext,uniphier-pro5", &uniphier_pro5_data, },
228 #endif
229 #if defined(CONFIG_ARCH_UNIPHIER_PXS2)
230 	{ "socionext,uniphier-pxs2", &uniphier_pxs2_data, },
231 #endif
232 #if defined(CONFIG_ARCH_UNIPHIER_LD6B)
233 	{ "socionext,uniphier-ld6b", &uniphier_ld6b_data, },
234 #endif
235 #if defined(CONFIG_ARCH_UNIPHIER_LD11)
236 	{ "socionext,uniphier-ld11", &uniphier_ld11_data, },
237 #endif
238 #if defined(CONFIG_ARCH_UNIPHIER_LD20)
239 	{ "socionext,uniphier-ld21", &uniphier_ld21_data, },
240 	{ "socionext,uniphier-ld20-ref", &uniphier_ld20_ref_data, },
241 	{ "socionext,uniphier-ld20", &uniphier_ld20_data, },
242 #endif
243 };
244 
245 const struct uniphier_board_data *uniphier_get_board_param(void)
246 {
247 	int i;
248 
249 	for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) {
250 		if (!fdt_node_check_compatible(gd->fdt_blob, 0,
251 					       uniphier_boards[i].compatible))
252 			return uniphier_boards[i].param;
253 	}
254 
255 	return NULL;
256 }
257