blob: f3281433c2ba7656e917721c9b81c282c7a577dd [file] [log] [blame]
Masahiro Yamada75f16f82015-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 Yamadac93f2792015-12-17 17:47:42 +09007#include <common.h>
Masahiro Yamada75f16f82015-09-22 00:27:39 +09008#include <libfdt.h>
9#include <linux/kernel.h>
10#include <mach/init.h>
11
Masahiro Yamadac93f2792015-12-17 17:47:42 +090012DECLARE_GLOBAL_DATA_PTR;
13
Masahiro Yamada75f16f82015-09-22 00:27:39 +090014#if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD3)
15static const struct uniphier_board_data ph1_sld3_data = {
16 .dram_ch0_base = 0x80000000,
17 .dram_ch0_size = 0x20000000,
18 .dram_ch0_width = 32,
19 .dram_ch1_base = 0xc0000000,
20 .dram_ch1_size = 0x20000000,
21 .dram_ch1_width = 16,
22 .dram_ch2_base = 0xc0000000,
23 .dram_ch2_size = 0x10000000,
24 .dram_ch2_width = 16,
25 .dram_freq = 1600,
26};
27#endif
28
29#if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4)
30static const struct uniphier_board_data ph1_ld4_data = {
31 .dram_ch0_base = 0x80000000,
32 .dram_ch0_size = 0x10000000,
33 .dram_ch0_width = 16,
34 .dram_ch1_base = 0x90000000,
35 .dram_ch1_size = 0x10000000,
36 .dram_ch1_width = 16,
37 .dram_freq = 1600,
38};
39#endif
40
41#if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4)
42static const struct uniphier_board_data ph1_pro4_data = {
43 .dram_ch0_base = 0x80000000,
44 .dram_ch0_size = 0x20000000,
45 .dram_ch0_width = 32,
46 .dram_ch1_base = 0xa0000000,
47 .dram_ch1_size = 0x20000000,
48 .dram_ch1_width = 32,
49 .dram_freq = 1600,
50};
51#endif
52
53#if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8)
54static const struct uniphier_board_data ph1_sld8_data = {
55 .dram_ch0_base = 0x80000000,
56 .dram_ch0_size = 0x10000000,
57 .dram_ch0_width = 16,
58 .dram_ch1_base = 0x90000000,
59 .dram_ch1_size = 0x10000000,
60 .dram_ch1_width = 16,
61 .dram_freq = 1333,
62};
63#endif
64
Masahiro Yamadad5167d52015-09-22 00:27:40 +090065#if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO5)
66static const struct uniphier_board_data ph1_pro5_data = {
67 .dram_ch0_base = 0x80000000,
68 .dram_ch0_size = 0x20000000,
69 .dram_ch0_width = 32,
70 .dram_ch1_base = 0xa0000000,
71 .dram_ch1_size = 0x20000000,
72 .dram_ch1_width = 32,
73 .dram_freq = 1866,
74};
75#endif
76
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090077#if defined(CONFIG_ARCH_UNIPHIER_PROXSTREAM2) || \
78 defined(CONFIG_ARCH_UNIPHIER_PH1_LD6B)
79static 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,
89 .dram_freq = 1866,
90};
91#endif
92
Masahiro Yamada75f16f82015-09-22 00:27:39 +090093struct uniphier_board_id {
94 const char *compatible;
95 const struct uniphier_board_data *param;
96};
97
98static const struct uniphier_board_id uniphier_boards[] = {
99#if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD3)
100 { "socionext,ph1-sld3", &ph1_sld3_data, },
101#endif
102#if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4)
103 { "socionext,ph1-ld4", &ph1_ld4_data, },
104#endif
105#if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4)
106 { "socionext,ph1-pro4", &ph1_pro4_data, },
107#endif
108#if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8)
109 { "socionext,ph1-sld8", &ph1_sld8_data, },
110#endif
Masahiro Yamadad5167d52015-09-22 00:27:40 +0900111#if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO5)
112 { "socionext,ph1-pro5", &ph1_pro5_data, },
113#endif
Masahiro Yamada1fe65d32015-09-22 00:27:41 +0900114#if defined(CONFIG_ARCH_UNIPHIER_PROXSTREAM2)
115 { "socionext,proxstream2", &proxstream2_data, },
116#endif
117#if defined(CONFIG_ARCH_UNIPHIER_PH1_LD6B)
118 { "socionext,ph1-ld6b", &proxstream2_data, },
119#endif
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900120};
121
Masahiro Yamadac93f2792015-12-17 17:47:42 +0900122const struct uniphier_board_data *uniphier_get_board_param(void)
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900123{
124 int i;
125
126 for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) {
Masahiro Yamadac93f2792015-12-17 17:47:42 +0900127 if (!fdt_node_check_compatible(gd->fdt_blob, 0,
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900128 uniphier_boards[i].compatible))
129 return uniphier_boards[i].param;
130 }
131
132 return NULL;
133}