blob: 9bfc4c254196a6cc0dc297fb43bd5403e363bbd8 [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_LD4)
Masahiro Yamada98905692016-03-30 20:17:02 +090017static const struct uniphier_board_data uniphier_ld4_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 = 0x10000000,
21 .width = 16,
22 },
23 .dram_ch[1] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090024 .size = 0x10000000,
25 .width = 16,
26 },
Masahiro Yamadafcdbbec2016-07-22 13:38:32 +090027 .flags = UNIPHIER_BD_DDR3PLUS,
Masahiro Yamada75f16f82015-09-22 00:27:39 +090028};
29#endif
30
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090031#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
Masahiro Yamada40efc4f2016-02-12 20:27:02 +090032/* 1GB RAM board */
Masahiro Yamada98905692016-03-30 20:17:02 +090033static const struct uniphier_board_data uniphier_pro4_data = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090034 .dram_freq = 1600,
Masahiro Yamada799e6f22016-02-26 14:21:34 +090035 .dram_ch[0] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090036 .size = 0x20000000,
37 .width = 32,
38 },
39 .dram_ch[1] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090040 .size = 0x20000000,
41 .width = 32,
42 },
Masahiro Yamada75f16f82015-09-22 00:27:39 +090043};
Masahiro Yamada40efc4f2016-02-12 20:27:02 +090044
45/* 2GB RAM board */
Masahiro Yamada98905692016-03-30 20:17:02 +090046static const struct uniphier_board_data uniphier_pro4_2g_data = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090047 .dram_freq = 1600,
Masahiro Yamada799e6f22016-02-26 14:21:34 +090048 .dram_ch[0] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090049 .size = 0x40000000,
50 .width = 32,
51 },
52 .dram_ch[1] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090053 .size = 0x40000000,
54 .width = 32,
55 },
Masahiro Yamada40efc4f2016-02-12 20:27:02 +090056};
Masahiro Yamada75f16f82015-09-22 00:27:39 +090057#endif
58
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090059#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
Masahiro Yamada98905692016-03-30 20:17:02 +090060static const struct uniphier_board_data uniphier_sld8_data = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090061 .dram_freq = 1333,
Masahiro Yamada799e6f22016-02-26 14:21:34 +090062 .dram_ch[0] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090063 .size = 0x10000000,
64 .width = 16,
65 },
66 .dram_ch[1] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090067 .size = 0x10000000,
68 .width = 16,
69 },
Masahiro Yamadafcdbbec2016-07-22 13:38:32 +090070 .flags = UNIPHIER_BD_DDR3PLUS,
Masahiro Yamada75f16f82015-09-22 00:27:39 +090071};
72#endif
73
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090074#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
Masahiro Yamada98905692016-03-30 20:17:02 +090075static const struct uniphier_board_data uniphier_pro5_data = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090076 .dram_freq = 1866,
Masahiro Yamada799e6f22016-02-26 14:21:34 +090077 .dram_ch[0] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090078 .size = 0x20000000,
79 .width = 32,
80 },
81 .dram_ch[1] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090082 .size = 0x20000000,
83 .width = 32,
84 },
Masahiro Yamadad5167d52015-09-22 00:27:40 +090085};
86#endif
87
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090088#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
Masahiro Yamada98905692016-03-30 20:17:02 +090089static const struct uniphier_board_data uniphier_pxs2_data = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090090 .dram_freq = 2133,
Masahiro Yamada799e6f22016-02-26 14:21:34 +090091 .dram_ch[0] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090092 .size = 0x40000000,
93 .width = 32,
94 },
95 .dram_ch[1] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090096 .size = 0x20000000,
97 .width = 32,
98 },
99 .dram_ch[2] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900100 .size = 0x20000000,
101 .width = 16,
102 },
Masahiro Yamada9dd408f2015-12-17 17:47:43 +0900103};
104#endif
105
Masahiro Yamada53c59ae2016-03-18 16:41:43 +0900106#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
Masahiro Yamada98905692016-03-30 20:17:02 +0900107static const struct uniphier_board_data uniphier_ld6b_data = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900108 .dram_freq = 1866,
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900109 .dram_ch[0] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900110 .size = 0x40000000,
111 .width = 32,
112 },
113 .dram_ch[1] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900114 .size = 0x20000000,
115 .width = 32,
116 },
117 .dram_ch[2] = {
Masahiro Yamada799e6f22016-02-26 14:21:34 +0900118 .size = 0x20000000,
119 .width = 16,
120 },
Masahiro Yamada1fe65d32015-09-22 00:27:41 +0900121};
122#endif
123
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900124struct uniphier_board_id {
125 const char *compatible;
126 const struct uniphier_board_data *param;
127};
128
129static const struct uniphier_board_id uniphier_boards[] = {
Masahiro Yamada53c59ae2016-03-18 16:41:43 +0900130#if defined(CONFIG_ARCH_UNIPHIER_LD4)
Masahiro Yamada39a67ff2016-10-07 16:43:00 +0900131 { "socionext,uniphier-ld4", &uniphier_ld4_data, },
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900132#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +0900133#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
Masahiro Yamada39a67ff2016-10-07 16:43:00 +0900134 { "socionext,uniphier-pro4-ace", &uniphier_pro4_2g_data, },
135 { "socionext,uniphier-pro4-sanji", &uniphier_pro4_2g_data, },
136 { "socionext,uniphier-pro4", &uniphier_pro4_data, },
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900137#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +0900138#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
Masahiro Yamada39a67ff2016-10-07 16:43:00 +0900139 { "socionext,uniphier-sld8", &uniphier_sld8_data, },
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900140#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +0900141#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
Masahiro Yamada39a67ff2016-10-07 16:43:00 +0900142 { "socionext,uniphier-pro5", &uniphier_pro5_data, },
Masahiro Yamadad5167d52015-09-22 00:27:40 +0900143#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +0900144#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
Masahiro Yamada39a67ff2016-10-07 16:43:00 +0900145 { "socionext,uniphier-pxs2", &uniphier_pxs2_data, },
Masahiro Yamada1fe65d32015-09-22 00:27:41 +0900146#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +0900147#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
Masahiro Yamada39a67ff2016-10-07 16:43:00 +0900148 { "socionext,uniphier-ld6b", &uniphier_ld6b_data, },
Masahiro Yamada1fe65d32015-09-22 00:27:41 +0900149#endif
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900150};
151
Masahiro Yamadac93f2792015-12-17 17:47:42 +0900152const struct uniphier_board_data *uniphier_get_board_param(void)
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900153{
154 int i;
155
156 for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) {
Masahiro Yamadac93f2792015-12-17 17:47:42 +0900157 if (!fdt_node_check_compatible(gd->fdt_blob, 0,
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900158 uniphier_boards[i].compatible))
159 return uniphier_boards[i].param;
160 }
161
162 return NULL;
163}