blob: e3b933502230489e374354b127eb0cc0355bee58 [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,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090019 .dram_ch[0] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090020 .size = 0x20000000,
21 .width = 32,
22 },
23 .dram_ch[1] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090024 .size = 0x20000000,
25 .width = 16,
26 },
27 .dram_ch[2] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090028 .size = 0x10000000,
29 .width = 16,
30 },
Masahiro Yamada04cd4e72017-02-05 10:52:12 +090031 .flags = UNIPHIER_BD_DRAM_SPARSE,
Masahiro Yamada323d1f92015-09-22 00:27:39 +090032};
33#endif
34
Masahiro Yamadaea65c982016-03-18 16:41:43 +090035#if defined(CONFIG_ARCH_UNIPHIER_LD4)
Masahiro Yamada5b660062016-03-30 20:17:02 +090036static const struct uniphier_board_data uniphier_ld4_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090037 .dram_freq = 1600,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090038 .dram_ch[0] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090039 .size = 0x10000000,
40 .width = 16,
41 },
42 .dram_ch[1] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090043 .size = 0x10000000,
44 .width = 16,
45 },
Masahiro Yamadaa74c28a2016-07-22 13:38:32 +090046 .flags = UNIPHIER_BD_DDR3PLUS,
Masahiro Yamada323d1f92015-09-22 00:27:39 +090047};
48#endif
49
Masahiro Yamadaea65c982016-03-18 16:41:43 +090050#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
Masahiro Yamada3f231112016-02-12 20:27:02 +090051/* 1GB RAM board */
Masahiro Yamada5b660062016-03-30 20:17:02 +090052static const struct uniphier_board_data uniphier_pro4_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090053 .dram_freq = 1600,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090054 .dram_ch[0] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090055 .size = 0x20000000,
56 .width = 32,
57 },
58 .dram_ch[1] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090059 .size = 0x20000000,
60 .width = 32,
61 },
Masahiro Yamada323d1f92015-09-22 00:27:39 +090062};
Masahiro Yamada3f231112016-02-12 20:27:02 +090063
64/* 2GB RAM board */
Masahiro Yamada5b660062016-03-30 20:17:02 +090065static const struct uniphier_board_data uniphier_pro4_2g_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090066 .dram_freq = 1600,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090067 .dram_ch[0] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090068 .size = 0x40000000,
69 .width = 32,
70 },
71 .dram_ch[1] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090072 .size = 0x40000000,
73 .width = 32,
74 },
Masahiro Yamada3f231112016-02-12 20:27:02 +090075};
Masahiro Yamada323d1f92015-09-22 00:27:39 +090076#endif
77
Masahiro Yamadaea65c982016-03-18 16:41:43 +090078#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
Masahiro Yamada5b660062016-03-30 20:17:02 +090079static const struct uniphier_board_data uniphier_sld8_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090080 .dram_freq = 1333,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090081 .dram_ch[0] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090082 .size = 0x10000000,
83 .width = 16,
84 },
85 .dram_ch[1] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090086 .size = 0x10000000,
87 .width = 16,
88 },
Masahiro Yamadaa74c28a2016-07-22 13:38:32 +090089 .flags = UNIPHIER_BD_DDR3PLUS,
Masahiro Yamada323d1f92015-09-22 00:27:39 +090090};
91#endif
92
Masahiro Yamadaea65c982016-03-18 16:41:43 +090093#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
Masahiro Yamada5b660062016-03-30 20:17:02 +090094static const struct uniphier_board_data uniphier_pro5_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090095 .dram_freq = 1866,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090096 .dram_ch[0] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090097 .size = 0x20000000,
98 .width = 32,
99 },
100 .dram_ch[1] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900101 .size = 0x20000000,
102 .width = 32,
103 },
Masahiro Yamada28f40d42015-09-22 00:27:40 +0900104};
105#endif
106
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900107#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900108static const struct uniphier_board_data uniphier_pxs2_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900109 .dram_freq = 2133,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900110 .dram_ch[0] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900111 .size = 0x40000000,
112 .width = 32,
113 },
114 .dram_ch[1] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900115 .size = 0x20000000,
116 .width = 32,
117 },
118 .dram_ch[2] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900119 .size = 0x20000000,
120 .width = 16,
121 },
Masahiro Yamada89c05fa2015-12-17 17:47:43 +0900122};
123#endif
124
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900125#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900126static const struct uniphier_board_data uniphier_ld6b_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900127 .dram_freq = 1866,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900128 .dram_ch[0] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900129 .size = 0x40000000,
130 .width = 32,
131 },
132 .dram_ch[1] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900133 .size = 0x20000000,
134 .width = 32,
135 },
136 .dram_ch[2] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900137 .size = 0x20000000,
138 .width = 16,
139 },
Masahiro Yamada019df872015-09-22 00:27:41 +0900140};
141#endif
142
Masahiro Yamada667dbcd2016-05-24 21:14:01 +0900143#if defined(CONFIG_ARCH_UNIPHIER_LD11)
144static const struct uniphier_board_data uniphier_ld11_data = {
145 .dram_freq = 1600,
Masahiro Yamada667dbcd2016-05-24 21:14:01 +0900146 .dram_ch[0] = {
Masahiro Yamada667dbcd2016-05-24 21:14:01 +0900147 .size = 0x20000000,
148 .width = 16,
149 },
150 .dram_ch[1] = {
Masahiro Yamada667dbcd2016-05-24 21:14:01 +0900151 .size = 0x20000000,
152 .width = 16,
153 },
154};
155#endif
156
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900157#if defined(CONFIG_ARCH_UNIPHIER_LD20)
Masahiro Yamadaf6bbec32016-09-14 01:06:10 +0900158static const struct uniphier_board_data uniphier_ld20_ref_data = {
159 .dram_freq = 1866,
Masahiro Yamadaf6bbec32016-09-14 01:06:10 +0900160 .dram_ch[0] = {
Masahiro Yamadaf6bbec32016-09-14 01:06:10 +0900161 .size = 0x40000000,
162 .width = 32,
163 },
164 .dram_ch[1] = {
Masahiro Yamadaf6bbec32016-09-14 01:06:10 +0900165 .size = 0x40000000,
166 .width = 32,
167 },
168 .dram_ch[2] = {
Masahiro Yamadaf6bbec32016-09-14 01:06:10 +0900169 .size = 0x40000000,
170 .width = 32,
171 },
172 .flags = UNIPHIER_BD_BOARD_LD20_REF,
173};
174
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900175static const struct uniphier_board_data uniphier_ld20_data = {
176 .dram_freq = 1866,
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900177 .dram_ch[0] = {
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900178 .size = 0x40000000,
179 .width = 32,
180 },
181 .dram_ch[1] = {
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900182 .size = 0x40000000,
183 .width = 32,
184 },
185 .dram_ch[2] = {
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900186 .size = 0x40000000,
187 .width = 32,
188 },
Masahiro Yamadaf6bbec32016-09-14 01:06:10 +0900189 .flags = UNIPHIER_BD_BOARD_LD20_GLOBAL,
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900190};
Masahiro Yamadabe44a462016-07-22 13:38:33 +0900191
192static const struct uniphier_board_data uniphier_ld21_data = {
193 .dram_freq = 1866,
Masahiro Yamadabe44a462016-07-22 13:38:33 +0900194 .dram_ch[0] = {
Masahiro Yamadaef70eb52016-09-14 01:06:09 +0900195 .size = 0x20000000,
Masahiro Yamadabe44a462016-07-22 13:38:33 +0900196 .width = 32,
197 },
198 .dram_ch[1] = {
Masahiro Yamadabe44a462016-07-22 13:38:33 +0900199 .size = 0x40000000,
200 .width = 32,
201 },
Masahiro Yamadafc671ed2017-03-07 05:28:25 +0900202 .flags = UNIPHIER_BD_DRAM_SPARSE | UNIPHIER_BD_BOARD_LD21_GLOBAL,
Masahiro Yamadabe44a462016-07-22 13:38:33 +0900203};
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900204#endif
205
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900206struct uniphier_board_id {
207 const char *compatible;
208 const struct uniphier_board_data *param;
209};
210
211static const struct uniphier_board_id uniphier_boards[] = {
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900212#if defined(CONFIG_ARCH_UNIPHIER_SLD3)
Masahiro Yamada52159d22016-10-07 16:43:00 +0900213 { "socionext,uniphier-sld3", &uniphier_sld3_data, },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900214#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900215#if defined(CONFIG_ARCH_UNIPHIER_LD4)
Masahiro Yamada52159d22016-10-07 16:43:00 +0900216 { "socionext,uniphier-ld4", &uniphier_ld4_data, },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900217#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900218#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
Masahiro Yamada52159d22016-10-07 16:43:00 +0900219 { "socionext,uniphier-pro4-ace", &uniphier_pro4_2g_data, },
220 { "socionext,uniphier-pro4-sanji", &uniphier_pro4_2g_data, },
221 { "socionext,uniphier-pro4", &uniphier_pro4_data, },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900222#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900223#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
Masahiro Yamada52159d22016-10-07 16:43:00 +0900224 { "socionext,uniphier-sld8", &uniphier_sld8_data, },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900225#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900226#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
Masahiro Yamada52159d22016-10-07 16:43:00 +0900227 { "socionext,uniphier-pro5", &uniphier_pro5_data, },
Masahiro Yamada28f40d42015-09-22 00:27:40 +0900228#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900229#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
Masahiro Yamada52159d22016-10-07 16:43:00 +0900230 { "socionext,uniphier-pxs2", &uniphier_pxs2_data, },
Masahiro Yamada019df872015-09-22 00:27:41 +0900231#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900232#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
Masahiro Yamada52159d22016-10-07 16:43:00 +0900233 { "socionext,uniphier-ld6b", &uniphier_ld6b_data, },
Masahiro Yamada019df872015-09-22 00:27:41 +0900234#endif
Masahiro Yamada667dbcd2016-05-24 21:14:01 +0900235#if defined(CONFIG_ARCH_UNIPHIER_LD11)
Masahiro Yamada52159d22016-10-07 16:43:00 +0900236 { "socionext,uniphier-ld11", &uniphier_ld11_data, },
Masahiro Yamada667dbcd2016-05-24 21:14:01 +0900237#endif
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900238#if defined(CONFIG_ARCH_UNIPHIER_LD20)
Masahiro Yamada52159d22016-10-07 16:43:00 +0900239 { "socionext,uniphier-ld21", &uniphier_ld21_data, },
240 { "socionext,uniphier-ld20-ref", &uniphier_ld20_ref_data, },
241 { "socionext,uniphier-ld20", &uniphier_ld20_data, },
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900242#endif
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900243};
244
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +0900245const struct uniphier_board_data *uniphier_get_board_param(void)
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900246{
247 int i;
248
249 for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) {
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +0900250 if (!fdt_node_check_compatible(gd->fdt_blob, 0,
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900251 uniphier_boards[i].compatible))
252 return uniphier_boards[i].param;
253 }
254
255 return NULL;
256}