blob: 20093d8178a6cab432ee5a05ca45db1e0b0ec207 [file] [log] [blame]
Masahiro Yamada323d1f92015-09-22 00:27:39 +09001/*
Masahiro Yamadaa74c28a2016-07-22 13:38:32 +09002 * Copyright (C) 2015-2016 Socionext Inc.
3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada323d1f92015-09-22 00:27:39 +09004 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +09008#include <common.h>
Masahiro Yamada323d1f92015-09-22 00:27:39 +09009#include <libfdt.h>
10#include <linux/kernel.h>
Masahiro Yamada107b3fb2016-01-09 01:51:13 +090011
12#include "init.h"
Masahiro Yamada323d1f92015-09-22 00:27:39 +090013
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +090014DECLARE_GLOBAL_DATA_PTR;
15
Masahiro Yamadaea65c982016-03-18 16:41:43 +090016#if defined(CONFIG_ARCH_UNIPHIER_SLD3)
Masahiro Yamada5b660062016-03-30 20:17:02 +090017static const struct uniphier_board_data uniphier_sld3_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090018 .dram_freq = 1600,
19 .dram_nr_ch = 3,
20 .dram_ch[0] = {
21 .base = 0x80000000,
22 .size = 0x20000000,
23 .width = 32,
24 },
25 .dram_ch[1] = {
26 .base = 0xc0000000,
27 .size = 0x20000000,
28 .width = 16,
29 },
30 .dram_ch[2] = {
31 .base = 0xc0000000,
32 .size = 0x10000000,
33 .width = 16,
34 },
Masahiro Yamada323d1f92015-09-22 00:27:39 +090035};
36#endif
37
Masahiro Yamadaea65c982016-03-18 16:41:43 +090038#if defined(CONFIG_ARCH_UNIPHIER_LD4)
Masahiro Yamada5b660062016-03-30 20:17:02 +090039static const struct uniphier_board_data uniphier_ld4_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090040 .dram_freq = 1600,
41 .dram_nr_ch = 2,
42 .dram_ch[0] = {
43 .base = 0x80000000,
44 .size = 0x10000000,
45 .width = 16,
46 },
47 .dram_ch[1] = {
48 .base = 0x90000000,
49 .size = 0x10000000,
50 .width = 16,
51 },
Masahiro Yamadaa74c28a2016-07-22 13:38:32 +090052 .flags = UNIPHIER_BD_DDR3PLUS,
Masahiro Yamada323d1f92015-09-22 00:27:39 +090053};
54#endif
55
Masahiro Yamadaea65c982016-03-18 16:41:43 +090056#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
Masahiro Yamada3f231112016-02-12 20:27:02 +090057/* 1GB RAM board */
Masahiro Yamada5b660062016-03-30 20:17:02 +090058static const struct uniphier_board_data uniphier_pro4_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090059 .dram_freq = 1600,
60 .dram_nr_ch = 2,
61 .dram_ch[0] = {
62 .base = 0x80000000,
63 .size = 0x20000000,
64 .width = 32,
65 },
66 .dram_ch[1] = {
67 .base = 0xa0000000,
68 .size = 0x20000000,
69 .width = 32,
70 },
Masahiro Yamada323d1f92015-09-22 00:27:39 +090071};
Masahiro Yamada3f231112016-02-12 20:27:02 +090072
73/* 2GB RAM board */
Masahiro Yamada5b660062016-03-30 20:17:02 +090074static const struct uniphier_board_data uniphier_pro4_2g_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090075 .dram_freq = 1600,
76 .dram_nr_ch = 2,
77 .dram_ch[0] = {
78 .base = 0x80000000,
79 .size = 0x40000000,
80 .width = 32,
81 },
82 .dram_ch[1] = {
83 .base = 0xc0000000,
84 .size = 0x40000000,
85 .width = 32,
86 },
Masahiro Yamada3f231112016-02-12 20:27:02 +090087};
Masahiro Yamada323d1f92015-09-22 00:27:39 +090088#endif
89
Masahiro Yamadaea65c982016-03-18 16:41:43 +090090#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
Masahiro Yamada5b660062016-03-30 20:17:02 +090091static const struct uniphier_board_data uniphier_sld8_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090092 .dram_freq = 1333,
93 .dram_nr_ch = 2,
94 .dram_ch[0] = {
95 .base = 0x80000000,
96 .size = 0x10000000,
97 .width = 16,
98 },
99 .dram_ch[1] = {
100 .base = 0x90000000,
101 .size = 0x10000000,
102 .width = 16,
103 },
Masahiro Yamadaa74c28a2016-07-22 13:38:32 +0900104 .flags = UNIPHIER_BD_DDR3PLUS,
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900105};
106#endif
107
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900108#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900109static const struct uniphier_board_data uniphier_pro5_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900110 .dram_freq = 1866,
111 .dram_nr_ch = 2,
112 .dram_ch[0] = {
113 .base = 0x80000000,
114 .size = 0x20000000,
115 .width = 32,
116 },
117 .dram_ch[1] = {
118 .base = 0xa0000000,
119 .size = 0x20000000,
120 .width = 32,
121 },
Masahiro Yamada28f40d42015-09-22 00:27:40 +0900122};
123#endif
124
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900125#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900126static const struct uniphier_board_data uniphier_pxs2_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900127 .dram_freq = 2133,
128 .dram_nr_ch = 3,
129 .dram_ch[0] = {
130 .base = 0x80000000,
131 .size = 0x40000000,
132 .width = 32,
133 },
134 .dram_ch[1] = {
135 .base = 0xc0000000,
136 .size = 0x20000000,
137 .width = 32,
138 },
139 .dram_ch[2] = {
140 .base = 0xe0000000,
141 .size = 0x20000000,
142 .width = 16,
143 },
Masahiro Yamada89c05fa2015-12-17 17:47:43 +0900144};
145#endif
146
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900147#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900148static const struct uniphier_board_data uniphier_ld6b_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900149 .dram_freq = 1866,
150 .dram_nr_ch = 3,
151 .dram_ch[0] = {
152 .base = 0x80000000,
153 .size = 0x40000000,
154 .width = 32,
155 },
156 .dram_ch[1] = {
157 .base = 0xc0000000,
158 .size = 0x20000000,
159 .width = 32,
160 },
161 .dram_ch[2] = {
162 .base = 0xe0000000,
163 .size = 0x20000000,
164 .width = 16,
165 },
Masahiro Yamada019df872015-09-22 00:27:41 +0900166};
167#endif
168
Masahiro Yamada667dbcd2016-05-24 21:14:01 +0900169#if defined(CONFIG_ARCH_UNIPHIER_LD11)
170static const struct uniphier_board_data uniphier_ld11_data = {
171 .dram_freq = 1600,
172 .dram_nr_ch = 2,
173 .dram_ch[0] = {
174 .base = 0x80000000,
175 .size = 0x20000000,
176 .width = 16,
177 },
178 .dram_ch[1] = {
179 .base = 0xa0000000,
180 .size = 0x20000000,
181 .width = 16,
182 },
183};
184#endif
185
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900186#if defined(CONFIG_ARCH_UNIPHIER_LD20)
187static const struct uniphier_board_data uniphier_ld20_data = {
188 .dram_freq = 1866,
189 .dram_nr_ch = 3,
190 .dram_ch[0] = {
191 .base = 0x80000000,
192 .size = 0x40000000,
193 .width = 32,
194 },
195 .dram_ch[1] = {
196 .base = 0xc0000000,
197 .size = 0x40000000,
198 .width = 32,
199 },
200 .dram_ch[2] = {
201 .base = 0x100000000UL,
202 .size = 0x40000000,
203 .width = 32,
204 },
205};
Masahiro Yamadabe44a462016-07-22 13:38:33 +0900206
207static const struct uniphier_board_data uniphier_ld21_data = {
208 .dram_freq = 1866,
209 .dram_nr_ch = 2,
210 .dram_ch[0] = {
211 .base = 0x80000000,
212 .size = 0x40000000,
213 .width = 32,
214 },
215 .dram_ch[1] = {
216 .base = 0xc0000000,
217 .size = 0x40000000,
218 .width = 32,
219 },
220 .flags = UNIPHIER_BD_PACKAGE_LD21,
221};
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900222#endif
223
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900224struct uniphier_board_id {
225 const char *compatible;
226 const struct uniphier_board_data *param;
227};
228
229static const struct uniphier_board_id uniphier_boards[] = {
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900230#if defined(CONFIG_ARCH_UNIPHIER_SLD3)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900231 { "socionext,ph1-sld3", &uniphier_sld3_data, },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900232#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900233#if defined(CONFIG_ARCH_UNIPHIER_LD4)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900234 { "socionext,ph1-ld4", &uniphier_ld4_data, },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900235#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900236#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900237 { "socionext,ph1-pro4-ace", &uniphier_pro4_2g_data, },
238 { "socionext,ph1-pro4-sanji", &uniphier_pro4_2g_data, },
239 { "socionext,ph1-pro4", &uniphier_pro4_data, },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900240#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900241#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900242 { "socionext,ph1-sld8", &uniphier_sld8_data, },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900243#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900244#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900245 { "socionext,ph1-pro5", &uniphier_pro5_data, },
Masahiro Yamada28f40d42015-09-22 00:27:40 +0900246#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900247#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900248 { "socionext,proxstream2", &uniphier_pxs2_data, },
Masahiro Yamada019df872015-09-22 00:27:41 +0900249#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900250#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900251 { "socionext,ph1-ld6b", &uniphier_ld6b_data, },
Masahiro Yamada019df872015-09-22 00:27:41 +0900252#endif
Masahiro Yamada667dbcd2016-05-24 21:14:01 +0900253#if defined(CONFIG_ARCH_UNIPHIER_LD11)
254 { "socionext,ph1-ld11", &uniphier_ld11_data, },
255#endif
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900256#if defined(CONFIG_ARCH_UNIPHIER_LD20)
Masahiro Yamadabe44a462016-07-22 13:38:33 +0900257 { "socionext,ph1-ld21", &uniphier_ld21_data, },
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900258 { "socionext,ph1-ld20", &uniphier_ld20_data, },
259#endif
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900260};
261
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +0900262const struct uniphier_board_data *uniphier_get_board_param(void)
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900263{
264 int i;
265
266 for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) {
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +0900267 if (!fdt_node_check_compatible(gd->fdt_blob, 0,
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900268 uniphier_boards[i].compatible))
269 return uniphier_boards[i].param;
270 }
271
272 return NULL;
273}