Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
Masahiro Yamada | 6ba60fa | 2015-12-17 17:47:42 +0900 | [diff] [blame] | 7 | #include <common.h> |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 8 | #include <libfdt.h> |
| 9 | #include <linux/kernel.h> |
Masahiro Yamada | 107b3fb | 2016-01-09 01:51:13 +0900 | [diff] [blame] | 10 | |
| 11 | #include "init.h" |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 12 | |
Masahiro Yamada | 6ba60fa | 2015-12-17 17:47:42 +0900 | [diff] [blame] | 13 | DECLARE_GLOBAL_DATA_PTR; |
| 14 | |
Masahiro Yamada | ea65c98 | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 15 | #if defined(CONFIG_ARCH_UNIPHIER_SLD3) |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 16 | static const struct uniphier_board_data uniphier_sld3_data = { |
Masahiro Yamada | 46abfcc | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 17 | .dram_freq = 1600, |
| 18 | .dram_nr_ch = 3, |
| 19 | .dram_ch[0] = { |
| 20 | .base = 0x80000000, |
| 21 | .size = 0x20000000, |
| 22 | .width = 32, |
| 23 | }, |
| 24 | .dram_ch[1] = { |
| 25 | .base = 0xc0000000, |
| 26 | .size = 0x20000000, |
| 27 | .width = 16, |
| 28 | }, |
| 29 | .dram_ch[2] = { |
| 30 | .base = 0xc0000000, |
| 31 | .size = 0x10000000, |
| 32 | .width = 16, |
| 33 | }, |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 34 | }; |
| 35 | #endif |
| 36 | |
Masahiro Yamada | ea65c98 | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 37 | #if defined(CONFIG_ARCH_UNIPHIER_LD4) |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 38 | static const struct uniphier_board_data uniphier_ld4_data = { |
Masahiro Yamada | 46abfcc | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 39 | .dram_freq = 1600, |
| 40 | .dram_nr_ch = 2, |
Masahiro Yamada | 4021b43 | 2016-02-26 14:21:40 +0900 | [diff] [blame] | 41 | .dram_ddr3plus = true, |
Masahiro Yamada | 46abfcc | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 42 | .dram_ch[0] = { |
| 43 | .base = 0x80000000, |
| 44 | .size = 0x10000000, |
| 45 | .width = 16, |
| 46 | }, |
| 47 | .dram_ch[1] = { |
| 48 | .base = 0x90000000, |
| 49 | .size = 0x10000000, |
| 50 | .width = 16, |
| 51 | }, |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 52 | }; |
| 53 | #endif |
| 54 | |
Masahiro Yamada | ea65c98 | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 55 | #if defined(CONFIG_ARCH_UNIPHIER_PRO4) |
Masahiro Yamada | 3f23111 | 2016-02-12 20:27:02 +0900 | [diff] [blame] | 56 | /* 1GB RAM board */ |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 57 | static const struct uniphier_board_data uniphier_pro4_data = { |
Masahiro Yamada | 46abfcc | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 58 | .dram_freq = 1600, |
| 59 | .dram_nr_ch = 2, |
| 60 | .dram_ch[0] = { |
| 61 | .base = 0x80000000, |
| 62 | .size = 0x20000000, |
| 63 | .width = 32, |
| 64 | }, |
| 65 | .dram_ch[1] = { |
| 66 | .base = 0xa0000000, |
| 67 | .size = 0x20000000, |
| 68 | .width = 32, |
| 69 | }, |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 70 | }; |
Masahiro Yamada | 3f23111 | 2016-02-12 20:27:02 +0900 | [diff] [blame] | 71 | |
| 72 | /* 2GB RAM board */ |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 73 | static const struct uniphier_board_data uniphier_pro4_2g_data = { |
Masahiro Yamada | 46abfcc | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 74 | .dram_freq = 1600, |
| 75 | .dram_nr_ch = 2, |
| 76 | .dram_ch[0] = { |
| 77 | .base = 0x80000000, |
| 78 | .size = 0x40000000, |
| 79 | .width = 32, |
| 80 | }, |
| 81 | .dram_ch[1] = { |
| 82 | .base = 0xc0000000, |
| 83 | .size = 0x40000000, |
| 84 | .width = 32, |
| 85 | }, |
Masahiro Yamada | 3f23111 | 2016-02-12 20:27:02 +0900 | [diff] [blame] | 86 | }; |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 87 | #endif |
| 88 | |
Masahiro Yamada | ea65c98 | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 89 | #if defined(CONFIG_ARCH_UNIPHIER_SLD8) |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 90 | static const struct uniphier_board_data uniphier_sld8_data = { |
Masahiro Yamada | 46abfcc | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 91 | .dram_freq = 1333, |
| 92 | .dram_nr_ch = 2, |
Masahiro Yamada | 4021b43 | 2016-02-26 14:21:40 +0900 | [diff] [blame] | 93 | .dram_ddr3plus = true, |
Masahiro Yamada | 46abfcc | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 94 | .dram_ch[0] = { |
| 95 | .base = 0x80000000, |
| 96 | .size = 0x10000000, |
| 97 | .width = 16, |
| 98 | }, |
| 99 | .dram_ch[1] = { |
| 100 | .base = 0x90000000, |
| 101 | .size = 0x10000000, |
| 102 | .width = 16, |
| 103 | }, |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 104 | }; |
| 105 | #endif |
| 106 | |
Masahiro Yamada | ea65c98 | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 107 | #if defined(CONFIG_ARCH_UNIPHIER_PRO5) |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 108 | static const struct uniphier_board_data uniphier_pro5_data = { |
Masahiro Yamada | 46abfcc | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 109 | .dram_freq = 1866, |
| 110 | .dram_nr_ch = 2, |
| 111 | .dram_ch[0] = { |
| 112 | .base = 0x80000000, |
| 113 | .size = 0x20000000, |
| 114 | .width = 32, |
| 115 | }, |
| 116 | .dram_ch[1] = { |
| 117 | .base = 0xa0000000, |
| 118 | .size = 0x20000000, |
| 119 | .width = 32, |
| 120 | }, |
Masahiro Yamada | 28f40d4 | 2015-09-22 00:27:40 +0900 | [diff] [blame] | 121 | }; |
| 122 | #endif |
| 123 | |
Masahiro Yamada | ea65c98 | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 124 | #if defined(CONFIG_ARCH_UNIPHIER_PXS2) |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 125 | static const struct uniphier_board_data uniphier_pxs2_data = { |
Masahiro Yamada | 46abfcc | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 126 | .dram_freq = 2133, |
| 127 | .dram_nr_ch = 3, |
| 128 | .dram_ch[0] = { |
| 129 | .base = 0x80000000, |
| 130 | .size = 0x40000000, |
| 131 | .width = 32, |
| 132 | }, |
| 133 | .dram_ch[1] = { |
| 134 | .base = 0xc0000000, |
| 135 | .size = 0x20000000, |
| 136 | .width = 32, |
| 137 | }, |
| 138 | .dram_ch[2] = { |
| 139 | .base = 0xe0000000, |
| 140 | .size = 0x20000000, |
| 141 | .width = 16, |
| 142 | }, |
Masahiro Yamada | 89c05fa | 2015-12-17 17:47:43 +0900 | [diff] [blame] | 143 | }; |
| 144 | #endif |
| 145 | |
Masahiro Yamada | ea65c98 | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 146 | #if defined(CONFIG_ARCH_UNIPHIER_LD6B) |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 147 | static const struct uniphier_board_data uniphier_ld6b_data = { |
Masahiro Yamada | 46abfcc | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 148 | .dram_freq = 1866, |
| 149 | .dram_nr_ch = 3, |
| 150 | .dram_ch[0] = { |
| 151 | .base = 0x80000000, |
| 152 | .size = 0x40000000, |
| 153 | .width = 32, |
| 154 | }, |
| 155 | .dram_ch[1] = { |
| 156 | .base = 0xc0000000, |
| 157 | .size = 0x20000000, |
| 158 | .width = 32, |
| 159 | }, |
| 160 | .dram_ch[2] = { |
| 161 | .base = 0xe0000000, |
| 162 | .size = 0x20000000, |
| 163 | .width = 16, |
| 164 | }, |
Masahiro Yamada | 019df87 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 165 | }; |
| 166 | #endif |
| 167 | |
Masahiro Yamada | 9d0c2ce | 2016-04-21 14:43:18 +0900 | [diff] [blame^] | 168 | #if defined(CONFIG_ARCH_UNIPHIER_LD20) |
| 169 | static const struct uniphier_board_data uniphier_ld20_data = { |
| 170 | .dram_freq = 1866, |
| 171 | .dram_nr_ch = 3, |
| 172 | .dram_ch[0] = { |
| 173 | .base = 0x80000000, |
| 174 | .size = 0x40000000, |
| 175 | .width = 32, |
| 176 | }, |
| 177 | .dram_ch[1] = { |
| 178 | .base = 0xc0000000, |
| 179 | .size = 0x40000000, |
| 180 | .width = 32, |
| 181 | }, |
| 182 | .dram_ch[2] = { |
| 183 | .base = 0x100000000UL, |
| 184 | .size = 0x40000000, |
| 185 | .width = 32, |
| 186 | }, |
| 187 | }; |
| 188 | #endif |
| 189 | |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 190 | struct uniphier_board_id { |
| 191 | const char *compatible; |
| 192 | const struct uniphier_board_data *param; |
| 193 | }; |
| 194 | |
| 195 | static const struct uniphier_board_id uniphier_boards[] = { |
Masahiro Yamada | ea65c98 | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 196 | #if defined(CONFIG_ARCH_UNIPHIER_SLD3) |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 197 | { "socionext,ph1-sld3", &uniphier_sld3_data, }, |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 198 | #endif |
Masahiro Yamada | ea65c98 | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 199 | #if defined(CONFIG_ARCH_UNIPHIER_LD4) |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 200 | { "socionext,ph1-ld4", &uniphier_ld4_data, }, |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 201 | #endif |
Masahiro Yamada | ea65c98 | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 202 | #if defined(CONFIG_ARCH_UNIPHIER_PRO4) |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 203 | { "socionext,ph1-pro4-ace", &uniphier_pro4_2g_data, }, |
| 204 | { "socionext,ph1-pro4-sanji", &uniphier_pro4_2g_data, }, |
| 205 | { "socionext,ph1-pro4", &uniphier_pro4_data, }, |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 206 | #endif |
Masahiro Yamada | ea65c98 | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 207 | #if defined(CONFIG_ARCH_UNIPHIER_SLD8) |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 208 | { "socionext,ph1-sld8", &uniphier_sld8_data, }, |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 209 | #endif |
Masahiro Yamada | ea65c98 | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 210 | #if defined(CONFIG_ARCH_UNIPHIER_PRO5) |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 211 | { "socionext,ph1-pro5", &uniphier_pro5_data, }, |
Masahiro Yamada | 28f40d4 | 2015-09-22 00:27:40 +0900 | [diff] [blame] | 212 | #endif |
Masahiro Yamada | ea65c98 | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 213 | #if defined(CONFIG_ARCH_UNIPHIER_PXS2) |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 214 | { "socionext,proxstream2", &uniphier_pxs2_data, }, |
Masahiro Yamada | 019df87 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 215 | #endif |
Masahiro Yamada | ea65c98 | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 216 | #if defined(CONFIG_ARCH_UNIPHIER_LD6B) |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 217 | { "socionext,ph1-ld6b", &uniphier_ld6b_data, }, |
Masahiro Yamada | 019df87 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 218 | #endif |
Masahiro Yamada | 9d0c2ce | 2016-04-21 14:43:18 +0900 | [diff] [blame^] | 219 | #if defined(CONFIG_ARCH_UNIPHIER_LD20) |
| 220 | { "socionext,ph1-ld20", &uniphier_ld20_data, }, |
| 221 | #endif |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 222 | }; |
| 223 | |
Masahiro Yamada | 6ba60fa | 2015-12-17 17:47:42 +0900 | [diff] [blame] | 224 | const struct uniphier_board_data *uniphier_get_board_param(void) |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 225 | { |
| 226 | int i; |
| 227 | |
| 228 | for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) { |
Masahiro Yamada | 6ba60fa | 2015-12-17 17:47:42 +0900 | [diff] [blame] | 229 | if (!fdt_node_check_compatible(gd->fdt_blob, 0, |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 230 | uniphier_boards[i].compatible)) |
| 231 | return uniphier_boards[i].param; |
| 232 | } |
| 233 | |
| 234 | return NULL; |
| 235 | } |