blob: db80074fc9e708485af2f9ec71ca2e61001d82ca [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;
26#define UNIPHIER_BD_DDR3PLUS BIT(2)
Masahiro Yamadabe44a462016-07-22 13:38:33 +090027#define UNIPHIER_BD_PACKAGE_LD21 1
28#define UNIPHIER_BD_PACKAGE_TYPE(f) ((f) & 0x3)
Masahiro Yamada323d1f92015-09-22 00:27:39 +090029};
30
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +090031const struct uniphier_board_data *uniphier_get_board_param(void);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090032
Masahiro Yamada5b660062016-03-30 20:17:02 +090033int uniphier_sld3_init(const struct uniphier_board_data *bd);
34int uniphier_ld4_init(const struct uniphier_board_data *bd);
35int uniphier_pro4_init(const struct uniphier_board_data *bd);
36int uniphier_sld8_init(const struct uniphier_board_data *bd);
37int uniphier_pro5_init(const struct uniphier_board_data *bd);
38int uniphier_pxs2_init(const struct uniphier_board_data *bd);
Masahiro Yamada667dbcd2016-05-24 21:14:01 +090039int uniphier_ld11_init(const struct uniphier_board_data *bd);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +090040int uniphier_ld20_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090041
42#if defined(CONFIG_MICRO_SUPPORT_CARD)
Masahiro Yamada5b660062016-03-30 20:17:02 +090043int uniphier_sbc_init_admulti(const struct uniphier_board_data *bd);
44int uniphier_sbc_init_savepin(const struct uniphier_board_data *bd);
Masahiro Yamada5d0607c2016-03-18 16:41:44 +090045int uniphier_ld4_sbc_init(const struct uniphier_board_data *bd);
46int uniphier_pxs2_sbc_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090047#else
Masahiro Yamada5b660062016-03-30 20:17:02 +090048static inline int uniphier_sbc_init_admulti(
49 const struct uniphier_board_data *bd)
Masahiro Yamada323d1f92015-09-22 00:27:39 +090050{
51 return 0;
52}
53
Masahiro Yamada5b660062016-03-30 20:17:02 +090054static inline int uniphier_sbc_init_savepin(
55 const struct uniphier_board_data *bd)
Masahiro Yamada323d1f92015-09-22 00:27:39 +090056{
57 return 0;
58}
59
Masahiro Yamada5d0607c2016-03-18 16:41:44 +090060static inline int uniphier_ld4_sbc_init(const struct uniphier_board_data *bd)
61{
62 return 0;
63}
64
65static inline int uniphier_pxs2_sbc_init(const struct uniphier_board_data *bd)
Masahiro Yamada019df872015-09-22 00:27:41 +090066{
67 return 0;
68}
Masahiro Yamada323d1f92015-09-22 00:27:39 +090069#endif
70
Masahiro Yamada5b660062016-03-30 20:17:02 +090071int uniphier_sld3_bcu_init(const struct uniphier_board_data *bd);
72int uniphier_ld4_bcu_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090073
74int memconf_init(const struct uniphier_board_data *bd);
Masahiro Yamada5b660062016-03-30 20:17:02 +090075int uniphier_sld3_memconf_init(const struct uniphier_board_data *bd);
76int uniphier_pxs2_memconf_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090077
Masahiro Yamada5b660062016-03-30 20:17:02 +090078int uniphier_sld3_pll_init(const struct uniphier_board_data *bd);
79int uniphier_ld4_pll_init(const struct uniphier_board_data *bd);
80int uniphier_pro4_pll_init(const struct uniphier_board_data *bd);
81int uniphier_sld8_pll_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090082
Masahiro Yamada5b660062016-03-30 20:17:02 +090083int uniphier_sld3_enable_dpll_ssc(const struct uniphier_board_data *bd);
84int uniphier_ld4_enable_dpll_ssc(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090085
Masahiro Yamada5b660062016-03-30 20:17:02 +090086int uniphier_ld4_early_clk_init(const struct uniphier_board_data *bd);
87int uniphier_pro5_early_clk_init(const struct uniphier_board_data *bd);
88int uniphier_pxs2_early_clk_init(const struct uniphier_board_data *bd);
Masahiro Yamada667dbcd2016-05-24 21:14:01 +090089int uniphier_ld11_early_clk_init(const struct uniphier_board_data *bd);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +090090int uniphier_ld20_early_clk_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090091
Masahiro Yamada5b660062016-03-30 20:17:02 +090092int uniphier_sld3_early_pin_init(const struct uniphier_board_data *bd);
Masahiro Yamada5eb41502016-04-28 15:37:15 +090093int uniphier_ld20_early_pin_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090094
Masahiro Yamada5b660062016-03-30 20:17:02 +090095int uniphier_ld4_umc_init(const struct uniphier_board_data *bd);
96int uniphier_pro4_umc_init(const struct uniphier_board_data *bd);
97int uniphier_sld8_umc_init(const struct uniphier_board_data *bd);
98int uniphier_pxs2_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +090099int uniphier_ld20_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada667dbcd2016-05-24 21:14:01 +0900100int uniphier_ld11_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900101
Masahiro Yamada5b660062016-03-30 20:17:02 +0900102void uniphier_sld3_pin_init(void);
103void uniphier_ld4_pin_init(void);
104void uniphier_pro4_pin_init(void);
105void uniphier_sld8_pin_init(void);
106void uniphier_pro5_pin_init(void);
107void uniphier_pxs2_pin_init(void);
108void uniphier_ld6b_pin_init(void);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900109void uniphier_ld20_pin_init(void);
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900110
Masahiro Yamada5b660062016-03-30 20:17:02 +0900111void uniphier_ld4_clk_init(void);
112void uniphier_pro4_clk_init(void);
113void uniphier_pro5_clk_init(void);
114void uniphier_pxs2_clk_init(void);
Masahiro Yamada667dbcd2016-05-24 21:14:01 +0900115void uniphier_ld11_clk_init(void);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900116void uniphier_ld20_clk_init(void);
117
118void cci500_init(int nr_slaves);
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900119
120#define pr_err(fmt, args...) printf(fmt, ##args)
121
122#endif /* __MACH_INIT_H */