xref: /openbmc/u-boot/arch/arm/mach-uniphier/boards.c (revision 679f82c3)
1 /*
2  * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 #include <libfdt.h>
8 #include <linux/kernel.h>
9 #include <mach/init.h>
10 
11 #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD3)
12 static const struct uniphier_board_data ph1_sld3_data = {
13 	.dram_ch0_base	= 0x80000000,
14 	.dram_ch0_size	= 0x20000000,
15 	.dram_ch0_width	= 32,
16 	.dram_ch1_base	= 0xc0000000,
17 	.dram_ch1_size	= 0x20000000,
18 	.dram_ch1_width	= 16,
19 	.dram_ch2_base	= 0xc0000000,
20 	.dram_ch2_size	= 0x10000000,
21 	.dram_ch2_width	= 16,
22 	.dram_freq	= 1600,
23 };
24 #endif
25 
26 #if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4)
27 static const struct uniphier_board_data ph1_ld4_data = {
28 	.dram_ch0_base	= 0x80000000,
29 	.dram_ch0_size	= 0x10000000,
30 	.dram_ch0_width	= 16,
31 	.dram_ch1_base	= 0x90000000,
32 	.dram_ch1_size	= 0x10000000,
33 	.dram_ch1_width	= 16,
34 	.dram_freq	= 1600,
35 };
36 #endif
37 
38 #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4)
39 static const struct uniphier_board_data ph1_pro4_data = {
40 	.dram_ch0_base	= 0x80000000,
41 	.dram_ch0_size	= 0x20000000,
42 	.dram_ch0_width	= 32,
43 	.dram_ch1_base	= 0xa0000000,
44 	.dram_ch1_size	= 0x20000000,
45 	.dram_ch1_width	= 32,
46 	.dram_freq	= 1600,
47 };
48 #endif
49 
50 #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8)
51 static const struct uniphier_board_data ph1_sld8_data = {
52 	.dram_ch0_base	= 0x80000000,
53 	.dram_ch0_size	= 0x10000000,
54 	.dram_ch0_width	= 16,
55 	.dram_ch1_base	= 0x90000000,
56 	.dram_ch1_size	= 0x10000000,
57 	.dram_ch1_width	= 16,
58 	.dram_freq	= 1333,
59 };
60 #endif
61 
62 #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO5)
63 static const struct uniphier_board_data ph1_pro5_data = {
64 	.dram_ch0_base  = 0x80000000,
65 	.dram_ch0_size  = 0x20000000,
66 	.dram_ch0_width = 32,
67 	.dram_ch1_base  = 0xa0000000,
68 	.dram_ch1_size  = 0x20000000,
69 	.dram_ch1_width = 32,
70 	.dram_freq      = 1866,
71 };
72 #endif
73 
74 #if defined(CONFIG_ARCH_UNIPHIER_PROXSTREAM2) || \
75 	defined(CONFIG_ARCH_UNIPHIER_PH1_LD6B)
76 static const struct uniphier_board_data proxstream2_data = {
77 	.dram_ch0_base  = 0x80000000,
78 	.dram_ch0_size  = 0x40000000,
79 	.dram_ch0_width = 32,
80 	.dram_ch1_base  = 0xc0000000,
81 	.dram_ch1_size  = 0x20000000,
82 	.dram_ch1_width = 32,
83 	.dram_ch2_base  = 0xe0000000,
84 	.dram_ch2_size  = 0x20000000,
85 	.dram_ch2_width = 16,
86 	.dram_freq      = 1866,
87 };
88 #endif
89 
90 struct uniphier_board_id {
91 	const char *compatible;
92 	const struct uniphier_board_data *param;
93 };
94 
95 static const struct uniphier_board_id uniphier_boards[] = {
96 #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD3)
97 	{ "socionext,ph1-sld3", &ph1_sld3_data, },
98 #endif
99 #if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4)
100 	{ "socionext,ph1-ld4", &ph1_ld4_data, },
101 #endif
102 #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4)
103 	{ "socionext,ph1-pro4", &ph1_pro4_data, },
104 #endif
105 #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8)
106 	{ "socionext,ph1-sld8", &ph1_sld8_data, },
107 #endif
108 #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO5)
109 	{ "socionext,ph1-pro5", &ph1_pro5_data, },
110 #endif
111 #if defined(CONFIG_ARCH_UNIPHIER_PROXSTREAM2)
112 	{ "socionext,proxstream2", &proxstream2_data, },
113 #endif
114 #if defined(CONFIG_ARCH_UNIPHIER_PH1_LD6B)
115 	{ "socionext,ph1-ld6b", &proxstream2_data, },
116 #endif
117 };
118 
119 const struct uniphier_board_data *uniphier_get_board_param(const void *fdt)
120 {
121 	int i;
122 
123 	for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) {
124 		if (!fdt_node_check_compatible(fdt, 0,
125 					       uniphier_boards[i].compatible))
126 			return uniphier_boards[i].param;
127 	}
128 
129 	return NULL;
130 }
131