blob: b385bae02669a93eb19a69d35d9a73517c25791f [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
Peng Fand5c31832023-06-15 18:09:05 +080095#ifdef CONFIG_IMX_ELE
96 struct udevice *ele_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 Glass9b388102023-09-19 21:00:15 -0600105#ifdef CONFIG_SMBIOS
106 ulong smbios_start; /* Start address of SMBIOS table */
107#endif
Simon Glass3ac47d72012-12-13 20:48:30 +0000108};
109
Simon Glass6878cd12012-12-13 20:49:14 +0000110#include <asm-generic/global_data.h>
wdenk0157ced2002-10-21 17:04:47 +0000111
Simon Glass6c8ec912022-08-03 12:13:08 -0600112#if defined(__clang__) || defined(LTO_ENABLE)
Jeroen Hofstee43614d12014-07-30 21:54:52 +0200113
114#define DECLARE_GLOBAL_DATA_PTR
115#define gd get_gd()
116
117static inline gd_t *get_gd(void)
118{
119 gd_t *gd_ptr;
120
121#ifdef CONFIG_ARM64
Jeroen Hofstee43614d12014-07-30 21:54:52 +0200122 __asm__ volatile("mov %0, x18\n" : "=r" (gd_ptr));
123#else
124 __asm__ volatile("mov %0, r9\n" : "=r" (gd_ptr));
125#endif
126
127 return gd_ptr;
128}
129
130#else
131
David Feng85fd5f12013-12-14 11:47:35 +0800132#ifdef CONFIG_ARM64
133#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("x18")
134#else
135#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r9")
136#endif
Jeroen Hofstee43614d12014-07-30 21:54:52 +0200137#endif
wdenk0157ced2002-10-21 17:04:47 +0000138
Heinrich Schuchardt1a3732c2020-05-27 01:58:30 +0200139static inline void set_gd(volatile gd_t *gd_ptr)
140{
141#ifdef CONFIG_ARM64
142 __asm__ volatile("ldr x18, %0\n" : : "m"(gd_ptr));
Marek BehĂșnc2854e02021-05-20 13:24:09 +0200143#elif __ARM_ARCH >= 7
Heinrich Schuchardt1a3732c2020-05-27 01:58:30 +0200144 __asm__ volatile("ldr r9, %0\n" : : "m"(gd_ptr));
Marek BehĂșnc2854e02021-05-20 13:24:09 +0200145#else
146 __asm__ volatile("mov r9, %0\n" : : "r"(gd_ptr));
Heinrich Schuchardt1a3732c2020-05-27 01:58:30 +0200147#endif
148}
149
Siew Chin Lim3dbd3492021-02-23 14:34:37 +0800150#endif /* __ASSEMBLY__ */
151
wdenk0157ced2002-10-21 17:04:47 +0000152#endif /* __ASM_GBL_DATA_H */