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; |
| 26 | #define UNIPHIER_BD_DDR3PLUS BIT(2) |
Masahiro Yamada | be44a46 | 2016-07-22 13:38:33 +0900 | [diff] [blame] | 27 | #define UNIPHIER_BD_PACKAGE_LD21 1 |
| 28 | #define UNIPHIER_BD_PACKAGE_TYPE(f) ((f) & 0x3) |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 29 | }; |
| 30 | |
Masahiro Yamada | 6ba60fa | 2015-12-17 17:47:42 +0900 | [diff] [blame] | 31 | const struct uniphier_board_data *uniphier_get_board_param(void); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 32 | |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 33 | int uniphier_sld3_init(const struct uniphier_board_data *bd); |
| 34 | int uniphier_ld4_init(const struct uniphier_board_data *bd); |
| 35 | int uniphier_pro4_init(const struct uniphier_board_data *bd); |
| 36 | int uniphier_sld8_init(const struct uniphier_board_data *bd); |
| 37 | int uniphier_pro5_init(const struct uniphier_board_data *bd); |
| 38 | int uniphier_pxs2_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 667dbcd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 39 | int uniphier_ld11_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 9d0c2ce | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 40 | int uniphier_ld20_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 41 | |
| 42 | #if defined(CONFIG_MICRO_SUPPORT_CARD) |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 43 | int uniphier_sbc_init_admulti(const struct uniphier_board_data *bd); |
| 44 | int uniphier_sbc_init_savepin(const struct uniphier_board_data *bd); |
Masahiro Yamada | 5d0607c | 2016-03-18 16:41:44 +0900 | [diff] [blame] | 45 | int uniphier_ld4_sbc_init(const struct uniphier_board_data *bd); |
| 46 | int uniphier_pxs2_sbc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 47 | #else |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 48 | static inline int uniphier_sbc_init_admulti( |
| 49 | const struct uniphier_board_data *bd) |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 50 | { |
| 51 | return 0; |
| 52 | } |
| 53 | |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 54 | static inline int uniphier_sbc_init_savepin( |
| 55 | const struct uniphier_board_data *bd) |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 56 | { |
| 57 | return 0; |
| 58 | } |
| 59 | |
Masahiro Yamada | 5d0607c | 2016-03-18 16:41:44 +0900 | [diff] [blame] | 60 | static inline int uniphier_ld4_sbc_init(const struct uniphier_board_data *bd) |
| 61 | { |
| 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | static inline int uniphier_pxs2_sbc_init(const struct uniphier_board_data *bd) |
Masahiro Yamada | 019df87 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 66 | { |
| 67 | return 0; |
| 68 | } |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 69 | #endif |
| 70 | |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 71 | int uniphier_sld3_bcu_init(const struct uniphier_board_data *bd); |
| 72 | int uniphier_ld4_bcu_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 73 | |
| 74 | int memconf_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 75 | int uniphier_sld3_memconf_init(const struct uniphier_board_data *bd); |
| 76 | int uniphier_pxs2_memconf_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 77 | |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 78 | int uniphier_sld3_pll_init(const struct uniphier_board_data *bd); |
| 79 | int uniphier_ld4_pll_init(const struct uniphier_board_data *bd); |
| 80 | int uniphier_pro4_pll_init(const struct uniphier_board_data *bd); |
| 81 | int uniphier_sld8_pll_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 82 | |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 83 | int uniphier_sld3_enable_dpll_ssc(const struct uniphier_board_data *bd); |
| 84 | int uniphier_ld4_enable_dpll_ssc(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 85 | |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 86 | int uniphier_ld4_early_clk_init(const struct uniphier_board_data *bd); |
| 87 | int uniphier_pro5_early_clk_init(const struct uniphier_board_data *bd); |
| 88 | int uniphier_pxs2_early_clk_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 667dbcd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 89 | int uniphier_ld11_early_clk_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 9d0c2ce | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 90 | int uniphier_ld20_early_clk_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 91 | |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 92 | int uniphier_sld3_early_pin_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 5eb4150 | 2016-04-28 15:37:15 +0900 | [diff] [blame] | 93 | int uniphier_ld20_early_pin_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 94 | |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 95 | int uniphier_ld4_umc_init(const struct uniphier_board_data *bd); |
| 96 | int uniphier_pro4_umc_init(const struct uniphier_board_data *bd); |
| 97 | int uniphier_sld8_umc_init(const struct uniphier_board_data *bd); |
| 98 | int uniphier_pxs2_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 9d0c2ce | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 99 | int uniphier_ld20_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 667dbcd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 100 | int uniphier_ld11_umc_init(const struct uniphier_board_data *bd); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 101 | |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 102 | void uniphier_sld3_pin_init(void); |
| 103 | void uniphier_ld4_pin_init(void); |
| 104 | void uniphier_pro4_pin_init(void); |
| 105 | void uniphier_sld8_pin_init(void); |
| 106 | void uniphier_pro5_pin_init(void); |
| 107 | void uniphier_pxs2_pin_init(void); |
| 108 | void uniphier_ld6b_pin_init(void); |
Masahiro Yamada | 9d0c2ce | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 109 | void uniphier_ld20_pin_init(void); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 110 | |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 111 | void uniphier_ld4_clk_init(void); |
| 112 | void uniphier_pro4_clk_init(void); |
| 113 | void uniphier_pro5_clk_init(void); |
| 114 | void uniphier_pxs2_clk_init(void); |
Masahiro Yamada | 667dbcd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 115 | void uniphier_ld11_clk_init(void); |
Masahiro Yamada | 9d0c2ce | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 116 | void uniphier_ld20_clk_init(void); |
| 117 | |
| 118 | void cci500_init(int nr_slaves); |
Masahiro Yamada | 323d1f9 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 119 | |
| 120 | #define pr_err(fmt, args...) printf(fmt, ##args) |
| 121 | |
| 122 | #endif /* __MACH_INIT_H */ |