blob: f3f9e54a0b1fb33566cdc6b61bf10b7632afd505 [file] [log] [blame]
Masahiro Yamada75f16f82015-09-22 00:27:39 +09001/*
Masahiro Yamadafcdbbec2016-07-22 13:38:32 +09002 * Copyright (C) 2015-2016 Socionext Inc.
3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada75f16f82015-09-22 00:27:39 +09004 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#ifndef __MACH_INIT_H
9#define __MACH_INIT_H
10
Masahiro Yamadaa5731882016-02-26 14:21:40 +090011#include <linux/types.h>
12
Masahiro Yamada799e6f22016-02-26 14:21:34 +090013#define UNIPHIER_MAX_NR_DRAM_CH 3
14
15struct uniphier_dram_ch {
16 unsigned long base;
17 unsigned long size;
18 unsigned int width;
19};
20
Masahiro Yamada75f16f82015-09-22 00:27:39 +090021struct uniphier_board_data {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090022 unsigned int dram_freq;
23 unsigned int dram_nr_ch;
24 struct uniphier_dram_ch dram_ch[UNIPHIER_MAX_NR_DRAM_CH];
Masahiro Yamadafcdbbec2016-07-22 13:38:32 +090025 unsigned int flags;
Masahiro Yamada2de45ed2016-09-14 01:06:10 +090026
27#define UNIPHIER_BD_DDR3PLUS BIT(2)
28
Masahiro Yamadabf4266e2016-10-27 23:47:02 +090029#define UNIPHIER_BD_BOARD_GET_TYPE(f) ((f) & 0x7)
Masahiro Yamada2de45ed2016-09-14 01:06:10 +090030#define UNIPHIER_BD_BOARD_LD20_REF 0 /* LD20 reference */
31#define UNIPHIER_BD_BOARD_LD20_GLOBAL 1 /* LD20 TV Set */
Masahiro Yamadabf4266e2016-10-27 23:47:02 +090032#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 Yamada75f16f82015-09-22 00:27:39 +090035};
36
Masahiro Yamadac93f2792015-12-17 17:47:42 +090037const struct uniphier_board_data *uniphier_get_board_param(void);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090038
Masahiro Yamada98905692016-03-30 20:17:02 +090039int uniphier_sld3_init(const struct uniphier_board_data *bd);
40int uniphier_ld4_init(const struct uniphier_board_data *bd);
41int uniphier_pro4_init(const struct uniphier_board_data *bd);
42int uniphier_sld8_init(const struct uniphier_board_data *bd);
43int uniphier_pro5_init(const struct uniphier_board_data *bd);
44int uniphier_pxs2_init(const struct uniphier_board_data *bd);
Masahiro Yamada8bbbcbd2016-05-24 21:14:01 +090045int uniphier_ld11_init(const struct uniphier_board_data *bd);
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090046int uniphier_ld20_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090047
48#if defined(CONFIG_MICRO_SUPPORT_CARD)
Masahiro Yamada98905692016-03-30 20:17:02 +090049int uniphier_sbc_init_admulti(const struct uniphier_board_data *bd);
50int uniphier_sbc_init_savepin(const struct uniphier_board_data *bd);
Masahiro Yamada7d600a62016-03-18 16:41:44 +090051int uniphier_ld4_sbc_init(const struct uniphier_board_data *bd);
52int uniphier_pxs2_sbc_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090053#else
Masahiro Yamada98905692016-03-30 20:17:02 +090054static inline int uniphier_sbc_init_admulti(
55 const struct uniphier_board_data *bd)
Masahiro Yamada75f16f82015-09-22 00:27:39 +090056{
57 return 0;
58}
59
Masahiro Yamada98905692016-03-30 20:17:02 +090060static inline int uniphier_sbc_init_savepin(
61 const struct uniphier_board_data *bd)
Masahiro Yamada75f16f82015-09-22 00:27:39 +090062{
63 return 0;
64}
65
Masahiro Yamada7d600a62016-03-18 16:41:44 +090066static inline int uniphier_ld4_sbc_init(const struct uniphier_board_data *bd)
67{
68 return 0;
69}
70
71static inline int uniphier_pxs2_sbc_init(const struct uniphier_board_data *bd)
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090072{
73 return 0;
74}
Masahiro Yamada75f16f82015-09-22 00:27:39 +090075#endif
76
Masahiro Yamada98905692016-03-30 20:17:02 +090077int uniphier_sld3_bcu_init(const struct uniphier_board_data *bd);
78int uniphier_ld4_bcu_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090079
80int memconf_init(const struct uniphier_board_data *bd);
Masahiro Yamada98905692016-03-30 20:17:02 +090081int uniphier_sld3_memconf_init(const struct uniphier_board_data *bd);
82int uniphier_pxs2_memconf_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090083
Masahiro Yamada9d6652c2016-09-17 03:33:09 +090084int uniphier_sld3_dpll_init(const struct uniphier_board_data *bd);
85int uniphier_ld4_dpll_init(const struct uniphier_board_data *bd);
86int uniphier_pro4_dpll_init(const struct uniphier_board_data *bd);
87int uniphier_sld8_dpll_init(const struct uniphier_board_data *bd);
Masahiro Yamada090785d2016-09-22 07:42:19 +090088int uniphier_ld11_dpll_init(const struct uniphier_board_data *bd);
Masahiro Yamadad11b0b72016-09-17 03:33:11 +090089int uniphier_ld20_dpll_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090090
Masahiro Yamada98905692016-03-30 20:17:02 +090091int uniphier_ld4_early_clk_init(const struct uniphier_board_data *bd);
92int uniphier_pro5_early_clk_init(const struct uniphier_board_data *bd);
93int uniphier_pxs2_early_clk_init(const struct uniphier_board_data *bd);
Masahiro Yamada8bbbcbd2016-05-24 21:14:01 +090094int uniphier_ld11_early_clk_init(const struct uniphier_board_data *bd);
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090095int uniphier_ld20_early_clk_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090096
Masahiro Yamada98905692016-03-30 20:17:02 +090097int uniphier_ld4_umc_init(const struct uniphier_board_data *bd);
98int uniphier_pro4_umc_init(const struct uniphier_board_data *bd);
99int uniphier_sld8_umc_init(const struct uniphier_board_data *bd);
100int uniphier_pxs2_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada063eb1e2016-04-21 14:43:18 +0900101int uniphier_ld20_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada8bbbcbd2016-05-24 21:14:01 +0900102int uniphier_ld11_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900103
Masahiro Yamada9d6652c2016-09-17 03:33:09 +0900104void uniphier_sld3_pll_init(void);
105void uniphier_ld4_pll_init(void);
106void uniphier_pro4_pll_init(void);
Masahiro Yamada090785d2016-09-22 07:42:19 +0900107void uniphier_ld11_pll_init(void);
Masahiro Yamadad11b0b72016-09-17 03:33:11 +0900108int uniphier_ld20_pll_init(const struct uniphier_board_data *bd);
Masahiro Yamada9d6652c2016-09-17 03:33:09 +0900109
Masahiro Yamada98905692016-03-30 20:17:02 +0900110void uniphier_ld4_clk_init(void);
111void uniphier_pro4_clk_init(void);
112void uniphier_pro5_clk_init(void);
113void uniphier_pxs2_clk_init(void);
Masahiro Yamada8bbbcbd2016-05-24 21:14:01 +0900114void uniphier_ld11_clk_init(void);
Masahiro Yamada063eb1e2016-04-21 14:43:18 +0900115void uniphier_ld20_clk_init(void);
116
Masahiro Yamadac21e19a2016-09-17 03:33:04 +0900117int uniphier_pin_init(const char *pinconfig_name);
Masahiro Yamadae59ed192016-09-14 01:06:08 +0900118void uniphier_smp_kick_all_cpus(void);
Masahiro Yamada063eb1e2016-04-21 14:43:18 +0900119void cci500_init(int nr_slaves);
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900120
121#define pr_err(fmt, args...) printf(fmt, ##args)
122
123#endif /* __MACH_INIT_H */