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