blob: 406d5d00de7fdbd53583ad96b84e81351c51b3db [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
29#define UNIPHIER_BD_BOARD_GET_TYPE(f) ((f) & 0x3)
30#define UNIPHIER_BD_BOARD_LD20_REF 0 /* LD20 reference */
31#define UNIPHIER_BD_BOARD_LD20_GLOBAL 1 /* LD20 TV Set */
32#define UNIPHIER_BD_BOARD_LD21_REF 2 /* LD21 reference */
33#define UNIPHIER_BD_BOARD_LD21_GLOBAL 3 /* LD21 TV Set */
Masahiro Yamada323d1f92015-09-22 00:27:39 +090034};
35
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +090036const struct uniphier_board_data *uniphier_get_board_param(void);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090037
Masahiro Yamada5b660062016-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 Yamada667dbcd2016-05-24 21:14:01 +090044int uniphier_ld11_init(const struct uniphier_board_data *bd);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +090045int uniphier_ld20_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090046
47#if defined(CONFIG_MICRO_SUPPORT_CARD)
Masahiro Yamada5b660062016-03-30 20:17:02 +090048int uniphier_sbc_init_admulti(const struct uniphier_board_data *bd);
49int uniphier_sbc_init_savepin(const struct uniphier_board_data *bd);
Masahiro Yamada5d0607c2016-03-18 16:41:44 +090050int uniphier_ld4_sbc_init(const struct uniphier_board_data *bd);
51int uniphier_pxs2_sbc_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090052#else
Masahiro Yamada5b660062016-03-30 20:17:02 +090053static inline int uniphier_sbc_init_admulti(
54 const struct uniphier_board_data *bd)
Masahiro Yamada323d1f92015-09-22 00:27:39 +090055{
56 return 0;
57}
58
Masahiro Yamada5b660062016-03-30 20:17:02 +090059static inline int uniphier_sbc_init_savepin(
60 const struct uniphier_board_data *bd)
Masahiro Yamada323d1f92015-09-22 00:27:39 +090061{
62 return 0;
63}
64
Masahiro Yamada5d0607c2016-03-18 16:41:44 +090065static inline int uniphier_ld4_sbc_init(const struct uniphier_board_data *bd)
66{
67 return 0;
68}
69
70static inline int uniphier_pxs2_sbc_init(const struct uniphier_board_data *bd)
Masahiro Yamada019df872015-09-22 00:27:41 +090071{
72 return 0;
73}
Masahiro Yamada323d1f92015-09-22 00:27:39 +090074#endif
75
Masahiro Yamada5b660062016-03-30 20:17:02 +090076int uniphier_sld3_bcu_init(const struct uniphier_board_data *bd);
77int uniphier_ld4_bcu_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090078
79int memconf_init(const struct uniphier_board_data *bd);
Masahiro Yamada5b660062016-03-30 20:17:02 +090080int uniphier_sld3_memconf_init(const struct uniphier_board_data *bd);
81int uniphier_pxs2_memconf_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_pll_init(const struct uniphier_board_data *bd);
84int uniphier_ld4_pll_init(const struct uniphier_board_data *bd);
85int uniphier_pro4_pll_init(const struct uniphier_board_data *bd);
86int uniphier_sld8_pll_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090087
Masahiro Yamada5b660062016-03-30 20:17:02 +090088int uniphier_sld3_enable_dpll_ssc(const struct uniphier_board_data *bd);
89int uniphier_ld4_enable_dpll_ssc(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090090
Masahiro Yamada5b660062016-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 Yamada667dbcd2016-05-24 21:14:01 +090094int uniphier_ld11_early_clk_init(const struct uniphier_board_data *bd);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +090095int uniphier_ld20_early_clk_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090096
Masahiro Yamada5b660062016-03-30 20:17:02 +090097int uniphier_sld3_early_pin_init(const struct uniphier_board_data *bd);
Masahiro Yamada5eb41502016-04-28 15:37:15 +090098int uniphier_ld20_early_pin_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090099
Masahiro Yamada5b660062016-03-30 20:17:02 +0900100int uniphier_ld4_umc_init(const struct uniphier_board_data *bd);
101int uniphier_pro4_umc_init(const struct uniphier_board_data *bd);
102int uniphier_sld8_umc_init(const struct uniphier_board_data *bd);
103int uniphier_pxs2_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900104int uniphier_ld20_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada667dbcd2016-05-24 21:14:01 +0900105int uniphier_ld11_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900106
Masahiro Yamada5b660062016-03-30 20:17:02 +0900107void uniphier_sld3_pin_init(void);
108void uniphier_ld4_pin_init(void);
109void uniphier_pro4_pin_init(void);
110void uniphier_sld8_pin_init(void);
111void uniphier_pro5_pin_init(void);
112void uniphier_pxs2_pin_init(void);
113void uniphier_ld6b_pin_init(void);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900114void uniphier_ld20_pin_init(void);
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900115
Masahiro Yamada5b660062016-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 Yamada667dbcd2016-05-24 21:14:01 +0900120void uniphier_ld11_clk_init(void);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900121void uniphier_ld20_clk_init(void);
122
Masahiro Yamadab2916712016-09-14 01:06:08 +0900123void uniphier_smp_kick_all_cpus(void);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900124void cci500_init(int nr_slaves);
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900125
126#define pr_err(fmt, args...) printf(fmt, ##args)
127
128#endif /* __MACH_INIT_H */