Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 1 | /* |
Masahiro Yamada | fcdbbec | 2016-07-22 13:38:32 +0900 | [diff] [blame] | 2 | * Copyright (C) 2015-2016 Socionext Inc. |
| 3 | * Author: Masahiro Yamada <yamada.masahiro@socionext.com> |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | |
Masahiro Yamada | c93f279 | 2015-12-17 17:47:42 +0900 | [diff] [blame] | 8 | #include <common.h> |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 9 | #include <libfdt.h> |
| 10 | #include <linux/kernel.h> |
Masahiro Yamada | efdf340 | 2016-01-09 01:51:13 +0900 | [diff] [blame] | 11 | |
| 12 | #include "init.h" |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 13 | |
Masahiro Yamada | c93f279 | 2015-12-17 17:47:42 +0900 | [diff] [blame] | 14 | DECLARE_GLOBAL_DATA_PTR; |
| 15 | |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 16 | #if defined(CONFIG_ARCH_UNIPHIER_SLD3) |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 17 | static const struct uniphier_board_data uniphier_sld3_data = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 18 | .dram_freq = 1600, |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 19 | .dram_ch[0] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 20 | .size = 0x20000000, |
| 21 | .width = 32, |
| 22 | }, |
| 23 | .dram_ch[1] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 24 | .size = 0x20000000, |
| 25 | .width = 16, |
| 26 | }, |
| 27 | .dram_ch[2] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 28 | .size = 0x10000000, |
| 29 | .width = 16, |
| 30 | }, |
Masahiro Yamada | 3dc8097 | 2017-02-05 10:52:12 +0900 | [diff] [blame] | 31 | .flags = UNIPHIER_BD_DRAM_SPARSE, |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 32 | }; |
| 33 | #endif |
| 34 | |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 35 | #if defined(CONFIG_ARCH_UNIPHIER_LD4) |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 36 | static const struct uniphier_board_data uniphier_ld4_data = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 37 | .dram_freq = 1600, |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 38 | .dram_ch[0] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 39 | .size = 0x10000000, |
| 40 | .width = 16, |
| 41 | }, |
| 42 | .dram_ch[1] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 43 | .size = 0x10000000, |
| 44 | .width = 16, |
| 45 | }, |
Masahiro Yamada | fcdbbec | 2016-07-22 13:38:32 +0900 | [diff] [blame] | 46 | .flags = UNIPHIER_BD_DDR3PLUS, |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 47 | }; |
| 48 | #endif |
| 49 | |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 50 | #if defined(CONFIG_ARCH_UNIPHIER_PRO4) |
Masahiro Yamada | 40efc4f | 2016-02-12 20:27:02 +0900 | [diff] [blame] | 51 | /* 1GB RAM board */ |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 52 | static const struct uniphier_board_data uniphier_pro4_data = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 53 | .dram_freq = 1600, |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 54 | .dram_ch[0] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 55 | .size = 0x20000000, |
| 56 | .width = 32, |
| 57 | }, |
| 58 | .dram_ch[1] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 59 | .size = 0x20000000, |
| 60 | .width = 32, |
| 61 | }, |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 62 | }; |
Masahiro Yamada | 40efc4f | 2016-02-12 20:27:02 +0900 | [diff] [blame] | 63 | |
| 64 | /* 2GB RAM board */ |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 65 | static const struct uniphier_board_data uniphier_pro4_2g_data = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 66 | .dram_freq = 1600, |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 67 | .dram_ch[0] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 68 | .size = 0x40000000, |
| 69 | .width = 32, |
| 70 | }, |
| 71 | .dram_ch[1] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 72 | .size = 0x40000000, |
| 73 | .width = 32, |
| 74 | }, |
Masahiro Yamada | 40efc4f | 2016-02-12 20:27:02 +0900 | [diff] [blame] | 75 | }; |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 76 | #endif |
| 77 | |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 78 | #if defined(CONFIG_ARCH_UNIPHIER_SLD8) |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 79 | static const struct uniphier_board_data uniphier_sld8_data = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 80 | .dram_freq = 1333, |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 81 | .dram_ch[0] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 82 | .size = 0x10000000, |
| 83 | .width = 16, |
| 84 | }, |
| 85 | .dram_ch[1] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 86 | .size = 0x10000000, |
| 87 | .width = 16, |
| 88 | }, |
Masahiro Yamada | fcdbbec | 2016-07-22 13:38:32 +0900 | [diff] [blame] | 89 | .flags = UNIPHIER_BD_DDR3PLUS, |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 90 | }; |
| 91 | #endif |
| 92 | |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 93 | #if defined(CONFIG_ARCH_UNIPHIER_PRO5) |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 94 | static const struct uniphier_board_data uniphier_pro5_data = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 95 | .dram_freq = 1866, |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 96 | .dram_ch[0] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 97 | .size = 0x20000000, |
| 98 | .width = 32, |
| 99 | }, |
| 100 | .dram_ch[1] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 101 | .size = 0x20000000, |
| 102 | .width = 32, |
| 103 | }, |
Masahiro Yamada | d5167d5 | 2015-09-22 00:27:40 +0900 | [diff] [blame] | 104 | }; |
| 105 | #endif |
| 106 | |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 107 | #if defined(CONFIG_ARCH_UNIPHIER_PXS2) |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 108 | static const struct uniphier_board_data uniphier_pxs2_data = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 109 | .dram_freq = 2133, |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 110 | .dram_ch[0] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 111 | .size = 0x40000000, |
| 112 | .width = 32, |
| 113 | }, |
| 114 | .dram_ch[1] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 115 | .size = 0x20000000, |
| 116 | .width = 32, |
| 117 | }, |
| 118 | .dram_ch[2] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 119 | .size = 0x20000000, |
| 120 | .width = 16, |
| 121 | }, |
Masahiro Yamada | 9dd408f | 2015-12-17 17:47:43 +0900 | [diff] [blame] | 122 | }; |
| 123 | #endif |
| 124 | |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 125 | #if defined(CONFIG_ARCH_UNIPHIER_LD6B) |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 126 | static const struct uniphier_board_data uniphier_ld6b_data = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 127 | .dram_freq = 1866, |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 128 | .dram_ch[0] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 129 | .size = 0x40000000, |
| 130 | .width = 32, |
| 131 | }, |
| 132 | .dram_ch[1] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 133 | .size = 0x20000000, |
| 134 | .width = 32, |
| 135 | }, |
| 136 | .dram_ch[2] = { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 137 | .size = 0x20000000, |
| 138 | .width = 16, |
| 139 | }, |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 140 | }; |
| 141 | #endif |
| 142 | |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 143 | struct uniphier_board_id { |
| 144 | const char *compatible; |
| 145 | const struct uniphier_board_data *param; |
| 146 | }; |
| 147 | |
| 148 | static const struct uniphier_board_id uniphier_boards[] = { |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 149 | #if defined(CONFIG_ARCH_UNIPHIER_SLD3) |
Masahiro Yamada | 39a67ff | 2016-10-07 16:43:00 +0900 | [diff] [blame] | 150 | { "socionext,uniphier-sld3", &uniphier_sld3_data, }, |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 151 | #endif |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 152 | #if defined(CONFIG_ARCH_UNIPHIER_LD4) |
Masahiro Yamada | 39a67ff | 2016-10-07 16:43:00 +0900 | [diff] [blame] | 153 | { "socionext,uniphier-ld4", &uniphier_ld4_data, }, |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 154 | #endif |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 155 | #if defined(CONFIG_ARCH_UNIPHIER_PRO4) |
Masahiro Yamada | 39a67ff | 2016-10-07 16:43:00 +0900 | [diff] [blame] | 156 | { "socionext,uniphier-pro4-ace", &uniphier_pro4_2g_data, }, |
| 157 | { "socionext,uniphier-pro4-sanji", &uniphier_pro4_2g_data, }, |
| 158 | { "socionext,uniphier-pro4", &uniphier_pro4_data, }, |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 159 | #endif |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 160 | #if defined(CONFIG_ARCH_UNIPHIER_SLD8) |
Masahiro Yamada | 39a67ff | 2016-10-07 16:43:00 +0900 | [diff] [blame] | 161 | { "socionext,uniphier-sld8", &uniphier_sld8_data, }, |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 162 | #endif |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 163 | #if defined(CONFIG_ARCH_UNIPHIER_PRO5) |
Masahiro Yamada | 39a67ff | 2016-10-07 16:43:00 +0900 | [diff] [blame] | 164 | { "socionext,uniphier-pro5", &uniphier_pro5_data, }, |
Masahiro Yamada | d5167d5 | 2015-09-22 00:27:40 +0900 | [diff] [blame] | 165 | #endif |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 166 | #if defined(CONFIG_ARCH_UNIPHIER_PXS2) |
Masahiro Yamada | 39a67ff | 2016-10-07 16:43:00 +0900 | [diff] [blame] | 167 | { "socionext,uniphier-pxs2", &uniphier_pxs2_data, }, |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 168 | #endif |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 169 | #if defined(CONFIG_ARCH_UNIPHIER_LD6B) |
Masahiro Yamada | 39a67ff | 2016-10-07 16:43:00 +0900 | [diff] [blame] | 170 | { "socionext,uniphier-ld6b", &uniphier_ld6b_data, }, |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 171 | #endif |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 172 | }; |
| 173 | |
Masahiro Yamada | c93f279 | 2015-12-17 17:47:42 +0900 | [diff] [blame] | 174 | const struct uniphier_board_data *uniphier_get_board_param(void) |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 175 | { |
| 176 | int i; |
| 177 | |
| 178 | for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) { |
Masahiro Yamada | c93f279 | 2015-12-17 17:47:42 +0900 | [diff] [blame] | 179 | if (!fdt_node_check_compatible(gd->fdt_blob, 0, |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 180 | uniphier_boards[i].compatible)) |
| 181 | return uniphier_boards[i].param; |
| 182 | } |
| 183 | |
| 184 | return NULL; |
| 185 | } |