blob: 1768e3bee80b957d723001bdb9052a791dfdfd3a [file] [log] [blame]
Masahiro Yamada574388c2016-09-03 11:37:40 +09001/*
Masahiro Yamada75bfecb2017-12-19 11:56:05 +09002 * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
Masahiro Yamada574388c2016-09-03 11:37:40 +09003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef __UNIPHIER_H__
8#define __UNIPHIER_H__
9
10#include <stdint.h>
11#include <types.h>
12
13unsigned int uniphier_get_soc_type(void);
14unsigned int uniphier_get_soc_model(void);
15unsigned int uniphier_get_soc_revision(void);
16unsigned int uniphier_get_soc_id(void);
17
18#define UNIPHIER_SOC_LD11 0
19#define UNIPHIER_SOC_LD20 1
20#define UNIPHIER_SOC_PXS3 2
21#define UNIPHIER_SOC_UNKNOWN 0xffffffff
22
23unsigned int uniphier_get_boot_device(unsigned int soc);
24
25#define UNIPHIER_BOOT_DEVICE_EMMC 0
26#define UNIPHIER_BOOT_DEVICE_NAND 1
27#define UNIPHIER_BOOT_DEVICE_NOR 2
28#define UNIPHIER_BOOT_DEVICE_USB 3
29#define UNIPHIER_BOOT_DEVICE_RSV 0xffffffff
30
31unsigned int uniphier_get_boot_master(unsigned int soc);
32
33#define UNIPHIER_BOOT_MASTER_THIS 0
34#define UNIPHIER_BOOT_MASTER_SCP 1
35#define UNIPHIER_BOOT_MASTER_EXT 2
36
37void uniphier_console_setup(void);
38
39int uniphier_emmc_init(uintptr_t *block_dev_spec);
40int uniphier_nand_init(uintptr_t *block_dev_spec);
41int uniphier_usb_init(unsigned int soc, uintptr_t *block_dev_spec);
42
43int uniphier_io_setup(unsigned int soc);
44int uniphier_check_image(unsigned int image_id);
Masahiro Yamada4c91c802018-02-01 21:37:40 +090045
46struct image_info;
47struct image_info *uniphier_get_image_info(unsigned int image_id);
Masahiro Yamada574388c2016-09-03 11:37:40 +090048
49int uniphier_scp_is_running(void);
50void uniphier_scp_start(void);
51void uniphier_scp_open_com(void);
52void uniphier_scp_system_off(void);
53void uniphier_scp_system_reset(void);
54
55struct mmap_region;
56void uniphier_mmap_setup(uintptr_t total_base, size_t total_size,
57 const struct mmap_region *mmap);
58
59void uniphier_cci_init(unsigned int soc);
60void uniphier_cci_enable(void);
61void uniphier_cci_disable(void);
62
63void uniphier_gic_driver_init(unsigned int soc);
64void uniphier_gic_init(void);
65void uniphier_gic_cpuif_enable(void);
66void uniphier_gic_cpuif_disable(void);
67void uniphier_gic_pcpu_init(void);
68
69unsigned int uniphier_calc_core_pos(u_register_t mpidr);
70
71#define UNIPHIER_NS_DRAM_BASE 0x84000000
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090072#define UNIPHIER_NS_DRAM_LIMIT 0x85000000
73#define UNIPHIER_NS_DRAM_SIZE ((UNIPHIER_NS_DRAM_LIMIT) - \
74 (UNIPHIER_NS_DRAM_BASE))
Masahiro Yamada574388c2016-09-03 11:37:40 +090075
76#define UNIPHIER_BL33_BASE (UNIPHIER_NS_DRAM_BASE)
77#define UNIPHIER_BL33_MAX_SIZE 0x00100000
78
79#define UNIPHIER_SCP_BASE ((UNIPHIER_BL33_BASE) + \
80 (UNIPHIER_BL33_MAX_SIZE))
81#define UNIPHIER_SCP_MAX_SIZE 0x00020000
82
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090083#define UNIPHIER_BLOCK_BUF_BASE ((UNIPHIER_SCP_BASE) + \
84 (UNIPHIER_SCP_MAX_SIZE))
Masahiro Yamada4ff71af2018-01-26 11:42:01 +090085#define UNIPHIER_BLOCK_BUF_SIZE 0x00100000
86
87#define UNIPHIER_IMAGE_BUF_BASE ((UNIPHIER_BLOCK_BUF_BASE) + \
88 (UNIPHIER_BLOCK_BUF_SIZE))
89#define UNIPHIER_IMAGE_BUF_SIZE ((UNIPHIER_NS_DRAM_LIMIT) - \
90 (UNIPHIER_IMAGE_BUF_BASE))
Masahiro Yamada75bfecb2017-12-19 11:56:05 +090091
Masahiro Yamada574388c2016-09-03 11:37:40 +090092#endif /* __UNIPHIER_H__ */