Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 2 | /* |
Masahiro Yamada | fcdbbec | 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 | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __MACH_INIT_H |
| 8 | #define __MACH_INIT_H |
| 9 | |
Masahiro Yamada | a573188 | 2016-02-26 14:21:40 +0900 | [diff] [blame] | 10 | #include <linux/types.h> |
| 11 | |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 12 | #define UNIPHIER_MAX_NR_DRAM_CH 3 |
| 13 | |
| 14 | struct uniphier_dram_ch { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 15 | unsigned long size; |
| 16 | unsigned int width; |
| 17 | }; |
| 18 | |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 19 | struct uniphier_board_data { |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 20 | unsigned int dram_freq; |
Masahiro Yamada | 799e6f2 | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 21 | struct uniphier_dram_ch dram_ch[UNIPHIER_MAX_NR_DRAM_CH]; |
Masahiro Yamada | fcdbbec | 2016-07-22 13:38:32 +0900 | [diff] [blame] | 22 | unsigned int flags; |
Masahiro Yamada | 2de45ed | 2016-09-14 01:06:10 +0900 | [diff] [blame] | 23 | |
Masahiro Yamada | 3dc8097 | 2017-02-05 10:52:12 +0900 | [diff] [blame] | 24 | #define UNIPHIER_BD_DRAM_SPARSE BIT(9) |
| 25 | #define UNIPHIER_BD_DDR3PLUS BIT(8) |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 26 | }; |
| 27 | |
Masahiro Yamada | c93f279 | 2015-12-17 17:47:42 +0900 | [diff] [blame] | 28 | const struct uniphier_board_data *uniphier_get_board_param(void); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 29 | |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 30 | int uniphier_ld4_init(const struct uniphier_board_data *bd); |
| 31 | int uniphier_pro4_init(const struct uniphier_board_data *bd); |
| 32 | int uniphier_sld8_init(const struct uniphier_board_data *bd); |
| 33 | int uniphier_pro5_init(const struct uniphier_board_data *bd); |
| 34 | int uniphier_pxs2_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 35 | |
| 36 | #if defined(CONFIG_MICRO_SUPPORT_CARD) |
Masahiro Yamada | 6f11cde | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 37 | void uniphier_sbc_init_admulti(void); |
| 38 | void uniphier_sbc_init_savepin(void); |
| 39 | void uniphier_ld4_sbc_init(void); |
| 40 | void uniphier_pxs2_sbc_init(void); |
| 41 | void uniphier_ld11_sbc_init(void); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 42 | #else |
Masahiro Yamada | 6f11cde | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 43 | static inline void uniphier_sbc_init_admulti(void) |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 44 | { |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 45 | } |
| 46 | |
Masahiro Yamada | 6f11cde | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 47 | static inline void uniphier_sbc_init_savepin(void) |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 48 | { |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 49 | } |
| 50 | |
Masahiro Yamada | 6f11cde | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 51 | static inline void uniphier_ld4_sbc_init(void) |
Masahiro Yamada | 7d600a6 | 2016-03-18 16:41:44 +0900 | [diff] [blame] | 52 | { |
Masahiro Yamada | 7d600a6 | 2016-03-18 16:41:44 +0900 | [diff] [blame] | 53 | } |
| 54 | |
Masahiro Yamada | 6f11cde | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 55 | static inline void uniphier_pxs2_sbc_init(void) |
| 56 | { |
| 57 | } |
| 58 | |
| 59 | static inline void uniphier_ld11_sbc_init(void) |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 60 | { |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 61 | } |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 62 | #endif |
| 63 | |
Masahiro Yamada | 3a67e9d | 2017-01-15 14:59:07 +0900 | [diff] [blame] | 64 | void uniphier_ld4_bcu_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 65 | |
Masahiro Yamada | 7b361f7 | 2017-01-15 14:59:04 +0900 | [diff] [blame] | 66 | int uniphier_memconf_2ch_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 7b361f7 | 2017-01-15 14:59:04 +0900 | [diff] [blame] | 67 | int uniphier_memconf_3ch_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 68 | |
Masahiro Yamada | 9d6652c | 2016-09-17 03:33:09 +0900 | [diff] [blame] | 69 | int uniphier_ld4_dpll_init(const struct uniphier_board_data *bd); |
| 70 | int uniphier_pro4_dpll_init(const struct uniphier_board_data *bd); |
| 71 | int uniphier_sld8_dpll_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 8c3aa6b | 2017-01-15 14:59:09 +0900 | [diff] [blame] | 72 | int uniphier_pro5_dpll_init(const struct uniphier_board_data *bd); |
| 73 | int uniphier_pxs2_dpll_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 74 | |
Masahiro Yamada | d3c1461 | 2017-08-13 09:01:13 +0900 | [diff] [blame] | 75 | void uniphier_ld4_early_clk_init(void); |
Masahiro Yamada | ddb1900 | 2017-01-15 14:59:03 +0900 | [diff] [blame] | 76 | |
Masahiro Yamada | d3c1461 | 2017-08-13 09:01:13 +0900 | [diff] [blame] | 77 | void uniphier_ld4_dram_clk_init(void); |
Masahiro Yamada | ddb1900 | 2017-01-15 14:59:03 +0900 | [diff] [blame] | 78 | void uniphier_pro5_dram_clk_init(void); |
| 79 | void uniphier_pxs2_dram_clk_init(void); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 80 | |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 81 | int uniphier_ld4_umc_init(const struct uniphier_board_data *bd); |
| 82 | int uniphier_pro4_umc_init(const struct uniphier_board_data *bd); |
| 83 | int uniphier_sld8_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 8c3aa6b | 2017-01-15 14:59:09 +0900 | [diff] [blame] | 84 | int uniphier_pro5_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 85 | int uniphier_pxs2_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 86 | |
Masahiro Yamada | 9d6652c | 2016-09-17 03:33:09 +0900 | [diff] [blame] | 87 | void uniphier_ld4_pll_init(void); |
| 88 | void uniphier_pro4_pll_init(void); |
Masahiro Yamada | 090785d | 2016-09-22 07:42:19 +0900 | [diff] [blame] | 89 | void uniphier_ld11_pll_init(void); |
Masahiro Yamada | 52b14bf | 2017-01-15 14:59:02 +0900 | [diff] [blame] | 90 | void uniphier_ld20_pll_init(void); |
Masahiro Yamada | 133b126 | 2017-01-21 18:05:31 +0900 | [diff] [blame] | 91 | void uniphier_pxs3_pll_init(void); |
Masahiro Yamada | 9d6652c | 2016-09-17 03:33:09 +0900 | [diff] [blame] | 92 | |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 93 | void uniphier_ld4_clk_init(void); |
| 94 | void uniphier_pro4_clk_init(void); |
| 95 | void uniphier_pro5_clk_init(void); |
| 96 | void uniphier_pxs2_clk_init(void); |
Masahiro Yamada | 8bbbcbd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 97 | void uniphier_ld11_clk_init(void); |
Masahiro Yamada | b3b1bb7 | 2017-02-17 16:17:22 +0900 | [diff] [blame] | 98 | void uniphier_ld20_clk_init(void); |
Masahiro Yamada | 8e0a450 | 2017-05-15 14:26:33 +0900 | [diff] [blame] | 99 | void uniphier_pxs3_clk_init(void); |
Masahiro Yamada | 063eb1e | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 100 | |
Masahiro Yamada | fb09203 | 2017-02-14 01:24:26 +0900 | [diff] [blame] | 101 | unsigned int uniphier_boot_device_raw(void); |
Masahiro Yamada | af19810 | 2017-04-20 16:54:43 +0900 | [diff] [blame] | 102 | int uniphier_have_internal_stm(void); |
| 103 | int uniphier_boot_from_backend(void); |
Masahiro Yamada | c21e19a | 2016-09-17 03:33:04 +0900 | [diff] [blame] | 104 | int uniphier_pin_init(const char *pinconfig_name); |
Masahiro Yamada | f0f6a80 | 2019-07-10 20:07:45 +0900 | [diff] [blame] | 105 | #ifdef CONFIG_ARM64 |
| 106 | void uniphier_mem_map_init(unsigned long dram_base, unsigned long dram_size); |
| 107 | #else |
| 108 | static inline void uniphier_mem_map_init(unsigned long dram_base, |
| 109 | unsigned long dram_size) |
| 110 | { |
| 111 | } |
| 112 | #endif |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 113 | |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 114 | #endif /* __MACH_INIT_H */ |