blob: b322628eedfa74e1e933392f7551cbaaadf26416 [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 Yamada75f16f82015-09-22 00:27:39 +090027};
28
Masahiro Yamadac93f2792015-12-17 17:47:42 +090029const struct uniphier_board_data *uniphier_get_board_param(void);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090030
Masahiro Yamada98905692016-03-30 20:17:02 +090031int uniphier_sld3_init(const struct uniphier_board_data *bd);
32int uniphier_ld4_init(const struct uniphier_board_data *bd);
33int uniphier_pro4_init(const struct uniphier_board_data *bd);
34int uniphier_sld8_init(const struct uniphier_board_data *bd);
35int uniphier_pro5_init(const struct uniphier_board_data *bd);
36int uniphier_pxs2_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090037
38#if defined(CONFIG_MICRO_SUPPORT_CARD)
Masahiro Yamada6f11cde2017-01-15 14:59:05 +090039void uniphier_sbc_init_admulti(void);
40void uniphier_sbc_init_savepin(void);
41void uniphier_ld4_sbc_init(void);
42void uniphier_pxs2_sbc_init(void);
43void uniphier_ld11_sbc_init(void);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090044#else
Masahiro Yamada6f11cde2017-01-15 14:59:05 +090045static inline void uniphier_sbc_init_admulti(void)
Masahiro Yamada75f16f82015-09-22 00:27:39 +090046{
Masahiro Yamada75f16f82015-09-22 00:27:39 +090047}
48
Masahiro Yamada6f11cde2017-01-15 14:59:05 +090049static inline void uniphier_sbc_init_savepin(void)
Masahiro Yamada75f16f82015-09-22 00:27:39 +090050{
Masahiro Yamada75f16f82015-09-22 00:27:39 +090051}
52
Masahiro Yamada6f11cde2017-01-15 14:59:05 +090053static inline void uniphier_ld4_sbc_init(void)
Masahiro Yamada7d600a62016-03-18 16:41:44 +090054{
Masahiro Yamada7d600a62016-03-18 16:41:44 +090055}
56
Masahiro Yamada6f11cde2017-01-15 14:59:05 +090057static inline void uniphier_pxs2_sbc_init(void)
58{
59}
60
61static inline void uniphier_ld11_sbc_init(void)
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090062{
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090063}
Masahiro Yamada75f16f82015-09-22 00:27:39 +090064#endif
65
Masahiro Yamada3a67e9d2017-01-15 14:59:07 +090066void uniphier_sld3_bcu_init(const struct uniphier_board_data *bd);
67void uniphier_ld4_bcu_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090068
Masahiro Yamada7b361f72017-01-15 14:59:04 +090069int uniphier_memconf_2ch_init(const struct uniphier_board_data *bd);
70int uniphier_memconf_3ch_no_disbit_init(const struct uniphier_board_data *bd);
71int uniphier_memconf_3ch_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090072
Masahiro Yamada9d6652c2016-09-17 03:33:09 +090073int uniphier_sld3_dpll_init(const struct uniphier_board_data *bd);
74int uniphier_ld4_dpll_init(const struct uniphier_board_data *bd);
75int uniphier_pro4_dpll_init(const struct uniphier_board_data *bd);
76int uniphier_sld8_dpll_init(const struct uniphier_board_data *bd);
Masahiro Yamada8c3aa6b2017-01-15 14:59:09 +090077int uniphier_pro5_dpll_init(const struct uniphier_board_data *bd);
78int uniphier_pxs2_dpll_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090079
Masahiro Yamadaddb19002017-01-15 14:59:03 +090080void uniphier_sld3_early_clk_init(void);
Masahiro Yamadaddb19002017-01-15 14:59:03 +090081
82void uniphier_sld3_dram_clk_init(void);
83void uniphier_pro5_dram_clk_init(void);
84void uniphier_pxs2_dram_clk_init(void);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090085
Masahiro Yamada8c3aa6b2017-01-15 14:59:09 +090086int uniphier_sld3_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada98905692016-03-30 20:17:02 +090087int uniphier_ld4_umc_init(const struct uniphier_board_data *bd);
88int uniphier_pro4_umc_init(const struct uniphier_board_data *bd);
89int uniphier_sld8_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada8c3aa6b2017-01-15 14:59:09 +090090int uniphier_pro5_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada98905692016-03-30 20:17:02 +090091int uniphier_pxs2_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090092
Masahiro Yamada9d6652c2016-09-17 03:33:09 +090093void uniphier_sld3_pll_init(void);
94void uniphier_ld4_pll_init(void);
95void uniphier_pro4_pll_init(void);
Masahiro Yamada090785d2016-09-22 07:42:19 +090096void uniphier_ld11_pll_init(void);
Masahiro Yamada52b14bf2017-01-15 14:59:02 +090097void uniphier_ld20_pll_init(void);
Masahiro Yamada133b1262017-01-21 18:05:31 +090098void uniphier_pxs3_pll_init(void);
Masahiro Yamada9d6652c2016-09-17 03:33:09 +090099
Masahiro Yamada98905692016-03-30 20:17:02 +0900100void uniphier_ld4_clk_init(void);
101void uniphier_pro4_clk_init(void);
102void uniphier_pro5_clk_init(void);
103void uniphier_pxs2_clk_init(void);
Masahiro Yamada8bbbcbd2016-05-24 21:14:01 +0900104void uniphier_ld11_clk_init(void);
Masahiro Yamadab3b1bb72017-02-17 16:17:22 +0900105void uniphier_ld20_clk_init(void);
Masahiro Yamada8e0a4502017-05-15 14:26:33 +0900106void uniphier_pxs3_clk_init(void);
Masahiro Yamada063eb1e2016-04-21 14:43:18 +0900107
Masahiro Yamadafb092032017-02-14 01:24:26 +0900108unsigned int uniphier_boot_device_raw(void);
Masahiro Yamadaaf198102017-04-20 16:54:43 +0900109int uniphier_have_internal_stm(void);
110int uniphier_boot_from_backend(void);
Masahiro Yamadac21e19a2016-09-17 03:33:04 +0900111int uniphier_pin_init(const char *pinconfig_name);
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900112
Masahiro Yamadafb092032017-02-14 01:24:26 +0900113#undef pr_warn
Masahiro Yamadad97c1cb2017-01-28 06:53:43 +0900114#define pr_warn(fmt, args...) printf(fmt, ##args)
Masahiro Yamadafb092032017-02-14 01:24:26 +0900115#undef pr_err
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900116#define pr_err(fmt, args...) printf(fmt, ##args)
117
118#endif /* __MACH_INIT_H */