blob: d413d00f951b403235ff4326d041a39321fec121 [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 {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090016 unsigned long size;
17 unsigned int width;
18};
19
Masahiro Yamada75f16f82015-09-22 00:27:39 +090020struct uniphier_board_data {
Masahiro Yamada799e6f22016-02-26 14:21:34 +090021 unsigned int dram_freq;
Masahiro Yamada799e6f22016-02-26 14:21:34 +090022 struct uniphier_dram_ch dram_ch[UNIPHIER_MAX_NR_DRAM_CH];
Masahiro Yamadafcdbbec2016-07-22 13:38:32 +090023 unsigned int flags;
Masahiro Yamada2de45ed2016-09-14 01:06:10 +090024
Masahiro Yamada3dc80972017-02-05 10:52:12 +090025#define UNIPHIER_BD_DRAM_SPARSE BIT(9)
26#define UNIPHIER_BD_DDR3PLUS BIT(8)
Masahiro Yamada2de45ed2016-09-14 01:06:10 +090027
Masahiro Yamadabf4266e2016-10-27 23:47:02 +090028#define UNIPHIER_BD_BOARD_GET_TYPE(f) ((f) & 0x7)
Masahiro Yamada2de45ed2016-09-14 01:06:10 +090029#define UNIPHIER_BD_BOARD_LD20_REF 0 /* LD20 reference */
30#define UNIPHIER_BD_BOARD_LD20_GLOBAL 1 /* LD20 TV Set */
Masahiro Yamadabf4266e2016-10-27 23:47:02 +090031#define UNIPHIER_BD_BOARD_LD20_C1 2 /* LD20 TV Set C1 */
32#define UNIPHIER_BD_BOARD_LD21_REF 3 /* LD21 reference */
33#define UNIPHIER_BD_BOARD_LD21_GLOBAL 4 /* LD21 TV Set */
Masahiro Yamada75f16f82015-09-22 00:27:39 +090034};
35
Masahiro Yamadac93f2792015-12-17 17:47:42 +090036const struct uniphier_board_data *uniphier_get_board_param(void);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090037
Masahiro Yamada98905692016-03-30 20:17:02 +090038int uniphier_sld3_init(const struct uniphier_board_data *bd);
39int uniphier_ld4_init(const struct uniphier_board_data *bd);
40int uniphier_pro4_init(const struct uniphier_board_data *bd);
41int uniphier_sld8_init(const struct uniphier_board_data *bd);
42int uniphier_pro5_init(const struct uniphier_board_data *bd);
43int uniphier_pxs2_init(const struct uniphier_board_data *bd);
Masahiro Yamada8bbbcbd2016-05-24 21:14:01 +090044int uniphier_ld11_init(const struct uniphier_board_data *bd);
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090045int uniphier_ld20_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090046
47#if defined(CONFIG_MICRO_SUPPORT_CARD)
Masahiro Yamada6f11cde2017-01-15 14:59:05 +090048void uniphier_sbc_init_admulti(void);
49void uniphier_sbc_init_savepin(void);
50void uniphier_ld4_sbc_init(void);
51void uniphier_pxs2_sbc_init(void);
52void uniphier_ld11_sbc_init(void);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090053#else
Masahiro Yamada6f11cde2017-01-15 14:59:05 +090054static inline void uniphier_sbc_init_admulti(void)
Masahiro Yamada75f16f82015-09-22 00:27:39 +090055{
Masahiro Yamada75f16f82015-09-22 00:27:39 +090056}
57
Masahiro Yamada6f11cde2017-01-15 14:59:05 +090058static inline void uniphier_sbc_init_savepin(void)
Masahiro Yamada75f16f82015-09-22 00:27:39 +090059{
Masahiro Yamada75f16f82015-09-22 00:27:39 +090060}
61
Masahiro Yamada6f11cde2017-01-15 14:59:05 +090062static inline void uniphier_ld4_sbc_init(void)
Masahiro Yamada7d600a62016-03-18 16:41:44 +090063{
Masahiro Yamada7d600a62016-03-18 16:41:44 +090064}
65
Masahiro Yamada6f11cde2017-01-15 14:59:05 +090066static inline void uniphier_pxs2_sbc_init(void)
67{
68}
69
70static inline void uniphier_ld11_sbc_init(void)
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090071{
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090072}
Masahiro Yamada75f16f82015-09-22 00:27:39 +090073#endif
74
Masahiro Yamada3a67e9d2017-01-15 14:59:07 +090075void uniphier_sld3_bcu_init(const struct uniphier_board_data *bd);
76void uniphier_ld4_bcu_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090077
Masahiro Yamada7b361f72017-01-15 14:59:04 +090078int uniphier_memconf_2ch_init(const struct uniphier_board_data *bd);
79int uniphier_memconf_3ch_no_disbit_init(const struct uniphier_board_data *bd);
80int uniphier_memconf_3ch_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090081
Masahiro Yamada9d6652c2016-09-17 03:33:09 +090082int uniphier_sld3_dpll_init(const struct uniphier_board_data *bd);
83int uniphier_ld4_dpll_init(const struct uniphier_board_data *bd);
84int uniphier_pro4_dpll_init(const struct uniphier_board_data *bd);
85int uniphier_sld8_dpll_init(const struct uniphier_board_data *bd);
Masahiro Yamada8c3aa6b2017-01-15 14:59:09 +090086int uniphier_pro5_dpll_init(const struct uniphier_board_data *bd);
87int uniphier_pxs2_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 Yamadaddb19002017-01-15 14:59:03 +090091void uniphier_sld3_early_clk_init(void);
92void uniphier_ld11_early_clk_init(void);
93
94void uniphier_sld3_dram_clk_init(void);
95void uniphier_pro5_dram_clk_init(void);
96void uniphier_pxs2_dram_clk_init(void);
97void uniphier_ld11_dram_clk_init(void);
98void uniphier_ld20_dram_clk_init(void);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090099
Masahiro Yamada8c3aa6b2017-01-15 14:59:09 +0900100int uniphier_sld3_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada98905692016-03-30 20:17:02 +0900101int uniphier_ld4_umc_init(const struct uniphier_board_data *bd);
102int uniphier_pro4_umc_init(const struct uniphier_board_data *bd);
103int uniphier_sld8_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada8c3aa6b2017-01-15 14:59:09 +0900104int uniphier_pro5_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada98905692016-03-30 20:17:02 +0900105int uniphier_pxs2_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada063eb1e2016-04-21 14:43:18 +0900106int uniphier_ld20_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada8bbbcbd2016-05-24 21:14:01 +0900107int uniphier_ld11_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900108
Masahiro Yamada9d6652c2016-09-17 03:33:09 +0900109void uniphier_sld3_pll_init(void);
110void uniphier_ld4_pll_init(void);
111void uniphier_pro4_pll_init(void);
Masahiro Yamada090785d2016-09-22 07:42:19 +0900112void uniphier_ld11_pll_init(void);
Masahiro Yamada52b14bf2017-01-15 14:59:02 +0900113void uniphier_ld20_pll_init(void);
Masahiro Yamada133b1262017-01-21 18:05:31 +0900114void uniphier_pxs3_pll_init(void);
Masahiro Yamada9d6652c2016-09-17 03:33:09 +0900115
Masahiro Yamada98905692016-03-30 20:17:02 +0900116void uniphier_ld4_clk_init(void);
117void uniphier_pro4_clk_init(void);
118void uniphier_pro5_clk_init(void);
119void uniphier_pxs2_clk_init(void);
Masahiro Yamada8bbbcbd2016-05-24 21:14:01 +0900120void uniphier_ld11_clk_init(void);
Masahiro Yamadab3b1bb72017-02-17 16:17:22 +0900121void uniphier_ld20_clk_init(void);
Masahiro Yamada8e0a4502017-05-15 14:26:33 +0900122void uniphier_pxs3_clk_init(void);
Masahiro Yamada063eb1e2016-04-21 14:43:18 +0900123
Masahiro Yamadafb092032017-02-14 01:24:26 +0900124unsigned int uniphier_boot_device_raw(void);
Masahiro Yamadaaf198102017-04-20 16:54:43 +0900125int uniphier_have_internal_stm(void);
126int uniphier_boot_from_backend(void);
Masahiro Yamadac21e19a2016-09-17 03:33:04 +0900127int uniphier_pin_init(const char *pinconfig_name);
Masahiro Yamadae59ed192016-09-14 01:06:08 +0900128void uniphier_smp_kick_all_cpus(void);
Masahiro Yamada063eb1e2016-04-21 14:43:18 +0900129void cci500_init(int nr_slaves);
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900130
Masahiro Yamadafb092032017-02-14 01:24:26 +0900131#undef pr_warn
Masahiro Yamadad97c1cb2017-01-28 06:53:43 +0900132#define pr_warn(fmt, args...) printf(fmt, ##args)
Masahiro Yamadafb092032017-02-14 01:24:26 +0900133#undef pr_err
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900134#define pr_err(fmt, args...) printf(fmt, ##args)
135
136#endif /* __MACH_INIT_H */