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