blob: ed308f3ecba0d4c2efc839ea02f46de7a29ac859 [file] [log] [blame]
Masahiro Yamada323d1f92015-09-22 00:27:39 +09001/*
2 * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +09007#include <common.h>
Masahiro Yamada323d1f92015-09-22 00:27:39 +09008#include <libfdt.h>
9#include <linux/kernel.h>
Masahiro Yamada107b3fb2016-01-09 01:51:13 +090010
11#include "init.h"
Masahiro Yamada323d1f92015-09-22 00:27:39 +090012
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +090013DECLARE_GLOBAL_DATA_PTR;
14
Masahiro Yamadaea65c982016-03-18 16:41:43 +090015#if defined(CONFIG_ARCH_UNIPHIER_SLD3)
Masahiro Yamada5b660062016-03-30 20:17:02 +090016static const struct uniphier_board_data uniphier_sld3_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090017 .dram_freq = 1600,
18 .dram_nr_ch = 3,
19 .dram_ch[0] = {
20 .base = 0x80000000,
21 .size = 0x20000000,
22 .width = 32,
23 },
24 .dram_ch[1] = {
25 .base = 0xc0000000,
26 .size = 0x20000000,
27 .width = 16,
28 },
29 .dram_ch[2] = {
30 .base = 0xc0000000,
31 .size = 0x10000000,
32 .width = 16,
33 },
Masahiro Yamada323d1f92015-09-22 00:27:39 +090034};
35#endif
36
Masahiro Yamadaea65c982016-03-18 16:41:43 +090037#if defined(CONFIG_ARCH_UNIPHIER_LD4)
Masahiro Yamada5b660062016-03-30 20:17:02 +090038static const struct uniphier_board_data uniphier_ld4_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090039 .dram_freq = 1600,
40 .dram_nr_ch = 2,
Masahiro Yamada4021b432016-02-26 14:21:40 +090041 .dram_ddr3plus = true,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090042 .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 Yamada323d1f92015-09-22 00:27:39 +090052};
53#endif
54
Masahiro Yamadaea65c982016-03-18 16:41:43 +090055#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
Masahiro Yamada3f231112016-02-12 20:27:02 +090056/* 1GB RAM board */
Masahiro Yamada5b660062016-03-30 20:17:02 +090057static const struct uniphier_board_data uniphier_pro4_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090058 .dram_freq = 1600,
59 .dram_nr_ch = 2,
60 .dram_ch[0] = {
61 .base = 0x80000000,
62 .size = 0x20000000,
63 .width = 32,
64 },
65 .dram_ch[1] = {
66 .base = 0xa0000000,
67 .size = 0x20000000,
68 .width = 32,
69 },
Masahiro Yamada323d1f92015-09-22 00:27:39 +090070};
Masahiro Yamada3f231112016-02-12 20:27:02 +090071
72/* 2GB RAM board */
Masahiro Yamada5b660062016-03-30 20:17:02 +090073static const struct uniphier_board_data uniphier_pro4_2g_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090074 .dram_freq = 1600,
75 .dram_nr_ch = 2,
76 .dram_ch[0] = {
77 .base = 0x80000000,
78 .size = 0x40000000,
79 .width = 32,
80 },
81 .dram_ch[1] = {
82 .base = 0xc0000000,
83 .size = 0x40000000,
84 .width = 32,
85 },
Masahiro Yamada3f231112016-02-12 20:27:02 +090086};
Masahiro Yamada323d1f92015-09-22 00:27:39 +090087#endif
88
Masahiro Yamadaea65c982016-03-18 16:41:43 +090089#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
Masahiro Yamada5b660062016-03-30 20:17:02 +090090static const struct uniphier_board_data uniphier_sld8_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090091 .dram_freq = 1333,
92 .dram_nr_ch = 2,
Masahiro Yamada4021b432016-02-26 14:21:40 +090093 .dram_ddr3plus = true,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090094 .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 Yamada323d1f92015-09-22 00:27:39 +0900104};
105#endif
106
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900107#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900108static const struct uniphier_board_data uniphier_pro5_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900109 .dram_freq = 1866,
110 .dram_nr_ch = 2,
111 .dram_ch[0] = {
112 .base = 0x80000000,
113 .size = 0x20000000,
114 .width = 32,
115 },
116 .dram_ch[1] = {
117 .base = 0xa0000000,
118 .size = 0x20000000,
119 .width = 32,
120 },
Masahiro Yamada28f40d42015-09-22 00:27:40 +0900121};
122#endif
123
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900124#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900125static const struct uniphier_board_data uniphier_pxs2_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900126 .dram_freq = 2133,
127 .dram_nr_ch = 3,
128 .dram_ch[0] = {
129 .base = 0x80000000,
130 .size = 0x40000000,
131 .width = 32,
132 },
133 .dram_ch[1] = {
134 .base = 0xc0000000,
135 .size = 0x20000000,
136 .width = 32,
137 },
138 .dram_ch[2] = {
139 .base = 0xe0000000,
140 .size = 0x20000000,
141 .width = 16,
142 },
Masahiro Yamada89c05fa2015-12-17 17:47:43 +0900143};
144#endif
145
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900146#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900147static const struct uniphier_board_data uniphier_ld6b_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900148 .dram_freq = 1866,
149 .dram_nr_ch = 3,
150 .dram_ch[0] = {
151 .base = 0x80000000,
152 .size = 0x40000000,
153 .width = 32,
154 },
155 .dram_ch[1] = {
156 .base = 0xc0000000,
157 .size = 0x20000000,
158 .width = 32,
159 },
160 .dram_ch[2] = {
161 .base = 0xe0000000,
162 .size = 0x20000000,
163 .width = 16,
164 },
Masahiro Yamada019df872015-09-22 00:27:41 +0900165};
166#endif
167
Masahiro Yamada667dbcd2016-05-24 21:14:01 +0900168#if defined(CONFIG_ARCH_UNIPHIER_LD11)
169static const struct uniphier_board_data uniphier_ld11_data = {
170 .dram_freq = 1600,
171 .dram_nr_ch = 2,
172 .dram_ch[0] = {
173 .base = 0x80000000,
174 .size = 0x20000000,
175 .width = 16,
176 },
177 .dram_ch[1] = {
178 .base = 0xa0000000,
179 .size = 0x20000000,
180 .width = 16,
181 },
182};
183#endif
184
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900185#if defined(CONFIG_ARCH_UNIPHIER_LD20)
186static const struct uniphier_board_data uniphier_ld20_data = {
187 .dram_freq = 1866,
188 .dram_nr_ch = 3,
189 .dram_ch[0] = {
190 .base = 0x80000000,
191 .size = 0x40000000,
192 .width = 32,
193 },
194 .dram_ch[1] = {
195 .base = 0xc0000000,
196 .size = 0x40000000,
197 .width = 32,
198 },
199 .dram_ch[2] = {
200 .base = 0x100000000UL,
201 .size = 0x40000000,
202 .width = 32,
203 },
204};
205#endif
206
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900207struct uniphier_board_id {
208 const char *compatible;
209 const struct uniphier_board_data *param;
210};
211
212static const struct uniphier_board_id uniphier_boards[] = {
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900213#if defined(CONFIG_ARCH_UNIPHIER_SLD3)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900214 { "socionext,ph1-sld3", &uniphier_sld3_data, },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900215#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900216#if defined(CONFIG_ARCH_UNIPHIER_LD4)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900217 { "socionext,ph1-ld4", &uniphier_ld4_data, },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900218#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900219#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900220 { "socionext,ph1-pro4-ace", &uniphier_pro4_2g_data, },
221 { "socionext,ph1-pro4-sanji", &uniphier_pro4_2g_data, },
222 { "socionext,ph1-pro4", &uniphier_pro4_data, },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900223#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900224#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900225 { "socionext,ph1-sld8", &uniphier_sld8_data, },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900226#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900227#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900228 { "socionext,ph1-pro5", &uniphier_pro5_data, },
Masahiro Yamada28f40d42015-09-22 00:27:40 +0900229#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900230#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900231 { "socionext,proxstream2", &uniphier_pxs2_data, },
Masahiro Yamada019df872015-09-22 00:27:41 +0900232#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900233#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900234 { "socionext,ph1-ld6b", &uniphier_ld6b_data, },
Masahiro Yamada019df872015-09-22 00:27:41 +0900235#endif
Masahiro Yamada667dbcd2016-05-24 21:14:01 +0900236#if defined(CONFIG_ARCH_UNIPHIER_LD11)
237 { "socionext,ph1-ld11", &uniphier_ld11_data, },
238#endif
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900239#if defined(CONFIG_ARCH_UNIPHIER_LD20)
240 { "socionext,ph1-ld20", &uniphier_ld20_data, },
241#endif
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900242};
243
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +0900244const struct uniphier_board_data *uniphier_get_board_param(void)
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900245{
246 int i;
247
248 for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) {
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +0900249 if (!fdt_node_check_compatible(gd->fdt_blob, 0,
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900250 uniphier_boards[i].compatible))
251 return uniphier_boards[i].param;
252 }
253
254 return NULL;
255}