blob: 622303786c54958fe874c88a9dffec94d70b1717 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Masahiro Yamada75f16f82015-09-22 00:27:39 +09002/*
Masahiro Yamadafcdbbec2016-07-22 13:38:32 +09003 * Copyright (C) 2015-2016 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada75f16f82015-09-22 00:27:39 +09005 */
6
7#ifndef __MACH_INIT_H
8#define __MACH_INIT_H
9
Simon Glass4dcacfc2020-05-10 11:40:13 -060010#include <linux/bitops.h>
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_ld4_init(const struct uniphier_board_data *bd);
32int uniphier_pro4_init(const struct uniphier_board_data *bd);
33int uniphier_sld8_init(const struct uniphier_board_data *bd);
34int uniphier_pro5_init(const struct uniphier_board_data *bd);
35int uniphier_pxs2_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090036
37#if defined(CONFIG_MICRO_SUPPORT_CARD)
Masahiro Yamada6f11cde2017-01-15 14:59:05 +090038void uniphier_sbc_init_admulti(void);
39void uniphier_sbc_init_savepin(void);
40void uniphier_ld4_sbc_init(void);
41void uniphier_pxs2_sbc_init(void);
42void uniphier_ld11_sbc_init(void);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090043#else
Masahiro Yamada6f11cde2017-01-15 14:59:05 +090044static inline void uniphier_sbc_init_admulti(void)
Masahiro Yamada75f16f82015-09-22 00:27:39 +090045{
Masahiro Yamada75f16f82015-09-22 00:27:39 +090046}
47
Masahiro Yamada6f11cde2017-01-15 14:59:05 +090048static inline void uniphier_sbc_init_savepin(void)
Masahiro Yamada75f16f82015-09-22 00:27:39 +090049{
Masahiro Yamada75f16f82015-09-22 00:27:39 +090050}
51
Masahiro Yamada6f11cde2017-01-15 14:59:05 +090052static inline void uniphier_ld4_sbc_init(void)
Masahiro Yamada7d600a62016-03-18 16:41:44 +090053{
Masahiro Yamada7d600a62016-03-18 16:41:44 +090054}
55
Masahiro Yamada6f11cde2017-01-15 14:59:05 +090056static inline void uniphier_pxs2_sbc_init(void)
57{
58}
59
60static inline void uniphier_ld11_sbc_init(void)
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090061{
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090062}
Masahiro Yamada75f16f82015-09-22 00:27:39 +090063#endif
64
Masahiro Yamada3a67e9d2017-01-15 14:59:07 +090065void uniphier_ld4_bcu_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090066
Masahiro Yamada7b361f72017-01-15 14:59:04 +090067int uniphier_memconf_2ch_init(const struct uniphier_board_data *bd);
Masahiro Yamada7b361f72017-01-15 14:59:04 +090068int uniphier_memconf_3ch_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090069
Masahiro Yamada9d6652c2016-09-17 03:33:09 +090070int uniphier_ld4_dpll_init(const struct uniphier_board_data *bd);
71int uniphier_pro4_dpll_init(const struct uniphier_board_data *bd);
72int uniphier_sld8_dpll_init(const struct uniphier_board_data *bd);
Masahiro Yamada8c3aa6b2017-01-15 14:59:09 +090073int uniphier_pro5_dpll_init(const struct uniphier_board_data *bd);
74int uniphier_pxs2_dpll_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090075
Masahiro Yamadad3c14612017-08-13 09:01:13 +090076void uniphier_ld4_early_clk_init(void);
Masahiro Yamadaddb19002017-01-15 14:59:03 +090077
Masahiro Yamadad3c14612017-08-13 09:01:13 +090078void uniphier_ld4_dram_clk_init(void);
Masahiro Yamadaddb19002017-01-15 14:59:03 +090079void uniphier_pro5_dram_clk_init(void);
80void uniphier_pxs2_dram_clk_init(void);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090081
Masahiro Yamada98905692016-03-30 20:17:02 +090082int uniphier_ld4_umc_init(const struct uniphier_board_data *bd);
83int uniphier_pro4_umc_init(const struct uniphier_board_data *bd);
84int uniphier_sld8_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada8c3aa6b2017-01-15 14:59:09 +090085int uniphier_pro5_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada98905692016-03-30 20:17:02 +090086int uniphier_pxs2_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada75f16f82015-09-22 00:27:39 +090087
Masahiro Yamada9d6652c2016-09-17 03:33:09 +090088void uniphier_ld4_pll_init(void);
89void uniphier_pro4_pll_init(void);
Masahiro Yamada090785d2016-09-22 07:42:19 +090090void uniphier_ld11_pll_init(void);
Masahiro Yamada52b14bf2017-01-15 14:59:02 +090091void uniphier_ld20_pll_init(void);
Masahiro Yamada133b1262017-01-21 18:05:31 +090092void uniphier_pxs3_pll_init(void);
Masahiro Yamada9d6652c2016-09-17 03:33:09 +090093
Masahiro Yamada98905692016-03-30 20:17:02 +090094void uniphier_pro4_clk_init(void);
95void uniphier_pro5_clk_init(void);
96void uniphier_pxs2_clk_init(void);
Masahiro Yamada8bbbcbd2016-05-24 21:14:01 +090097void uniphier_ld11_clk_init(void);
Masahiro Yamadab3b1bb72017-02-17 16:17:22 +090098void uniphier_ld20_clk_init(void);
Masahiro Yamada8e0a4502017-05-15 14:26:33 +090099void uniphier_pxs3_clk_init(void);
Masahiro Yamada063eb1e2016-04-21 14:43:18 +0900100
Masahiro Yamadafb092032017-02-14 01:24:26 +0900101unsigned int uniphier_boot_device_raw(void);
Masahiro Yamadaaf198102017-04-20 16:54:43 +0900102int uniphier_have_internal_stm(void);
103int uniphier_boot_from_backend(void);
Masahiro Yamadac21e19a2016-09-17 03:33:04 +0900104int uniphier_pin_init(const char *pinconfig_name);
Masahiro Yamadaee53ea72020-02-14 20:54:40 +0900105
106#ifdef CONFIG_NAND_DENALI
107void uniphier_nand_reset_assert(void);
108#else
109static inline void uniphier_nand_reset_assert(void)
110{
111}
112#endif
Masahiro Yamadaf0f6a802019-07-10 20:07:45 +0900113#ifdef CONFIG_ARM64
114void uniphier_mem_map_init(unsigned long dram_base, unsigned long dram_size);
115#else
116static inline void uniphier_mem_map_init(unsigned long dram_base,
117 unsigned long dram_size)
118{
119}
120#endif
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900121
Masahiro Yamada75f16f82015-09-22 00:27:39 +0900122#endif /* __MACH_INIT_H */