Masahiro Yamada | 75f16f8 | 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 | |
| 7 | #include <libfdt.h> |
| 8 | #include <linux/kernel.h> |
| 9 | #include <mach/init.h> |
| 10 | |
| 11 | #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD3) |
| 12 | static const struct uniphier_board_data ph1_sld3_data = { |
| 13 | .dram_ch0_base = 0x80000000, |
| 14 | .dram_ch0_size = 0x20000000, |
| 15 | .dram_ch0_width = 32, |
| 16 | .dram_ch1_base = 0xc0000000, |
| 17 | .dram_ch1_size = 0x20000000, |
| 18 | .dram_ch1_width = 16, |
| 19 | .dram_ch2_base = 0xc0000000, |
| 20 | .dram_ch2_size = 0x10000000, |
| 21 | .dram_ch2_width = 16, |
| 22 | .dram_freq = 1600, |
| 23 | }; |
| 24 | #endif |
| 25 | |
| 26 | #if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4) |
| 27 | static const struct uniphier_board_data ph1_ld4_data = { |
| 28 | .dram_ch0_base = 0x80000000, |
| 29 | .dram_ch0_size = 0x10000000, |
| 30 | .dram_ch0_width = 16, |
| 31 | .dram_ch1_base = 0x90000000, |
| 32 | .dram_ch1_size = 0x10000000, |
| 33 | .dram_ch1_width = 16, |
| 34 | .dram_freq = 1600, |
| 35 | }; |
| 36 | #endif |
| 37 | |
| 38 | #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4) |
| 39 | static const struct uniphier_board_data ph1_pro4_data = { |
| 40 | .dram_ch0_base = 0x80000000, |
| 41 | .dram_ch0_size = 0x20000000, |
| 42 | .dram_ch0_width = 32, |
| 43 | .dram_ch1_base = 0xa0000000, |
| 44 | .dram_ch1_size = 0x20000000, |
| 45 | .dram_ch1_width = 32, |
| 46 | .dram_freq = 1600, |
| 47 | }; |
| 48 | #endif |
| 49 | |
| 50 | #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8) |
| 51 | static const struct uniphier_board_data ph1_sld8_data = { |
| 52 | .dram_ch0_base = 0x80000000, |
| 53 | .dram_ch0_size = 0x10000000, |
| 54 | .dram_ch0_width = 16, |
| 55 | .dram_ch1_base = 0x90000000, |
| 56 | .dram_ch1_size = 0x10000000, |
| 57 | .dram_ch1_width = 16, |
| 58 | .dram_freq = 1333, |
| 59 | }; |
| 60 | #endif |
| 61 | |
| 62 | struct uniphier_board_id { |
| 63 | const char *compatible; |
| 64 | const struct uniphier_board_data *param; |
| 65 | }; |
| 66 | |
| 67 | static const struct uniphier_board_id uniphier_boards[] = { |
| 68 | #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD3) |
| 69 | { "socionext,ph1-sld3", &ph1_sld3_data, }, |
| 70 | #endif |
| 71 | #if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4) |
| 72 | { "socionext,ph1-ld4", &ph1_ld4_data, }, |
| 73 | #endif |
| 74 | #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4) |
| 75 | { "socionext,ph1-pro4", &ph1_pro4_data, }, |
| 76 | #endif |
| 77 | #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8) |
| 78 | { "socionext,ph1-sld8", &ph1_sld8_data, }, |
| 79 | #endif |
| 80 | }; |
| 81 | |
| 82 | const struct uniphier_board_data *uniphier_get_board_param(const void *fdt) |
| 83 | { |
| 84 | int i; |
| 85 | |
| 86 | for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) { |
| 87 | if (!fdt_node_check_compatible(fdt, 0, |
| 88 | uniphier_boards[i].compatible)) |
| 89 | return uniphier_boards[i].param; |
| 90 | } |
| 91 | |
| 92 | return NULL; |
| 93 | } |