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