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 | |
| 8 | #ifndef __MACH_INIT_H |
| 9 | #define __MACH_INIT_H |
| 10 | |
Masahiro Yamada | 4021b43 | 2016-02-26 14:21:40 +0900 | [diff] [blame] | 11 | #include <linux/types.h> |
| 12 | |
Masahiro Yamada | 46abfcc | 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 | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 21 | struct uniphier_board_data { |
Masahiro Yamada | 46abfcc | 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 | a74c28a | 2016-07-22 13:38:32 +0900 | [diff] [blame] | 25 | unsigned int flags; |
Masahiro Yamada | f6bbec3 | 2016-09-14 01:06:10 +0900 | [diff] [blame] | 26 | |
| 27 | #define UNIPHIER_BD_DDR3PLUS BIT(2) |
| 28 | |
Masahiro Yamada | b890997 | 2016-10-27 23:47:02 +0900 | [diff] [blame] | 29 | #define UNIPHIER_BD_BOARD_GET_TYPE(f) ((f) & 0x7) |
Masahiro Yamada | f6bbec3 | 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 | b890997 | 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 | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 35 | }; |
| 36 | |
Masahiro Yamada | 6ba60fa | 2015-12-17 17:47:42 +0900 | [diff] [blame] | 37 | const struct uniphier_board_data *uniphier_get_board_param(void); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 38 | |
Masahiro Yamada | 5b66006 | 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 | 667dbcd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 45 | int uniphier_ld11_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 9d0c2ce | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 46 | int uniphier_ld20_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 47 | |
| 48 | #if defined(CONFIG_MICRO_SUPPORT_CARD) |
Masahiro Yamada | 9e3bb84 | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 49 | void uniphier_sbc_init_admulti(void); |
| 50 | void uniphier_sbc_init_savepin(void); |
| 51 | void uniphier_ld4_sbc_init(void); |
| 52 | void uniphier_pxs2_sbc_init(void); |
| 53 | void uniphier_ld11_sbc_init(void); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 54 | #else |
Masahiro Yamada | 9e3bb84 | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 55 | static inline void uniphier_sbc_init_admulti(void) |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 56 | { |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 57 | } |
| 58 | |
Masahiro Yamada | 9e3bb84 | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 59 | static inline void uniphier_sbc_init_savepin(void) |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 60 | { |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 61 | } |
| 62 | |
Masahiro Yamada | 9e3bb84 | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 63 | static inline void uniphier_ld4_sbc_init(void) |
Masahiro Yamada | 5d0607c | 2016-03-18 16:41:44 +0900 | [diff] [blame] | 64 | { |
Masahiro Yamada | 5d0607c | 2016-03-18 16:41:44 +0900 | [diff] [blame] | 65 | } |
| 66 | |
Masahiro Yamada | 9e3bb84 | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 67 | static inline void uniphier_pxs2_sbc_init(void) |
Masahiro Yamada | 019df87 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 68 | { |
Masahiro Yamada | 9e3bb84 | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | static inline void uniphier_ld11_sbc_init(void) |
| 72 | { |
Masahiro Yamada | 019df87 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 73 | } |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 74 | #endif |
| 75 | |
Masahiro Yamada | e94842f | 2017-01-15 14:59:07 +0900 | [diff] [blame] | 76 | void uniphier_sld3_bcu_init(const struct uniphier_board_data *bd); |
| 77 | void uniphier_ld4_bcu_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 78 | |
Masahiro Yamada | 8d6c99c | 2017-01-15 14:59:04 +0900 | [diff] [blame] | 79 | int uniphier_memconf_2ch_init(const struct uniphier_board_data *bd); |
| 80 | int uniphier_memconf_3ch_no_disbit_init(const struct uniphier_board_data *bd); |
| 81 | int uniphier_memconf_3ch_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 82 | |
Masahiro Yamada | 6a3e427 | 2016-09-17 03:33:09 +0900 | [diff] [blame] | 83 | int uniphier_sld3_dpll_init(const struct uniphier_board_data *bd); |
| 84 | int uniphier_ld4_dpll_init(const struct uniphier_board_data *bd); |
| 85 | int uniphier_pro4_dpll_init(const struct uniphier_board_data *bd); |
| 86 | int uniphier_sld8_dpll_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | a8e6300 | 2017-01-15 14:59:09 +0900 | [diff] [blame] | 87 | int uniphier_pro5_dpll_init(const struct uniphier_board_data *bd); |
| 88 | int uniphier_pxs2_dpll_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | c72f4d4 | 2016-09-22 07:42:19 +0900 | [diff] [blame] | 89 | int uniphier_ld11_dpll_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 682e09f | 2016-09-17 03:33:11 +0900 | [diff] [blame] | 90 | int uniphier_ld20_dpll_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 91 | |
Masahiro Yamada | 78c627c | 2017-01-15 14:59:03 +0900 | [diff] [blame] | 92 | void uniphier_sld3_early_clk_init(void); |
| 93 | void uniphier_ld11_early_clk_init(void); |
| 94 | |
| 95 | void uniphier_sld3_dram_clk_init(void); |
| 96 | void uniphier_pro5_dram_clk_init(void); |
| 97 | void uniphier_pxs2_dram_clk_init(void); |
| 98 | void uniphier_ld11_dram_clk_init(void); |
| 99 | void uniphier_ld20_dram_clk_init(void); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 100 | |
Masahiro Yamada | a8e6300 | 2017-01-15 14:59:09 +0900 | [diff] [blame] | 101 | int uniphier_sld3_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 102 | int uniphier_ld4_umc_init(const struct uniphier_board_data *bd); |
| 103 | int uniphier_pro4_umc_init(const struct uniphier_board_data *bd); |
| 104 | int uniphier_sld8_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | a8e6300 | 2017-01-15 14:59:09 +0900 | [diff] [blame] | 105 | int uniphier_pro5_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 106 | int uniphier_pxs2_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 9d0c2ce | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 107 | int uniphier_ld20_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 667dbcd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 108 | int uniphier_ld11_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 109 | |
Masahiro Yamada | 6a3e427 | 2016-09-17 03:33:09 +0900 | [diff] [blame] | 110 | void uniphier_sld3_pll_init(void); |
| 111 | void uniphier_ld4_pll_init(void); |
| 112 | void uniphier_pro4_pll_init(void); |
Masahiro Yamada | c72f4d4 | 2016-09-22 07:42:19 +0900 | [diff] [blame] | 113 | void uniphier_ld11_pll_init(void); |
Masahiro Yamada | a314a24 | 2017-01-15 14:59:02 +0900 | [diff] [blame] | 114 | void uniphier_ld20_pll_init(void); |
Masahiro Yamada | 2c2ab3d | 2017-01-21 18:05:31 +0900 | [diff] [blame] | 115 | void uniphier_pxs3_pll_init(void); |
Masahiro Yamada | 6a3e427 | 2016-09-17 03:33:09 +0900 | [diff] [blame] | 116 | |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 117 | void uniphier_ld4_clk_init(void); |
| 118 | void uniphier_pro4_clk_init(void); |
| 119 | void uniphier_pro5_clk_init(void); |
| 120 | void uniphier_pxs2_clk_init(void); |
Masahiro Yamada | 667dbcd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 121 | void uniphier_ld11_clk_init(void); |
Masahiro Yamada | 9d0c2ce | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 122 | |
Masahiro Yamada | 5ac9dfb | 2016-09-17 03:33:04 +0900 | [diff] [blame] | 123 | int uniphier_pin_init(const char *pinconfig_name); |
Masahiro Yamada | b291671 | 2016-09-14 01:06:08 +0900 | [diff] [blame] | 124 | void uniphier_smp_kick_all_cpus(void); |
Masahiro Yamada | 9d0c2ce | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 125 | void cci500_init(int nr_slaves); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 126 | |
Masahiro Yamada | 3e9952b | 2017-01-28 06:53:43 +0900 | [diff] [blame] | 127 | #define pr_warn(fmt, args...) printf(fmt, ##args) |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 128 | #define pr_err(fmt, args...) printf(fmt, ##args) |
| 129 | |
| 130 | #endif /* __MACH_INIT_H */ |