blob: f12415022be7bee0a9b5d867de152790a9947184 [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 = {
17 .dram_ch0_base = 0x80000000,
18 .dram_ch0_size = 0x20000000,
19 .dram_ch0_width = 32,
20 .dram_ch1_base = 0xc0000000,
21 .dram_ch1_size = 0x20000000,
22 .dram_ch1_width = 16,
23 .dram_ch2_base = 0xc0000000,
24 .dram_ch2_size = 0x10000000,
25 .dram_ch2_width = 16,
26 .dram_freq = 1600,
27};
28#endif
29
30#if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4)
31static const struct uniphier_board_data ph1_ld4_data = {
32 .dram_ch0_base = 0x80000000,
33 .dram_ch0_size = 0x10000000,
34 .dram_ch0_width = 16,
35 .dram_ch1_base = 0x90000000,
36 .dram_ch1_size = 0x10000000,
37 .dram_ch1_width = 16,
38 .dram_freq = 1600,
39};
40#endif
41
42#if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4)
43static const struct uniphier_board_data ph1_pro4_data = {
44 .dram_ch0_base = 0x80000000,
45 .dram_ch0_size = 0x20000000,
46 .dram_ch0_width = 32,
47 .dram_ch1_base = 0xa0000000,
48 .dram_ch1_size = 0x20000000,
49 .dram_ch1_width = 32,
50 .dram_freq = 1600,
51};
52#endif
53
54#if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8)
55static const struct uniphier_board_data ph1_sld8_data = {
56 .dram_ch0_base = 0x80000000,
57 .dram_ch0_size = 0x10000000,
58 .dram_ch0_width = 16,
59 .dram_ch1_base = 0x90000000,
60 .dram_ch1_size = 0x10000000,
61 .dram_ch1_width = 16,
62 .dram_freq = 1333,
63};
64#endif
65
Masahiro Yamada28f40d42015-09-22 00:27:40 +090066#if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO5)
67static const struct uniphier_board_data ph1_pro5_data = {
68 .dram_ch0_base = 0x80000000,
69 .dram_ch0_size = 0x20000000,
70 .dram_ch0_width = 32,
71 .dram_ch1_base = 0xa0000000,
72 .dram_ch1_size = 0x20000000,
73 .dram_ch1_width = 32,
74 .dram_freq = 1866,
75};
76#endif
77
Masahiro Yamada89c05fa2015-12-17 17:47:43 +090078#if defined(CONFIG_ARCH_UNIPHIER_PROXSTREAM2)
Masahiro Yamada019df872015-09-22 00:27:41 +090079static const struct uniphier_board_data proxstream2_data = {
80 .dram_ch0_base = 0x80000000,
81 .dram_ch0_size = 0x40000000,
82 .dram_ch0_width = 32,
83 .dram_ch1_base = 0xc0000000,
84 .dram_ch1_size = 0x20000000,
85 .dram_ch1_width = 32,
86 .dram_ch2_base = 0xe0000000,
87 .dram_ch2_size = 0x20000000,
88 .dram_ch2_width = 16,
Masahiro Yamada89c05fa2015-12-17 17:47:43 +090089 .dram_freq = 2133,
90};
91#endif
92
93#if defined(CONFIG_ARCH_UNIPHIER_PH1_LD6B)
94static const struct uniphier_board_data ph1_ld6b_data = {
95 .dram_ch0_base = 0x80000000,
96 .dram_ch0_size = 0x40000000,
97 .dram_ch0_width = 32,
98 .dram_ch1_base = 0xc0000000,
99 .dram_ch1_size = 0x20000000,
100 .dram_ch1_width = 32,
101 .dram_ch2_base = 0xe0000000,
102 .dram_ch2_size = 0x20000000,
103 .dram_ch2_width = 16,
Masahiro Yamada019df872015-09-22 00:27:41 +0900104 .dram_freq = 1866,
105};
106#endif
107
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900108struct uniphier_board_id {
109 const char *compatible;
110 const struct uniphier_board_data *param;
111};
112
113static const struct uniphier_board_id uniphier_boards[] = {
114#if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD3)
115 { "socionext,ph1-sld3", &ph1_sld3_data, },
116#endif
117#if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4)
118 { "socionext,ph1-ld4", &ph1_ld4_data, },
119#endif
120#if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4)
121 { "socionext,ph1-pro4", &ph1_pro4_data, },
122#endif
123#if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8)
124 { "socionext,ph1-sld8", &ph1_sld8_data, },
125#endif
Masahiro Yamada28f40d42015-09-22 00:27:40 +0900126#if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO5)
127 { "socionext,ph1-pro5", &ph1_pro5_data, },
128#endif
Masahiro Yamada019df872015-09-22 00:27:41 +0900129#if defined(CONFIG_ARCH_UNIPHIER_PROXSTREAM2)
130 { "socionext,proxstream2", &proxstream2_data, },
131#endif
132#if defined(CONFIG_ARCH_UNIPHIER_PH1_LD6B)
Masahiro Yamada89c05fa2015-12-17 17:47:43 +0900133 { "socionext,ph1-ld6b", &ph1_ld6b_data, },
Masahiro Yamada019df872015-09-22 00:27:41 +0900134#endif
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900135};
136
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +0900137const struct uniphier_board_data *uniphier_get_board_param(void)
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900138{
139 int i;
140
141 for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) {
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +0900142 if (!fdt_node_check_compatible(gd->fdt_blob, 0,
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900143 uniphier_boards[i].compatible))
144 return uniphier_boards[i].param;
145 }
146
147 return NULL;
148}