blob: 78de256a01e54d3d05a9f75dc62148cf636ac676 [file] [log] [blame]
Masahiro Yamada75f16f82015-09-22 00:27:39 +09001/*
Masahiro Yamadafcdbbec2016-07-22 13:38:32 +09002 * Copyright (C) 2015-2016 Socionext Inc.
3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada75f16f82015-09-22 00:27:39 +09004 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
Masahiro Yamadac93f2792015-12-17 17:47:42 +09008#include <common.h>
Masahiro Yamada75f16f82015-09-22 00:27:39 +09009#include <libfdt.h>
10#include <linux/kernel.h>
Masahiro Yamadaefdf3402016-01-09 01:51:13 +090011
12#include "init.h"
Masahiro Yamada75f16f82015-09-22 00:27:39 +090013
Masahiro Yamadac93f2792015-12-17 17:47:42 +090014DECLARE_GLOBAL_DATA_PTR;
15
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090016#if defined(CONFIG_ARCH_UNIPHIER_SLD3)
Masahiro Yamada98905692016-03-30 20:17:02 +090017static const struct uniphier_board_data uniphier_sld3_data = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090018 .dram_freq = 1600,
Masahiro Yamada799e6f22016-02-26 14:21:34 +090019 .dram_ch[0] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090020 .size = 0x20000000,
21 .width = 32,
22 },
23 .dram_ch[1] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090024 .size = 0x20000000,
25 .width = 16,
26 },
27 .dram_ch[2] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090028 .size = 0x10000000,
29 .width = 16,
30 },
Masahiro Yamada3dc80972017-02-05 10:52:12 +090031 .flags = UNIPHIER_BD_DRAM_SPARSE,
Masahiro Yamada75f16f82015-09-22 00:27:39 +090032};
33#endif
34
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090035#if defined(CONFIG_ARCH_UNIPHIER_LD4)
Masahiro Yamada98905692016-03-30 20:17:02 +090036static const struct uniphier_board_data uniphier_ld4_data = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090037 .dram_freq = 1600,
Masahiro Yamada799e6f22016-02-26 14:21:34 +090038 .dram_ch[0] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090039 .size = 0x10000000,
40 .width = 16,
41 },
42 .dram_ch[1] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090043 .size = 0x10000000,
44 .width = 16,
45 },
Masahiro Yamadafcdbbec2016-07-22 13:38:32 +090046 .flags = UNIPHIER_BD_DDR3PLUS,
Masahiro Yamada75f16f82015-09-22 00:27:39 +090047};
48#endif
49
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090050#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
Masahiro Yamada40efc4f2016-02-12 20:27:02 +090051/* 1GB RAM board */
Masahiro Yamada98905692016-03-30 20:17:02 +090052static const struct uniphier_board_data uniphier_pro4_data = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090053 .dram_freq = 1600,
Masahiro Yamada799e6f22016-02-26 14:21:34 +090054 .dram_ch[0] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090055 .size = 0x20000000,
56 .width = 32,
57 },
58 .dram_ch[1] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090059 .size = 0x20000000,
60 .width = 32,
61 },
Masahiro Yamada75f16f82015-09-22 00:27:39 +090062};
Masahiro Yamada40efc4f2016-02-12 20:27:02 +090063
64/* 2GB RAM board */
Masahiro Yamada98905692016-03-30 20:17:02 +090065static const struct uniphier_board_data uniphier_pro4_2g_data = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090066 .dram_freq = 1600,
Masahiro Yamada799e6f22016-02-26 14:21:34 +090067 .dram_ch[0] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090068 .size = 0x40000000,
69 .width = 32,
70 },
71 .dram_ch[1] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090072 .size = 0x40000000,
73 .width = 32,
74 },
Masahiro Yamada40efc4f2016-02-12 20:27:02 +090075};
Masahiro Yamada75f16f82015-09-22 00:27:39 +090076#endif
77
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090078#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
Masahiro Yamada98905692016-03-30 20:17:02 +090079static const struct uniphier_board_data uniphier_sld8_data = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090080 .dram_freq = 1333,
Masahiro Yamada799e6f22016-02-26 14:21:34 +090081 .dram_ch[0] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090082 .size = 0x10000000,
83 .width = 16,
84 },
85 .dram_ch[1] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090086 .size = 0x10000000,
87 .width = 16,
88 },
Masahiro Yamadafcdbbec2016-07-22 13:38:32 +090089 .flags = UNIPHIER_BD_DDR3PLUS,
Masahiro Yamada75f16f82015-09-22 00:27:39 +090090};
91#endif
92
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090093#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
Masahiro Yamada98905692016-03-30 20:17:02 +090094static const struct uniphier_board_data uniphier_pro5_data = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090095 .dram_freq = 1866,
Masahiro Yamada799e6f22016-02-26 14:21:34 +090096 .dram_ch[0] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090097 .size = 0x20000000,
98 .width = 32,
99 },
100 .dram_ch[1] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900101 .size = 0x20000000,
102 .width = 32,
103 },
Masahiro Yamadad5167d52015-09-22 00:27:40 +0900104};
105#endif
106
Masahiro Yamada53c59ae2016-03-18 16:41:43 +0900107#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
Masahiro Yamada98905692016-03-30 20:17:02 +0900108static const struct uniphier_board_data uniphier_pxs2_data = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900109 .dram_freq = 2133,
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900110 .dram_ch[0] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900111 .size = 0x40000000,
112 .width = 32,
113 },
114 .dram_ch[1] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900115 .size = 0x20000000,
116 .width = 32,
117 },
118 .dram_ch[2] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900119 .size = 0x20000000,
120 .width = 16,
121 },
Masahiro Yamada9dd408f2015-12-17 17:47:43 +0900122};
123#endif
124
Masahiro Yamada53c59ae2016-03-18 16:41:43 +0900125#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
Masahiro Yamada98905692016-03-30 20:17:02 +0900126static const struct uniphier_board_data uniphier_ld6b_data = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900127 .dram_freq = 1866,
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900128 .dram_ch[0] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900129 .size = 0x40000000,
130 .width = 32,
131 },
132 .dram_ch[1] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900133 .size = 0x20000000,
134 .width = 32,
135 },
136 .dram_ch[2] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900137 .size = 0x20000000,
138 .width = 16,
139 },
Masahiro Yamada1fe65d32015-09-22 00:27:41 +0900140};
141#endif
142
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900143struct uniphier_board_id {
144 const char *compatible;
145 const struct uniphier_board_data *param;
146};
147
148static const struct uniphier_board_id uniphier_boards[] = {
Masahiro Yamada53c59ae2016-03-18 16:41:43 +0900149#if defined(CONFIG_ARCH_UNIPHIER_SLD3)
Masahiro Yamada39a67ff2016-10-07 16:43:00 +0900150 { "socionext,uniphier-sld3", &uniphier_sld3_data, },
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900151#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +0900152#if defined(CONFIG_ARCH_UNIPHIER_LD4)
Masahiro Yamada39a67ff2016-10-07 16:43:00 +0900153 { "socionext,uniphier-ld4", &uniphier_ld4_data, },
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900154#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +0900155#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
Masahiro Yamada39a67ff2016-10-07 16:43:00 +0900156 { "socionext,uniphier-pro4-ace", &uniphier_pro4_2g_data, },
157 { "socionext,uniphier-pro4-sanji", &uniphier_pro4_2g_data, },
158 { "socionext,uniphier-pro4", &uniphier_pro4_data, },
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900159#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +0900160#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
Masahiro Yamada39a67ff2016-10-07 16:43:00 +0900161 { "socionext,uniphier-sld8", &uniphier_sld8_data, },
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900162#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +0900163#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
Masahiro Yamada39a67ff2016-10-07 16:43:00 +0900164 { "socionext,uniphier-pro5", &uniphier_pro5_data, },
Masahiro Yamadad5167d52015-09-22 00:27:40 +0900165#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +0900166#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
Masahiro Yamada39a67ff2016-10-07 16:43:00 +0900167 { "socionext,uniphier-pxs2", &uniphier_pxs2_data, },
Masahiro Yamada1fe65d32015-09-22 00:27:41 +0900168#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +0900169#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
Masahiro Yamada39a67ff2016-10-07 16:43:00 +0900170 { "socionext,uniphier-ld6b", &uniphier_ld6b_data, },
Masahiro Yamada1fe65d32015-09-22 00:27:41 +0900171#endif
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900172};
173
Masahiro Yamadac93f2792015-12-17 17:47:42 +0900174const struct uniphier_board_data *uniphier_get_board_param(void)
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900175{
176 int i;
177
178 for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) {
Masahiro Yamadac93f2792015-12-17 17:47:42 +0900179 if (!fdt_node_check_compatible(gd->fdt_blob, 0,
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900180 uniphier_boards[i].compatible))
181 return uniphier_boards[i].param;
182 }
183
184 return NULL;
185}