blob: c6b3f3656ccc347ad4aa7ded09d435baf21bca5e [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Masahiro Yamada323d1f92015-09-22 00:27:39 +09002/*
Masahiro Yamadaa74c28a2016-07-22 13:38:32 +09003 * Copyright (C) 2015-2016 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada323d1f92015-09-22 00:27:39 +09005 */
6
7#ifndef __MACH_INIT_H
8#define __MACH_INIT_H
9
Masahiro Yamada4021b432016-02-26 14:21:40 +090010#include <linux/types.h>
11
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090012#define UNIPHIER_MAX_NR_DRAM_CH 3
13
14struct uniphier_dram_ch {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090015 unsigned long size;
16 unsigned int width;
17};
18
Masahiro Yamada323d1f92015-09-22 00:27:39 +090019struct uniphier_board_data {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090020 unsigned int dram_freq;
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090021 struct uniphier_dram_ch dram_ch[UNIPHIER_MAX_NR_DRAM_CH];
Masahiro Yamadaa74c28a2016-07-22 13:38:32 +090022 unsigned int flags;
Masahiro Yamadaf6bbec32016-09-14 01:06:10 +090023
Masahiro Yamada04cd4e72017-02-05 10:52:12 +090024#define UNIPHIER_BD_DRAM_SPARSE BIT(9)
25#define UNIPHIER_BD_DDR3PLUS BIT(8)
Masahiro Yamada323d1f92015-09-22 00:27:39 +090026};
27
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +090028const struct uniphier_board_data *uniphier_get_board_param(void);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090029
Masahiro Yamada5b660062016-03-30 20:17:02 +090030int uniphier_ld4_init(const struct uniphier_board_data *bd);
31int uniphier_pro4_init(const struct uniphier_board_data *bd);
32int uniphier_sld8_init(const struct uniphier_board_data *bd);
33int uniphier_pro5_init(const struct uniphier_board_data *bd);
34int uniphier_pxs2_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090035
36#if defined(CONFIG_MICRO_SUPPORT_CARD)
Masahiro Yamada9e3bb842017-01-15 14:59:05 +090037void uniphier_sbc_init_admulti(void);
38void uniphier_sbc_init_savepin(void);
39void uniphier_ld4_sbc_init(void);
40void uniphier_pxs2_sbc_init(void);
41void uniphier_ld11_sbc_init(void);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090042#else
Masahiro Yamada9e3bb842017-01-15 14:59:05 +090043static inline void uniphier_sbc_init_admulti(void)
Masahiro Yamada323d1f92015-09-22 00:27:39 +090044{
Masahiro Yamada323d1f92015-09-22 00:27:39 +090045}
46
Masahiro Yamada9e3bb842017-01-15 14:59:05 +090047static inline void uniphier_sbc_init_savepin(void)
Masahiro Yamada323d1f92015-09-22 00:27:39 +090048{
Masahiro Yamada323d1f92015-09-22 00:27:39 +090049}
50
Masahiro Yamada9e3bb842017-01-15 14:59:05 +090051static inline void uniphier_ld4_sbc_init(void)
Masahiro Yamada5d0607c2016-03-18 16:41:44 +090052{
Masahiro Yamada5d0607c2016-03-18 16:41:44 +090053}
54
Masahiro Yamada9e3bb842017-01-15 14:59:05 +090055static inline void uniphier_pxs2_sbc_init(void)
Masahiro Yamada019df872015-09-22 00:27:41 +090056{
Masahiro Yamada9e3bb842017-01-15 14:59:05 +090057}
58
59static inline void uniphier_ld11_sbc_init(void)
60{
Masahiro Yamada019df872015-09-22 00:27:41 +090061}
Masahiro Yamada323d1f92015-09-22 00:27:39 +090062#endif
63
Masahiro Yamadae94842f2017-01-15 14:59:07 +090064void uniphier_ld4_bcu_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090065
Masahiro Yamada8d6c99c2017-01-15 14:59:04 +090066int uniphier_memconf_2ch_init(const struct uniphier_board_data *bd);
Masahiro Yamada8d6c99c2017-01-15 14:59:04 +090067int uniphier_memconf_3ch_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090068
Masahiro Yamada6a3e4272016-09-17 03:33:09 +090069int uniphier_ld4_dpll_init(const struct uniphier_board_data *bd);
70int uniphier_pro4_dpll_init(const struct uniphier_board_data *bd);
71int uniphier_sld8_dpll_init(const struct uniphier_board_data *bd);
Masahiro Yamadaa8e63002017-01-15 14:59:09 +090072int uniphier_pro5_dpll_init(const struct uniphier_board_data *bd);
73int uniphier_pxs2_dpll_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090074
Masahiro Yamada00aa4532017-08-13 09:01:13 +090075void uniphier_ld4_early_clk_init(void);
Masahiro Yamada78c627c2017-01-15 14:59:03 +090076
Masahiro Yamada00aa4532017-08-13 09:01:13 +090077void uniphier_ld4_dram_clk_init(void);
Masahiro Yamada78c627c2017-01-15 14:59:03 +090078void uniphier_pro5_dram_clk_init(void);
79void uniphier_pxs2_dram_clk_init(void);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090080
Masahiro Yamada5b660062016-03-30 20:17:02 +090081int uniphier_ld4_umc_init(const struct uniphier_board_data *bd);
82int uniphier_pro4_umc_init(const struct uniphier_board_data *bd);
83int uniphier_sld8_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamadaa8e63002017-01-15 14:59:09 +090084int uniphier_pro5_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada5b660062016-03-30 20:17:02 +090085int uniphier_pxs2_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090086
Masahiro Yamada6a3e4272016-09-17 03:33:09 +090087void uniphier_ld4_pll_init(void);
88void uniphier_pro4_pll_init(void);
Masahiro Yamadac72f4d42016-09-22 07:42:19 +090089void uniphier_ld11_pll_init(void);
Masahiro Yamadaa314a242017-01-15 14:59:02 +090090void uniphier_ld20_pll_init(void);
Masahiro Yamada2c2ab3d2017-01-21 18:05:31 +090091void uniphier_pxs3_pll_init(void);
Masahiro Yamada6a3e4272016-09-17 03:33:09 +090092
Masahiro Yamada5b660062016-03-30 20:17:02 +090093void uniphier_ld4_clk_init(void);
94void uniphier_pro4_clk_init(void);
95void uniphier_pro5_clk_init(void);
96void uniphier_pxs2_clk_init(void);
Masahiro Yamada667dbcd2016-05-24 21:14:01 +090097void uniphier_ld11_clk_init(void);
Masahiro Yamadac21f5852017-02-17 16:17:22 +090098void uniphier_ld20_clk_init(void);
Masahiro Yamada81afa9c2017-05-15 14:26:33 +090099void uniphier_pxs3_clk_init(void);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +0900100
Masahiro Yamada784548e2017-02-14 01:24:26 +0900101unsigned int uniphier_boot_device_raw(void);
Masahiro Yamada63754842017-04-20 16:54:43 +0900102int uniphier_have_internal_stm(void);
103int uniphier_boot_from_backend(void);
Masahiro Yamada5ac9dfb2016-09-17 03:33:04 +0900104int uniphier_pin_init(const char *pinconfig_name);
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900105
Masahiro Yamada323d1f92015-09-22 00:27:39 +0900106#endif /* __MACH_INIT_H */