blob: 453e68a43e73d8414b88b5c45467750aa9045f4b [file] [log] [blame]
Masahiro Yamada323d1f92015-09-22 00:27:39 +09001/*
Masahiro Yamadaa74c28a2016-07-22 13:38:32 +09002 * Copyright (C) 2015-2016 Socionext Inc.
3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada323d1f92015-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 Yamada4021b432016-02-26 14:21:40 +090011#include <linux/types.h>
12
Masahiro Yamada46abfcc2016-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 Yamada323d1f92015-09-22 00:27:39 +090021struct uniphier_board_data {
Masahiro Yamada46abfcc2016-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 Yamadaa74c28a2016-07-22 13:38:32 +090025 unsigned int flags;
Masahiro Yamadaf6bbec32016-09-14 01:06:10 +090026
27#define UNIPHIER_BD_DDR3PLUS BIT(2)
28
Masahiro Yamadab8909972016-10-27 23:47:02 +090029#define UNIPHIER_BD_BOARD_GET_TYPE(f) ((f) & 0x7)
Masahiro Yamadaf6bbec32016-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 Yamadab8909972016-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 Yamada323d1f92015-09-22 00:27:39 +090035};
36
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +090037const struct uniphier_board_data *uniphier_get_board_param(void);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090038
Masahiro Yamada5b660062016-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 Yamada667dbcd2016-05-24 21:14:01 +090045int uniphier_ld11_init(const struct uniphier_board_data *bd);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +090046int uniphier_ld20_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090047
48#if defined(CONFIG_MICRO_SUPPORT_CARD)
Masahiro Yamada9e3bb842017-01-15 14:59:05 +090049void uniphier_sbc_init_admulti(void);
50void uniphier_sbc_init_savepin(void);
51void uniphier_ld4_sbc_init(void);
52void uniphier_pxs2_sbc_init(void);
53void uniphier_ld11_sbc_init(void);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090054#else
Masahiro Yamada9e3bb842017-01-15 14:59:05 +090055static inline void uniphier_sbc_init_admulti(void)
Masahiro Yamada323d1f92015-09-22 00:27:39 +090056{
Masahiro Yamada323d1f92015-09-22 00:27:39 +090057}
58
Masahiro Yamada9e3bb842017-01-15 14:59:05 +090059static inline void uniphier_sbc_init_savepin(void)
Masahiro Yamada323d1f92015-09-22 00:27:39 +090060{
Masahiro Yamada323d1f92015-09-22 00:27:39 +090061}
62
Masahiro Yamada9e3bb842017-01-15 14:59:05 +090063static inline void uniphier_ld4_sbc_init(void)
Masahiro Yamada5d0607c2016-03-18 16:41:44 +090064{
Masahiro Yamada5d0607c2016-03-18 16:41:44 +090065}
66
Masahiro Yamada9e3bb842017-01-15 14:59:05 +090067static inline void uniphier_pxs2_sbc_init(void)
Masahiro Yamada019df872015-09-22 00:27:41 +090068{
Masahiro Yamada9e3bb842017-01-15 14:59:05 +090069}
70
71static inline void uniphier_ld11_sbc_init(void)
72{
Masahiro Yamada019df872015-09-22 00:27:41 +090073}
Masahiro Yamada323d1f92015-09-22 00:27:39 +090074#endif
75
Masahiro Yamadae94842f2017-01-15 14:59:07 +090076void uniphier_sld3_bcu_init(const struct uniphier_board_data *bd);
77void uniphier_ld4_bcu_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090078
Masahiro Yamada8d6c99c2017-01-15 14:59:04 +090079int uniphier_memconf_2ch_init(const struct uniphier_board_data *bd);
80int uniphier_memconf_3ch_no_disbit_init(const struct uniphier_board_data *bd);
81int uniphier_memconf_3ch_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090082
Masahiro Yamada6a3e4272016-09-17 03:33:09 +090083int uniphier_sld3_dpll_init(const struct uniphier_board_data *bd);
84int uniphier_ld4_dpll_init(const struct uniphier_board_data *bd);
85int uniphier_pro4_dpll_init(const struct uniphier_board_data *bd);
86int uniphier_sld8_dpll_init(const struct uniphier_board_data *bd);
Masahiro Yamadaa8e63002017-01-15 14:59:09 +090087int uniphier_pro5_dpll_init(const struct uniphier_board_data *bd);
88int uniphier_pxs2_dpll_init(const struct uniphier_board_data *bd);
Masahiro Yamadac72f4d42016-09-22 07:42:19 +090089int uniphier_ld11_dpll_init(const struct uniphier_board_data *bd);
Masahiro Yamada682e09f2016-09-17 03:33:11 +090090int uniphier_ld20_dpll_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090091
Masahiro Yamada78c627c2017-01-15 14:59:03 +090092void uniphier_sld3_early_clk_init(void);
93void uniphier_ld11_early_clk_init(void);
94
95void uniphier_sld3_dram_clk_init(void);
96void uniphier_pro5_dram_clk_init(void);
97void uniphier_pxs2_dram_clk_init(void);
98void uniphier_ld11_dram_clk_init(void);
99void uniphier_ld20_dram_clk_init(void);
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900100
Masahiro Yamadaa8e63002017-01-15 14:59:09 +0900101int uniphier_sld3_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada5b660062016-03-30 20:17:02 +0900102int uniphier_ld4_umc_init(const struct uniphier_board_data *bd);
103int uniphier_pro4_umc_init(const struct uniphier_board_data *bd);
104int uniphier_sld8_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamadaa8e63002017-01-15 14:59:09 +0900105int uniphier_pro5_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada5b660062016-03-30 20:17:02 +0900106int uniphier_pxs2_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900107int uniphier_ld20_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada667dbcd2016-05-24 21:14:01 +0900108int uniphier_ld11_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900109
Masahiro Yamada6a3e4272016-09-17 03:33:09 +0900110void uniphier_sld3_pll_init(void);
111void uniphier_ld4_pll_init(void);
112void uniphier_pro4_pll_init(void);
Masahiro Yamadac72f4d42016-09-22 07:42:19 +0900113void uniphier_ld11_pll_init(void);
Masahiro Yamadaa314a242017-01-15 14:59:02 +0900114void uniphier_ld20_pll_init(void);
Masahiro Yamada2c2ab3d2017-01-21 18:05:31 +0900115void uniphier_pxs3_pll_init(void);
Masahiro Yamada6a3e4272016-09-17 03:33:09 +0900116
Masahiro Yamada5b660062016-03-30 20:17:02 +0900117void uniphier_ld4_clk_init(void);
118void uniphier_pro4_clk_init(void);
119void uniphier_pro5_clk_init(void);
120void uniphier_pxs2_clk_init(void);
Masahiro Yamada667dbcd2016-05-24 21:14:01 +0900121void uniphier_ld11_clk_init(void);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900122
Masahiro Yamada5ac9dfb2016-09-17 03:33:04 +0900123int uniphier_pin_init(const char *pinconfig_name);
Masahiro Yamadab2916712016-09-14 01:06:08 +0900124void uniphier_smp_kick_all_cpus(void);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900125void cci500_init(int nr_slaves);
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900126
Masahiro Yamada3e9952b2017-01-28 06:53:43 +0900127#define pr_warn(fmt, args...) printf(fmt, ##args)
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900128#define pr_err(fmt, args...) printf(fmt, ##args)
129
130#endif /* __MACH_INIT_H */