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 | |
| 8 | #ifndef __MACH_INIT_H |
| 9 | #define __MACH_INIT_H |
| 10 | |
Masahiro Yamada | a573188 | 2016-02-26 14:21:40 +0900 | [diff] [blame] | 11 | #include <linux/types.h> |
| 12 | |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 13 | #define UNIPHIER_MAX_NR_DRAM_CH 3 |
| 14 | |
| 15 | struct uniphier_dram_ch { |
| 16 | unsigned long base; |
| 17 | unsigned long size; |
| 18 | unsigned int width; |
| 19 | }; |
| 20 | |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 21 | struct uniphier_board_data { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 22 | unsigned int dram_freq; |
| 23 | unsigned int dram_nr_ch; |
| 24 | struct uniphier_dram_ch dram_ch[UNIPHIER_MAX_NR_DRAM_CH]; |
Masahiro Yamada | fcdbbec | 2016-07-22 13:38:32 +0900 | [diff] [blame] | 25 | unsigned int flags; |
Masahiro Yamada | 2de45ed | 2016-09-14 01:06:10 +0900 | [diff] [blame] | 26 | |
| 27 | #define UNIPHIER_BD_DDR3PLUS BIT(2) |
| 28 | |
Masahiro Yamada | bf4266e | 2016-10-27 23:47:02 +0900 | [diff] [blame] | 29 | #define UNIPHIER_BD_BOARD_GET_TYPE(f) ((f) & 0x7) |
Masahiro Yamada | 2de45ed | 2016-09-14 01:06:10 +0900 | [diff] [blame] | 30 | #define UNIPHIER_BD_BOARD_LD20_REF 0 /* LD20 reference */ |
| 31 | #define UNIPHIER_BD_BOARD_LD20_GLOBAL 1 /* LD20 TV Set */ |
Masahiro Yamada | bf4266e | 2016-10-27 23:47:02 +0900 | [diff] [blame] | 32 | #define UNIPHIER_BD_BOARD_LD20_C1 2 /* LD20 TV Set C1 */ |
| 33 | #define UNIPHIER_BD_BOARD_LD21_REF 3 /* LD21 reference */ |
| 34 | #define UNIPHIER_BD_BOARD_LD21_GLOBAL 4 /* LD21 TV Set */ |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 35 | }; |
| 36 | |
Masahiro Yamada | c93f279 | 2015-12-17 17:47:42 +0900 | [diff] [blame] | 37 | const struct uniphier_board_data *uniphier_get_board_param(void); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 38 | |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 39 | int uniphier_sld3_init(const struct uniphier_board_data *bd); |
| 40 | int uniphier_ld4_init(const struct uniphier_board_data *bd); |
| 41 | int uniphier_pro4_init(const struct uniphier_board_data *bd); |
| 42 | int uniphier_sld8_init(const struct uniphier_board_data *bd); |
| 43 | int uniphier_pro5_init(const struct uniphier_board_data *bd); |
| 44 | int uniphier_pxs2_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 8bbbcbd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 45 | int uniphier_ld11_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 063eb1e | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 46 | int uniphier_ld20_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 47 | |
| 48 | #if defined(CONFIG_MICRO_SUPPORT_CARD) |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 49 | int uniphier_sbc_init_admulti(const struct uniphier_board_data *bd); |
| 50 | int uniphier_sbc_init_savepin(const struct uniphier_board_data *bd); |
Masahiro Yamada | 7d600a6 | 2016-03-18 16:41:44 +0900 | [diff] [blame] | 51 | int uniphier_ld4_sbc_init(const struct uniphier_board_data *bd); |
| 52 | int uniphier_pxs2_sbc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 53 | #else |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 54 | static inline int uniphier_sbc_init_admulti( |
| 55 | const struct uniphier_board_data *bd) |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 56 | { |
| 57 | return 0; |
| 58 | } |
| 59 | |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 60 | static inline int uniphier_sbc_init_savepin( |
| 61 | const struct uniphier_board_data *bd) |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 62 | { |
| 63 | return 0; |
| 64 | } |
| 65 | |
Masahiro Yamada | 7d600a6 | 2016-03-18 16:41:44 +0900 | [diff] [blame] | 66 | static inline int uniphier_ld4_sbc_init(const struct uniphier_board_data *bd) |
| 67 | { |
| 68 | return 0; |
| 69 | } |
| 70 | |
| 71 | static inline int uniphier_pxs2_sbc_init(const struct uniphier_board_data *bd) |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 72 | { |
| 73 | return 0; |
| 74 | } |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 75 | #endif |
| 76 | |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 77 | int uniphier_sld3_bcu_init(const struct uniphier_board_data *bd); |
| 78 | int uniphier_ld4_bcu_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 79 | |
| 80 | int memconf_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 81 | int uniphier_sld3_memconf_init(const struct uniphier_board_data *bd); |
| 82 | int uniphier_pxs2_memconf_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 83 | |
Masahiro Yamada | 9d6652c | 2016-09-17 03:33:09 +0900 | [diff] [blame] | 84 | int uniphier_sld3_dpll_init(const struct uniphier_board_data *bd); |
| 85 | int uniphier_ld4_dpll_init(const struct uniphier_board_data *bd); |
| 86 | int uniphier_pro4_dpll_init(const struct uniphier_board_data *bd); |
| 87 | int uniphier_sld8_dpll_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 090785d | 2016-09-22 07:42:19 +0900 | [diff] [blame] | 88 | int uniphier_ld11_dpll_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | d11b0b7 | 2016-09-17 03:33:11 +0900 | [diff] [blame] | 89 | int uniphier_ld20_dpll_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 90 | |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 91 | int uniphier_ld4_early_clk_init(const struct uniphier_board_data *bd); |
| 92 | int uniphier_pro5_early_clk_init(const struct uniphier_board_data *bd); |
| 93 | int uniphier_pxs2_early_clk_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 8bbbcbd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 94 | int uniphier_ld11_early_clk_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 063eb1e | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 95 | int uniphier_ld20_early_clk_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 96 | |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 97 | int uniphier_ld4_umc_init(const struct uniphier_board_data *bd); |
| 98 | int uniphier_pro4_umc_init(const struct uniphier_board_data *bd); |
| 99 | int uniphier_sld8_umc_init(const struct uniphier_board_data *bd); |
| 100 | int uniphier_pxs2_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 063eb1e | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 101 | int uniphier_ld20_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 8bbbcbd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 102 | int uniphier_ld11_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 103 | |
Masahiro Yamada | 9d6652c | 2016-09-17 03:33:09 +0900 | [diff] [blame] | 104 | void uniphier_sld3_pll_init(void); |
| 105 | void uniphier_ld4_pll_init(void); |
| 106 | void uniphier_pro4_pll_init(void); |
Masahiro Yamada | 090785d | 2016-09-22 07:42:19 +0900 | [diff] [blame] | 107 | void uniphier_ld11_pll_init(void); |
Masahiro Yamada | d11b0b7 | 2016-09-17 03:33:11 +0900 | [diff] [blame] | 108 | int uniphier_ld20_pll_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 9d6652c | 2016-09-17 03:33:09 +0900 | [diff] [blame] | 109 | |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 110 | void uniphier_ld4_clk_init(void); |
| 111 | void uniphier_pro4_clk_init(void); |
| 112 | void uniphier_pro5_clk_init(void); |
| 113 | void uniphier_pxs2_clk_init(void); |
Masahiro Yamada | 8bbbcbd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 114 | void uniphier_ld11_clk_init(void); |
Masahiro Yamada | 063eb1e | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 115 | void uniphier_ld20_clk_init(void); |
| 116 | |
Masahiro Yamada | c21e19a | 2016-09-17 03:33:04 +0900 | [diff] [blame] | 117 | int uniphier_pin_init(const char *pinconfig_name); |
Masahiro Yamada | e59ed19 | 2016-09-14 01:06:08 +0900 | [diff] [blame] | 118 | void uniphier_smp_kick_all_cpus(void); |
Masahiro Yamada | 063eb1e | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 119 | void cci500_init(int nr_slaves); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 120 | |
| 121 | #define pr_err(fmt, args...) printf(fmt, ##args) |
| 122 | |
| 123 | #endif /* __MACH_INIT_H */ |