xref: /openbmc/u-boot/arch/arm/mach-uniphier/boards.c (revision 8f240a3b)
1 /*
2  * Copyright (C) 2015-2016 Socionext Inc.
3  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #include <common.h>
9 #include <linux/libfdt.h>
10 #include <linux/kernel.h>
11 
12 #include "init.h"
13 
14 DECLARE_GLOBAL_DATA_PTR;
15 
16 #if defined(CONFIG_ARCH_UNIPHIER_LD4)
17 static const struct uniphier_board_data uniphier_ld4_data = {
18 	.dram_freq = 1600,
19 	.dram_ch[0] = {
20 		.size = 0x10000000,
21 		.width = 16,
22 	},
23 	.dram_ch[1] = {
24 		.size = 0x10000000,
25 		.width = 16,
26 	},
27 	.flags = UNIPHIER_BD_DDR3PLUS,
28 };
29 #endif
30 
31 #if defined(CONFIG_ARCH_UNIPHIER_PRO4)
32 /* 1GB RAM board */
33 static const struct uniphier_board_data uniphier_pro4_data = {
34 	.dram_freq = 1600,
35 	.dram_ch[0] = {
36 		.size = 0x20000000,
37 		.width = 32,
38 	},
39 	.dram_ch[1] = {
40 		.size = 0x20000000,
41 		.width = 32,
42 	},
43 };
44 
45 /* 2GB RAM board */
46 static const struct uniphier_board_data uniphier_pro4_2g_data = {
47 	.dram_freq = 1600,
48 	.dram_ch[0] = {
49 		.size = 0x40000000,
50 		.width = 32,
51 	},
52 	.dram_ch[1] = {
53 		.size = 0x40000000,
54 		.width = 32,
55 	},
56 };
57 #endif
58 
59 #if defined(CONFIG_ARCH_UNIPHIER_SLD8)
60 static const struct uniphier_board_data uniphier_sld8_data = {
61 	.dram_freq = 1333,
62 	.dram_ch[0] = {
63 		.size = 0x10000000,
64 		.width = 16,
65 	},
66 	.dram_ch[1] = {
67 		.size = 0x10000000,
68 		.width = 16,
69 	},
70 	.flags = UNIPHIER_BD_DDR3PLUS,
71 };
72 #endif
73 
74 #if defined(CONFIG_ARCH_UNIPHIER_PRO5)
75 static const struct uniphier_board_data uniphier_pro5_data = {
76 	.dram_freq = 1866,
77 	.dram_ch[0] = {
78 		.size = 0x20000000,
79 		.width = 32,
80 	},
81 	.dram_ch[1] = {
82 		.size = 0x20000000,
83 		.width = 32,
84 	},
85 };
86 #endif
87 
88 #if defined(CONFIG_ARCH_UNIPHIER_PXS2)
89 static const struct uniphier_board_data uniphier_pxs2_data = {
90 	.dram_freq = 2133,
91 	.dram_ch[0] = {
92 		.size = 0x40000000,
93 		.width = 32,
94 	},
95 	.dram_ch[1] = {
96 		.size = 0x20000000,
97 		.width = 32,
98 	},
99 	.dram_ch[2] = {
100 		.size = 0x20000000,
101 		.width = 16,
102 	},
103 };
104 #endif
105 
106 #if defined(CONFIG_ARCH_UNIPHIER_LD6B)
107 static const struct uniphier_board_data uniphier_ld6b_data = {
108 	.dram_freq = 1866,
109 	.dram_ch[0] = {
110 		.size = 0x40000000,
111 		.width = 32,
112 	},
113 	.dram_ch[1] = {
114 		.size = 0x20000000,
115 		.width = 32,
116 	},
117 	.dram_ch[2] = {
118 		.size = 0x20000000,
119 		.width = 16,
120 	},
121 };
122 #endif
123 
124 struct uniphier_board_id {
125 	const char *compatible;
126 	const struct uniphier_board_data *param;
127 };
128 
129 static const struct uniphier_board_id uniphier_boards[] = {
130 #if defined(CONFIG_ARCH_UNIPHIER_LD4)
131 	{ "socionext,uniphier-ld4", &uniphier_ld4_data, },
132 #endif
133 #if defined(CONFIG_ARCH_UNIPHIER_PRO4)
134 	{ "socionext,uniphier-pro4-ace", &uniphier_pro4_2g_data, },
135 	{ "socionext,uniphier-pro4-sanji", &uniphier_pro4_2g_data, },
136 	{ "socionext,uniphier-pro4", &uniphier_pro4_data, },
137 #endif
138 #if defined(CONFIG_ARCH_UNIPHIER_SLD8)
139 	{ "socionext,uniphier-sld8", &uniphier_sld8_data, },
140 #endif
141 #if defined(CONFIG_ARCH_UNIPHIER_PRO5)
142 	{ "socionext,uniphier-pro5", &uniphier_pro5_data, },
143 #endif
144 #if defined(CONFIG_ARCH_UNIPHIER_PXS2)
145 	{ "socionext,uniphier-pxs2", &uniphier_pxs2_data, },
146 #endif
147 #if defined(CONFIG_ARCH_UNIPHIER_LD6B)
148 	{ "socionext,uniphier-ld6b", &uniphier_ld6b_data, },
149 #endif
150 };
151 
152 const struct uniphier_board_data *uniphier_get_board_param(void)
153 {
154 	int i;
155 
156 	for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) {
157 		if (!fdt_node_check_compatible(gd->fdt_blob, 0,
158 					       uniphier_boards[i].compatible))
159 			return uniphier_boards[i].param;
160 	}
161 
162 	return NULL;
163 }
164