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 { |
Masahiro Yamada | 46abfcc | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 16 | unsigned long size; |
| 17 | unsigned int width; |
| 18 | }; |
| 19 | |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 20 | struct uniphier_board_data { |
Masahiro Yamada | 46abfcc | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 21 | unsigned int dram_freq; |
Masahiro Yamada | 46abfcc | 2016-02-26 14:21:34 +0900 | [diff] [blame] | 22 | struct uniphier_dram_ch dram_ch[UNIPHIER_MAX_NR_DRAM_CH]; |
Masahiro Yamada | a74c28a | 2016-07-22 13:38:32 +0900 | [diff] [blame] | 23 | unsigned int flags; |
Masahiro Yamada | f6bbec3 | 2016-09-14 01:06:10 +0900 | [diff] [blame] | 24 | |
Masahiro Yamada | 04cd4e7 | 2017-02-05 10:52:12 +0900 | [diff] [blame] | 25 | #define UNIPHIER_BD_DRAM_SPARSE BIT(9) |
| 26 | #define UNIPHIER_BD_DDR3PLUS BIT(8) |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 27 | }; |
| 28 | |
Masahiro Yamada | 6ba60fa | 2015-12-17 17:47:42 +0900 | [diff] [blame] | 29 | const struct uniphier_board_data *uniphier_get_board_param(void); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 30 | |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 31 | int uniphier_sld3_init(const struct uniphier_board_data *bd); |
| 32 | int uniphier_ld4_init(const struct uniphier_board_data *bd); |
| 33 | int uniphier_pro4_init(const struct uniphier_board_data *bd); |
| 34 | int uniphier_sld8_init(const struct uniphier_board_data *bd); |
| 35 | int uniphier_pro5_init(const struct uniphier_board_data *bd); |
| 36 | int uniphier_pxs2_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 37 | |
| 38 | #if defined(CONFIG_MICRO_SUPPORT_CARD) |
Masahiro Yamada | 9e3bb84 | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 39 | void uniphier_sbc_init_admulti(void); |
| 40 | void uniphier_sbc_init_savepin(void); |
| 41 | void uniphier_ld4_sbc_init(void); |
| 42 | void uniphier_pxs2_sbc_init(void); |
| 43 | void uniphier_ld11_sbc_init(void); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 44 | #else |
Masahiro Yamada | 9e3bb84 | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 45 | static inline void uniphier_sbc_init_admulti(void) |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 46 | { |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 47 | } |
| 48 | |
Masahiro Yamada | 9e3bb84 | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 49 | static inline void uniphier_sbc_init_savepin(void) |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 50 | { |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 51 | } |
| 52 | |
Masahiro Yamada | 9e3bb84 | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 53 | static inline void uniphier_ld4_sbc_init(void) |
Masahiro Yamada | 5d0607c | 2016-03-18 16:41:44 +0900 | [diff] [blame] | 54 | { |
Masahiro Yamada | 5d0607c | 2016-03-18 16:41:44 +0900 | [diff] [blame] | 55 | } |
| 56 | |
Masahiro Yamada | 9e3bb84 | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 57 | static inline void uniphier_pxs2_sbc_init(void) |
Masahiro Yamada | 019df87 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 58 | { |
Masahiro Yamada | 9e3bb84 | 2017-01-15 14:59:05 +0900 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | static inline void uniphier_ld11_sbc_init(void) |
| 62 | { |
Masahiro Yamada | 019df87 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 63 | } |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 64 | #endif |
| 65 | |
Masahiro Yamada | e94842f | 2017-01-15 14:59:07 +0900 | [diff] [blame] | 66 | void uniphier_sld3_bcu_init(const struct uniphier_board_data *bd); |
| 67 | void uniphier_ld4_bcu_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 68 | |
Masahiro Yamada | 8d6c99c | 2017-01-15 14:59:04 +0900 | [diff] [blame] | 69 | int uniphier_memconf_2ch_init(const struct uniphier_board_data *bd); |
| 70 | int uniphier_memconf_3ch_no_disbit_init(const struct uniphier_board_data *bd); |
| 71 | int uniphier_memconf_3ch_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 72 | |
Masahiro Yamada | 6a3e427 | 2016-09-17 03:33:09 +0900 | [diff] [blame] | 73 | int uniphier_sld3_dpll_init(const struct uniphier_board_data *bd); |
| 74 | int uniphier_ld4_dpll_init(const struct uniphier_board_data *bd); |
| 75 | int uniphier_pro4_dpll_init(const struct uniphier_board_data *bd); |
| 76 | int uniphier_sld8_dpll_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | a8e6300 | 2017-01-15 14:59:09 +0900 | [diff] [blame] | 77 | int uniphier_pro5_dpll_init(const struct uniphier_board_data *bd); |
| 78 | int uniphier_pxs2_dpll_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 79 | |
Masahiro Yamada | 78c627c | 2017-01-15 14:59:03 +0900 | [diff] [blame] | 80 | void uniphier_sld3_early_clk_init(void); |
Masahiro Yamada | 78c627c | 2017-01-15 14:59:03 +0900 | [diff] [blame] | 81 | |
| 82 | void uniphier_sld3_dram_clk_init(void); |
| 83 | void uniphier_pro5_dram_clk_init(void); |
| 84 | void uniphier_pxs2_dram_clk_init(void); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 85 | |
Masahiro Yamada | a8e6300 | 2017-01-15 14:59:09 +0900 | [diff] [blame] | 86 | int uniphier_sld3_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 87 | int uniphier_ld4_umc_init(const struct uniphier_board_data *bd); |
| 88 | int uniphier_pro4_umc_init(const struct uniphier_board_data *bd); |
| 89 | int uniphier_sld8_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | a8e6300 | 2017-01-15 14:59:09 +0900 | [diff] [blame] | 90 | int uniphier_pro5_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 91 | int uniphier_pxs2_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 92 | |
Masahiro Yamada | 6a3e427 | 2016-09-17 03:33:09 +0900 | [diff] [blame] | 93 | void uniphier_sld3_pll_init(void); |
| 94 | void uniphier_ld4_pll_init(void); |
| 95 | void uniphier_pro4_pll_init(void); |
Masahiro Yamada | c72f4d4 | 2016-09-22 07:42:19 +0900 | [diff] [blame] | 96 | void uniphier_ld11_pll_init(void); |
Masahiro Yamada | a314a24 | 2017-01-15 14:59:02 +0900 | [diff] [blame] | 97 | void uniphier_ld20_pll_init(void); |
Masahiro Yamada | 2c2ab3d | 2017-01-21 18:05:31 +0900 | [diff] [blame] | 98 | void uniphier_pxs3_pll_init(void); |
Masahiro Yamada | 6a3e427 | 2016-09-17 03:33:09 +0900 | [diff] [blame] | 99 | |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 100 | void uniphier_ld4_clk_init(void); |
| 101 | void uniphier_pro4_clk_init(void); |
| 102 | void uniphier_pro5_clk_init(void); |
| 103 | void uniphier_pxs2_clk_init(void); |
Masahiro Yamada | 667dbcd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 104 | void uniphier_ld11_clk_init(void); |
Masahiro Yamada | c21f585 | 2017-02-17 16:17:22 +0900 | [diff] [blame] | 105 | void uniphier_ld20_clk_init(void); |
Masahiro Yamada | 81afa9c | 2017-05-15 14:26:33 +0900 | [diff] [blame] | 106 | void uniphier_pxs3_clk_init(void); |
Masahiro Yamada | 9d0c2ce | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 107 | |
Masahiro Yamada | 784548e | 2017-02-14 01:24:26 +0900 | [diff] [blame] | 108 | unsigned int uniphier_boot_device_raw(void); |
Masahiro Yamada | 6375484 | 2017-04-20 16:54:43 +0900 | [diff] [blame] | 109 | int uniphier_have_internal_stm(void); |
| 110 | int uniphier_boot_from_backend(void); |
Masahiro Yamada | 5ac9dfb | 2016-09-17 03:33:04 +0900 | [diff] [blame] | 111 | int uniphier_pin_init(const char *pinconfig_name); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 112 | |
Masahiro Yamada | 784548e | 2017-02-14 01:24:26 +0900 | [diff] [blame] | 113 | #undef pr_warn |
Masahiro Yamada | 3e9952b | 2017-01-28 06:53:43 +0900 | [diff] [blame] | 114 | #define pr_warn(fmt, args...) printf(fmt, ##args) |
Masahiro Yamada | 784548e | 2017-02-14 01:24:26 +0900 | [diff] [blame] | 115 | #undef pr_err |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 116 | #define pr_err(fmt, args...) printf(fmt, ##args) |
| 117 | |
| 118 | #endif /* __MACH_INIT_H */ |