blob: d9a8d2f28aef92f1fd4399318a29c1f35d285a3f [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamada323d1f92015-09-22 00:27:39 +09002/*
Masahiro Yamadaa74c28a2016-07-22 13:38:32 +09003 * Copyright (C) 2015-2016 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada323d1f92015-09-22 00:27:39 +09005 */
6
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +09007#include <common.h>
Masahiro Yamadab08c8c42018-03-05 01:20:11 +09008#include <linux/libfdt.h>
Masahiro Yamada323d1f92015-09-22 00:27:39 +09009#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 Yamadaea65c982016-03-18 16:41:43 +090015#if defined(CONFIG_ARCH_UNIPHIER_LD4)
Masahiro Yamada5b660062016-03-30 20:17:02 +090016static const struct uniphier_board_data uniphier_ld4_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090017 .dram_freq = 1600,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090018 .dram_ch[0] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090019 .size = 0x10000000,
20 .width = 16,
21 },
22 .dram_ch[1] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090023 .size = 0x10000000,
24 .width = 16,
25 },
Masahiro Yamadaa74c28a2016-07-22 13:38:32 +090026 .flags = UNIPHIER_BD_DDR3PLUS,
Masahiro Yamada323d1f92015-09-22 00:27:39 +090027};
28#endif
29
Masahiro Yamadaea65c982016-03-18 16:41:43 +090030#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
Masahiro Yamada3f231112016-02-12 20:27:02 +090031/* 1GB RAM board */
Masahiro Yamada5b660062016-03-30 20:17:02 +090032static const struct uniphier_board_data uniphier_pro4_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090033 .dram_freq = 1600,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090034 .dram_ch[0] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090035 .size = 0x20000000,
36 .width = 32,
37 },
38 .dram_ch[1] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090039 .size = 0x20000000,
40 .width = 32,
41 },
Masahiro Yamada323d1f92015-09-22 00:27:39 +090042};
Masahiro Yamada3f231112016-02-12 20:27:02 +090043
44/* 2GB RAM board */
Masahiro Yamada5b660062016-03-30 20:17:02 +090045static const struct uniphier_board_data uniphier_pro4_2g_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090046 .dram_freq = 1600,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090047 .dram_ch[0] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090048 .size = 0x40000000,
49 .width = 32,
50 },
51 .dram_ch[1] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090052 .size = 0x40000000,
53 .width = 32,
54 },
Masahiro Yamada3f231112016-02-12 20:27:02 +090055};
Masahiro Yamada323d1f92015-09-22 00:27:39 +090056#endif
57
Masahiro Yamadaea65c982016-03-18 16:41:43 +090058#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
Masahiro Yamada5b660062016-03-30 20:17:02 +090059static const struct uniphier_board_data uniphier_sld8_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090060 .dram_freq = 1333,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090061 .dram_ch[0] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090062 .size = 0x10000000,
63 .width = 16,
64 },
65 .dram_ch[1] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090066 .size = 0x10000000,
67 .width = 16,
68 },
Masahiro Yamadaa74c28a2016-07-22 13:38:32 +090069 .flags = UNIPHIER_BD_DDR3PLUS,
Masahiro Yamada323d1f92015-09-22 00:27:39 +090070};
71#endif
72
Masahiro Yamadaea65c982016-03-18 16:41:43 +090073#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
Masahiro Yamada5b660062016-03-30 20:17:02 +090074static const struct uniphier_board_data uniphier_pro5_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090075 .dram_freq = 1866,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090076 .dram_ch[0] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090077 .size = 0x20000000,
78 .width = 32,
79 },
80 .dram_ch[1] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090081 .size = 0x20000000,
82 .width = 32,
83 },
Masahiro Yamada28f40d42015-09-22 00:27:40 +090084};
85#endif
86
Masahiro Yamadaea65c982016-03-18 16:41:43 +090087#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
Masahiro Yamada5b660062016-03-30 20:17:02 +090088static const struct uniphier_board_data uniphier_pxs2_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090089 .dram_freq = 2133,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090090 .dram_ch[0] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090091 .size = 0x40000000,
92 .width = 32,
93 },
94 .dram_ch[1] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090095 .size = 0x20000000,
96 .width = 32,
97 },
98 .dram_ch[2] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090099 .size = 0x20000000,
100 .width = 16,
101 },
Masahiro Yamada89c05fa2015-12-17 17:47:43 +0900102};
103#endif
104
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900105#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
Masahiro Yamada5b660062016-03-30 20:17:02 +0900106static const struct uniphier_board_data uniphier_ld6b_data = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900107 .dram_freq = 1866,
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900108 .dram_ch[0] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900109 .size = 0x40000000,
110 .width = 32,
111 },
112 .dram_ch[1] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900113 .size = 0x20000000,
114 .width = 32,
115 },
116 .dram_ch[2] = {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +0900117 .size = 0x20000000,
118 .width = 16,
119 },
Masahiro Yamada019df872015-09-22 00:27:41 +0900120};
121#endif
122
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900123struct uniphier_board_id {
124 const char *compatible;
125 const struct uniphier_board_data *param;
126};
127
128static const struct uniphier_board_id uniphier_boards[] = {
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900129#if defined(CONFIG_ARCH_UNIPHIER_LD4)
Masahiro Yamada52159d22016-10-07 16:43:00 +0900130 { "socionext,uniphier-ld4", &uniphier_ld4_data, },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900131#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900132#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
Masahiro Yamada52159d22016-10-07 16:43:00 +0900133 { "socionext,uniphier-pro4-ace", &uniphier_pro4_2g_data, },
134 { "socionext,uniphier-pro4-sanji", &uniphier_pro4_2g_data, },
135 { "socionext,uniphier-pro4", &uniphier_pro4_data, },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900136#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900137#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
Masahiro Yamada52159d22016-10-07 16:43:00 +0900138 { "socionext,uniphier-sld8", &uniphier_sld8_data, },
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900139#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900140#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
Masahiro Yamada52159d22016-10-07 16:43:00 +0900141 { "socionext,uniphier-pro5", &uniphier_pro5_data, },
Masahiro Yamada28f40d42015-09-22 00:27:40 +0900142#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900143#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
Masahiro Yamada52159d22016-10-07 16:43:00 +0900144 { "socionext,uniphier-pxs2", &uniphier_pxs2_data, },
Masahiro Yamada019df872015-09-22 00:27:41 +0900145#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +0900146#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
Masahiro Yamada52159d22016-10-07 16:43:00 +0900147 { "socionext,uniphier-ld6b", &uniphier_ld6b_data, },
Masahiro Yamada019df872015-09-22 00:27:41 +0900148#endif
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900149};
150
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +0900151const struct uniphier_board_data *uniphier_get_board_param(void)
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900152{
153 int i;
154
155 for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) {
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +0900156 if (!fdt_node_check_compatible(gd->fdt_blob, 0,
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900157 uniphier_boards[i].compatible))
158 return uniphier_boards[i].param;
159 }
160
161 return NULL;
162}