blob: 05b7c7612eaad23e00ca1c65325b48407c4d5b48 [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 Yamada323d1f92015-09-22 00:27:39 +090015#if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD3)
16static const struct uniphier_board_data ph1_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
37#if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4)
38static const struct uniphier_board_data ph1_ld4_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090039 .dram_freq = 1600,
40 .dram_nr_ch = 2,
41 .dram_ch[0] = {
42 .base = 0x80000000,
43 .size = 0x10000000,
44 .width = 16,
45 },
46 .dram_ch[1] = {
47 .base = 0x90000000,
48 .size = 0x10000000,
49 .width = 16,
50 },
Masahiro Yamada323d1f92015-09-22 00:27:39 +090051};
52#endif
53
54#if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4)
Masahiro Yamada3f231112016-02-12 20:27:02 +090055/* 1GB RAM board */
Masahiro Yamada323d1f92015-09-22 00:27:39 +090056static const struct uniphier_board_data ph1_pro4_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090057 .dram_freq = 1600,
58 .dram_nr_ch = 2,
59 .dram_ch[0] = {
60 .base = 0x80000000,
61 .size = 0x20000000,
62 .width = 32,
63 },
64 .dram_ch[1] = {
65 .base = 0xa0000000,
66 .size = 0x20000000,
67 .width = 32,
68 },
Masahiro Yamada323d1f92015-09-22 00:27:39 +090069};
Masahiro Yamada3f231112016-02-12 20:27:02 +090070
71/* 2GB RAM board */
72static const struct uniphier_board_data ph1_pro4_2g_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090073 .dram_freq = 1600,
74 .dram_nr_ch = 2,
75 .dram_ch[0] = {
76 .base = 0x80000000,
77 .size = 0x40000000,
78 .width = 32,
79 },
80 .dram_ch[1] = {
81 .base = 0xc0000000,
82 .size = 0x40000000,
83 .width = 32,
84 },
Masahiro Yamada3f231112016-02-12 20:27:02 +090085};
Masahiro Yamada323d1f92015-09-22 00:27:39 +090086#endif
87
88#if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8)
89static const struct uniphier_board_data ph1_sld8_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090090 .dram_freq = 1333,
91 .dram_nr_ch = 2,
92 .dram_ch[0] = {
93 .base = 0x80000000,
94 .size = 0x10000000,
95 .width = 16,
96 },
97 .dram_ch[1] = {
98 .base = 0x90000000,
99 .size = 0x10000000,
100 .width = 16,
101 },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900102};
103#endif
104
Masahiro Yamada28f40d42015-09-22 00:27:40 +0900105#if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO5)
106static const struct uniphier_board_data ph1_pro5_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900107 .dram_freq = 1866,
108 .dram_nr_ch = 2,
109 .dram_ch[0] = {
110 .base = 0x80000000,
111 .size = 0x20000000,
112 .width = 32,
113 },
114 .dram_ch[1] = {
115 .base = 0xa0000000,
116 .size = 0x20000000,
117 .width = 32,
118 },
Masahiro Yamada28f40d42015-09-22 00:27:40 +0900119};
120#endif
121
Masahiro Yamada89c05fa2015-12-17 17:47:43 +0900122#if defined(CONFIG_ARCH_UNIPHIER_PROXSTREAM2)
Masahiro Yamada019df872015-09-22 00:27:41 +0900123static const struct uniphier_board_data proxstream2_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900124 .dram_freq = 2133,
125 .dram_nr_ch = 3,
126 .dram_ch[0] = {
127 .base = 0x80000000,
128 .size = 0x40000000,
129 .width = 32,
130 },
131 .dram_ch[1] = {
132 .base = 0xc0000000,
133 .size = 0x20000000,
134 .width = 32,
135 },
136 .dram_ch[2] = {
137 .base = 0xe0000000,
138 .size = 0x20000000,
139 .width = 16,
140 },
Masahiro Yamada89c05fa2015-12-17 17:47:43 +0900141};
142#endif
143
144#if defined(CONFIG_ARCH_UNIPHIER_PH1_LD6B)
145static const struct uniphier_board_data ph1_ld6b_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900146 .dram_freq = 1866,
147 .dram_nr_ch = 3,
148 .dram_ch[0] = {
149 .base = 0x80000000,
150 .size = 0x40000000,
151 .width = 32,
152 },
153 .dram_ch[1] = {
154 .base = 0xc0000000,
155 .size = 0x20000000,
156 .width = 32,
157 },
158 .dram_ch[2] = {
159 .base = 0xe0000000,
160 .size = 0x20000000,
161 .width = 16,
162 },
Masahiro Yamada019df872015-09-22 00:27:41 +0900163};
164#endif
165
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900166struct uniphier_board_id {
167 const char *compatible;
168 const struct uniphier_board_data *param;
169};
170
171static const struct uniphier_board_id uniphier_boards[] = {
172#if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD3)
173 { "socionext,ph1-sld3", &ph1_sld3_data, },
174#endif
175#if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4)
176 { "socionext,ph1-ld4", &ph1_ld4_data, },
177#endif
178#if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4)
Masahiro Yamada3f231112016-02-12 20:27:02 +0900179 { "socionext,ph1-pro4-ace", &ph1_pro4_2g_data, },
180 { "socionext,ph1-pro4-sanji", &ph1_pro4_2g_data, },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900181 { "socionext,ph1-pro4", &ph1_pro4_data, },
182#endif
183#if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8)
184 { "socionext,ph1-sld8", &ph1_sld8_data, },
185#endif
Masahiro Yamada28f40d42015-09-22 00:27:40 +0900186#if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO5)
187 { "socionext,ph1-pro5", &ph1_pro5_data, },
188#endif
Masahiro Yamada019df872015-09-22 00:27:41 +0900189#if defined(CONFIG_ARCH_UNIPHIER_PROXSTREAM2)
190 { "socionext,proxstream2", &proxstream2_data, },
191#endif
192#if defined(CONFIG_ARCH_UNIPHIER_PH1_LD6B)
Masahiro Yamada89c05fa2015-12-17 17:47:43 +0900193 { "socionext,ph1-ld6b", &ph1_ld6b_data, },
Masahiro Yamada019df872015-09-22 00:27:41 +0900194#endif
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900195};
196
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +0900197const struct uniphier_board_data *uniphier_get_board_param(void)
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900198{
199 int i;
200
201 for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) {
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +0900202 if (!fdt_node_check_compatible(gd->fdt_blob, 0,
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900203 uniphier_boards[i].compatible))
204 return uniphier_boards[i].param;
205 }
206
207 return NULL;
208}