blob: dd978c02080454966f1c507809983cd250c99ff0 [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
Simon Glasscd93d622020-05-10 11:40:13 -060010#include <linux/bitops.h>
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 {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090016 unsigned long size;
17 unsigned int width;
18};
19
Masahiro Yamada323d1f92015-09-22 00:27:39 +090020struct uniphier_board_data {
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090021 unsigned int dram_freq;
Masahiro Yamada46abfcc2016-02-26 14:21:34 +090022 struct uniphier_dram_ch dram_ch[UNIPHIER_MAX_NR_DRAM_CH];
Masahiro Yamadaa74c28a2016-07-22 13:38:32 +090023 unsigned int flags;
Masahiro Yamadaf6bbec32016-09-14 01:06:10 +090024
Masahiro Yamada04cd4e72017-02-05 10:52:12 +090025#define UNIPHIER_BD_DRAM_SPARSE BIT(9)
26#define UNIPHIER_BD_DDR3PLUS BIT(8)
Masahiro Yamada323d1f92015-09-22 00:27:39 +090027};
28
Masahiro Yamada6ba60fa2015-12-17 17:47:42 +090029const struct uniphier_board_data *uniphier_get_board_param(void);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090030
Masahiro Yamada5b660062016-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 Yamada323d1f92015-09-22 00:27:39 +090036
Masahiro Yamadae94842f2017-01-15 14:59:07 +090037void uniphier_ld4_bcu_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090038
Masahiro Yamada8d6c99c2017-01-15 14:59:04 +090039int uniphier_memconf_2ch_init(const struct uniphier_board_data *bd);
Masahiro Yamada8d6c99c2017-01-15 14:59:04 +090040int uniphier_memconf_3ch_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090041
Masahiro Yamada6a3e4272016-09-17 03:33:09 +090042int uniphier_ld4_dpll_init(const struct uniphier_board_data *bd);
43int uniphier_pro4_dpll_init(const struct uniphier_board_data *bd);
44int uniphier_sld8_dpll_init(const struct uniphier_board_data *bd);
Masahiro Yamadaa8e63002017-01-15 14:59:09 +090045int uniphier_pro5_dpll_init(const struct uniphier_board_data *bd);
46int uniphier_pxs2_dpll_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090047
Masahiro Yamada00aa4532017-08-13 09:01:13 +090048void uniphier_ld4_early_clk_init(void);
Masahiro Yamada78c627c2017-01-15 14:59:03 +090049
Masahiro Yamada00aa4532017-08-13 09:01:13 +090050void uniphier_ld4_dram_clk_init(void);
Masahiro Yamada78c627c2017-01-15 14:59:03 +090051void uniphier_pro5_dram_clk_init(void);
52void uniphier_pxs2_dram_clk_init(void);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090053
Masahiro Yamada5b660062016-03-30 20:17:02 +090054int uniphier_ld4_umc_init(const struct uniphier_board_data *bd);
55int uniphier_pro4_umc_init(const struct uniphier_board_data *bd);
56int uniphier_sld8_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamadaa8e63002017-01-15 14:59:09 +090057int uniphier_pro5_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada5b660062016-03-30 20:17:02 +090058int uniphier_pxs2_umc_init(const struct uniphier_board_data *bd);
Masahiro Yamada323d1f92015-09-22 00:27:39 +090059
Masahiro Yamada6a3e4272016-09-17 03:33:09 +090060void uniphier_ld4_pll_init(void);
61void uniphier_pro4_pll_init(void);
Masahiro Yamadac72f4d42016-09-22 07:42:19 +090062void uniphier_ld11_pll_init(void);
Masahiro Yamadaa314a242017-01-15 14:59:02 +090063void uniphier_ld20_pll_init(void);
Masahiro Yamada2c2ab3d2017-01-21 18:05:31 +090064void uniphier_pxs3_pll_init(void);
Masahiro Yamada6a3e4272016-09-17 03:33:09 +090065
Masahiro Yamada5b660062016-03-30 20:17:02 +090066void uniphier_pro4_clk_init(void);
67void uniphier_pro5_clk_init(void);
68void uniphier_pxs2_clk_init(void);
Masahiro Yamada667dbcd2016-05-24 21:14:01 +090069void uniphier_ld11_clk_init(void);
Masahiro Yamadac21f5852017-02-17 16:17:22 +090070void uniphier_ld20_clk_init(void);
Masahiro Yamada81afa9c2017-05-15 14:26:33 +090071void uniphier_pxs3_clk_init(void);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +090072
Masahiro Yamada784548e2017-02-14 01:24:26 +090073unsigned int uniphier_boot_device_raw(void);
Masahiro Yamada63754842017-04-20 16:54:43 +090074int uniphier_have_internal_stm(void);
75int uniphier_boot_from_backend(void);
Masahiro Yamada5ac9dfb2016-09-17 03:33:04 +090076int uniphier_pin_init(const char *pinconfig_name);
Masahiro Yamadace4e9ff2020-02-14 20:54:40 +090077
Masahiro Yamada34e29f72019-07-10 20:07:45 +090078#ifdef CONFIG_ARM64
79void uniphier_mem_map_init(unsigned long dram_base, unsigned long dram_size);
80#else
81static inline void uniphier_mem_map_init(unsigned long dram_base,
82 unsigned long dram_size)
83{
84}
85#endif
Masahiro Yamada323d1f92015-09-22 00:27:39 +090086
Masahiro Yamada323d1f92015-09-22 00:27:39 +090087#endif /* __MACH_INIT_H */