blob: 0c130757110a51e4ea33cd86bbf276f8c0a42134 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
wdenk0157ced2002-10-21 17:04:47 +00002/*
Wolfgang Denkf710efd2010-07-24 20:22:02 +02003 * (C) Copyright 2002-2010
wdenk0157ced2002-10-21 17:04:47 +00004 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
wdenk0157ced2002-10-21 17:04:47 +00005 */
6
7#ifndef __ASM_GBL_DATA_H
8#define __ASM_GBL_DATA_H
Simon Glass3ac47d72012-12-13 20:48:30 +00009
Siew Chin Lim3dbd3492021-02-23 14:34:37 +080010#ifndef __ASSEMBLY__
11
Tom Rini5dc7f612021-06-03 09:39:02 -040012#include <config.h>
13
Simon Glass3ba929a2020-10-30 21:38:53 -060014#include <asm/types.h>
15#include <linux/types.h>
16
Simon Glass3ac47d72012-12-13 20:48:30 +000017/* Architecture-specific global data */
18struct arch_global_data {
Yangbo Lu73340382019-06-21 11:42:28 +080019#if defined(CONFIG_FSL_ESDHC) || defined(CONFIG_FSL_ESDHC_IMX)
Simon Glass9e247d12012-12-13 20:49:05 +000020 u32 sdhc_clk;
21#endif
Zhao Qiang5ad93952014-09-25 13:52:25 +080022
Yangbo Lu0fa68762019-12-19 18:59:28 +080023#if defined(CONFIG_FSL_ESDHC)
24 u32 sdhc_per_clk;
25#endif
26
Zhao Qiang5ad93952014-09-25 13:52:25 +080027#if defined(CONFIG_U_QE)
28 u32 qe_clk;
29 u32 brg_clk;
30 uint mp_alloc_base;
31 uint mp_alloc_top;
32#endif /* CONFIG_U_QE */
33
Simon Glasse61accc2012-12-13 20:48:31 +000034#ifdef CONFIG_AT91FAMILY
35 /* "static data" needed by at91's clock.c */
36 unsigned long cpu_clk_rate_hz;
37 unsigned long main_clk_rate_hz;
38 unsigned long mck_rate_hz;
39 unsigned long plla_rate_hz;
40 unsigned long pllb_rate_hz;
41 unsigned long at91_pllb_usb_init;
42#endif
Simon Glass6ed6e032012-12-13 20:48:32 +000043 /* "static data" needed by most of timer.c on ARM platforms */
44 unsigned long timer_rate_hz;
Peng Fanf2d397b2017-05-09 10:32:02 +080045 unsigned int tbu;
46 unsigned int tbl;
Simon Glassa848da52012-12-13 20:48:35 +000047 unsigned long lastinc;
Simon Glass9cbe003a2012-12-13 20:48:36 +000048 unsigned long long timer_reset_value;
Trevor Woerner43ec7e02019-05-03 09:41:00 -040049#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
Simon Glass6b4ee152012-12-13 20:48:39 +000050 unsigned long tlb_addr;
Alexander Grafe317fe82016-03-04 01:09:47 +010051 unsigned long tlb_size;
Alexander Grafce0a64e2016-03-04 01:09:54 +010052#if defined(CONFIG_ARM64)
Alexander Grafe317fe82016-03-04 01:09:47 +010053 unsigned long tlb_fillptr;
54 unsigned long tlb_emerg;
Marc Zyngierea6c45f2023-03-18 00:22:52 +080055 unsigned int first_block_level;
Marc Zyngier2b156992023-03-18 00:22:51 +080056 bool has_hafdbs;
Sergey Temerkhanov78eaa492015-10-14 09:55:45 -070057#endif
Simon Glass6b4ee152012-12-13 20:48:39 +000058#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050059#ifdef CFG_SYS_MEM_RESERVE_SECURE
York Sun1ef95cc2016-06-24 16:46:18 -070060#define MEM_RESERVE_SECURE_SECURED 0x1
61#define MEM_RESERVE_SECURE_MAINTAINED 0x2
62#define MEM_RESERVE_SECURE_ADDR_MASK (~0x3)
63 /*
64 * Secure memory addr
65 * This variable needs maintenance if the RAM base is not zero,
66 * or if RAM splits into non-consecutive banks. It also has a
67 * flag indicating the secure memory is marked as secure by MMU.
68 * Flags used: 0x1 secured
69 * 0x2 maintained
70 */
71 phys_addr_t secure_ram;
York Sunf84f81e2016-06-24 16:46:19 -070072 unsigned long tlb_allocated;
York Sun1ef95cc2016-06-24 16:46:18 -070073#endif
York Sund6964b32017-03-06 09:02:24 -080074#ifdef CONFIG_RESV_RAM
75 /*
76 * Reserved RAM for memory resident, eg. Management Complex (MC)
77 * driver which continues to run after U-Boot exits.
78 */
79 phys_addr_t resv_ram;
80#endif
SRICHARAN R4af19882013-04-24 00:41:23 +000081
Masahiro Yamada6e1288c2017-04-25 13:10:11 +090082#ifdef CONFIG_ARCH_OMAP2PLUS
Paul Kocialkowskid5b76242015-07-15 16:02:19 +020083 u32 omap_boot_device;
84 u32 omap_boot_mode;
85 u8 omap_ch_flags;
SRICHARAN R4af19882013-04-24 00:41:23 +000086#endif
Prabhakar Kushwaha122bcfd2015-11-09 16:42:07 +053087#if defined(CONFIG_FSL_LSCH3) && defined(CONFIG_SYS_FSL_HAS_DP_DDR)
York Sun1ecab782015-01-06 13:18:49 -080088 unsigned long mem2_clk;
89#endif
Peng Fanf17a0ce2018-10-18 14:28:10 +020090
91#ifdef CONFIG_ARCH_IMX8
92 struct udevice *scu_dev;
93#endif
Ye Li0db17f42021-08-07 16:00:41 +080094
Ye Lic408ed32022-07-26 16:40:49 +080095#ifdef CONFIG_IMX_SENTINEL
Ye Li0db17f42021-08-07 16:00:41 +080096 struct udevice *s400_dev;
Peng Fan3700c472022-07-26 16:40:56 +080097 u32 soc_rev;
98 u32 lifecycle;
99 u32 uid[4];
Ye Li0db17f42021-08-07 16:00:41 +0800100#endif
101
Ye Li80b33152023-01-31 16:42:17 +0800102#ifdef CONFIG_ARCH_IMX8ULP
103 bool m33_handshake_done;
104#endif
Simon Glass3ac47d72012-12-13 20:48:30 +0000105};
106
Simon Glass6878cd12012-12-13 20:49:14 +0000107#include <asm-generic/global_data.h>
wdenk0157ced2002-10-21 17:04:47 +0000108
Simon Glass6c8ec912022-08-03 12:13:08 -0600109#if defined(__clang__) || defined(LTO_ENABLE)
Jeroen Hofstee43614d12014-07-30 21:54:52 +0200110
111#define DECLARE_GLOBAL_DATA_PTR
112#define gd get_gd()
113
114static inline gd_t *get_gd(void)
115{
116 gd_t *gd_ptr;
117
118#ifdef CONFIG_ARM64
Jeroen Hofstee43614d12014-07-30 21:54:52 +0200119 __asm__ volatile("mov %0, x18\n" : "=r" (gd_ptr));
120#else
121 __asm__ volatile("mov %0, r9\n" : "=r" (gd_ptr));
122#endif
123
124 return gd_ptr;
125}
126
127#else
128
David Feng85fd5f12013-12-14 11:47:35 +0800129#ifdef CONFIG_ARM64
130#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("x18")
131#else
132#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r9")
133#endif
Jeroen Hofstee43614d12014-07-30 21:54:52 +0200134#endif
wdenk0157ced2002-10-21 17:04:47 +0000135
Heinrich Schuchardt1a3732c2020-05-27 01:58:30 +0200136static inline void set_gd(volatile gd_t *gd_ptr)
137{
138#ifdef CONFIG_ARM64
139 __asm__ volatile("ldr x18, %0\n" : : "m"(gd_ptr));
Marek BehĂșnc2854e02021-05-20 13:24:09 +0200140#elif __ARM_ARCH >= 7
Heinrich Schuchardt1a3732c2020-05-27 01:58:30 +0200141 __asm__ volatile("ldr r9, %0\n" : : "m"(gd_ptr));
Marek BehĂșnc2854e02021-05-20 13:24:09 +0200142#else
143 __asm__ volatile("mov r9, %0\n" : : "r"(gd_ptr));
Heinrich Schuchardt1a3732c2020-05-27 01:58:30 +0200144#endif
145}
146
Siew Chin Lim3dbd3492021-02-23 14:34:37 +0800147#endif /* __ASSEMBLY__ */
148
wdenk0157ced2002-10-21 17:04:47 +0000149#endif /* __ASM_GBL_DATA_H */