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