blob: 452bcd1b8fd91d42f62f69e4a624d3c458320064 [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 <linux/types.h>
15
Simon Glass3ac47d72012-12-13 20:48:30 +000016/* Architecture-specific global data */
17struct arch_global_data {
Yangbo Lu73340382019-06-21 11:42:28 +080018#if defined(CONFIG_FSL_ESDHC) || defined(CONFIG_FSL_ESDHC_IMX)
Simon Glass9e247d12012-12-13 20:49:05 +000019 u32 sdhc_clk;
20#endif
Heinrich Schuchardtb10571a2023-12-19 16:04:02 +010021#if CONFIG_IS_ENABLED(ACPI)
22 ulong table_start; /* Start address of ACPI tables */
23 ulong table_end; /* End address of ACPI tables */
24 ulong table_start_high; /* Start address of high ACPI tables */
25 ulong table_end_high; /* End address of high ACPI tables */
26#endif
Yangbo Lu0fa68762019-12-19 18:59:28 +080027#if defined(CONFIG_FSL_ESDHC)
28 u32 sdhc_per_clk;
29#endif
30
Zhao Qiang5ad93952014-09-25 13:52:25 +080031#if defined(CONFIG_U_QE)
32 u32 qe_clk;
33 u32 brg_clk;
34 uint mp_alloc_base;
35 uint mp_alloc_top;
36#endif /* CONFIG_U_QE */
37
Simon Glasse61accc2012-12-13 20:48:31 +000038#ifdef CONFIG_AT91FAMILY
39 /* "static data" needed by at91's clock.c */
40 unsigned long cpu_clk_rate_hz;
41 unsigned long main_clk_rate_hz;
42 unsigned long mck_rate_hz;
43 unsigned long plla_rate_hz;
44 unsigned long pllb_rate_hz;
45 unsigned long at91_pllb_usb_init;
46#endif
Simon Glass6ed6e032012-12-13 20:48:32 +000047 /* "static data" needed by most of timer.c on ARM platforms */
48 unsigned long timer_rate_hz;
Peng Fanf2d397b2017-05-09 10:32:02 +080049 unsigned int tbu;
50 unsigned int tbl;
Simon Glassa848da52012-12-13 20:48:35 +000051 unsigned long lastinc;
Simon Glass9cbe003a2012-12-13 20:48:36 +000052 unsigned long long timer_reset_value;
Trevor Woerner43ec7e02019-05-03 09:41:00 -040053#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
Simon Glass6b4ee152012-12-13 20:48:39 +000054 unsigned long tlb_addr;
Alexander Grafe317fe82016-03-04 01:09:47 +010055 unsigned long tlb_size;
Alexander Grafce0a64e2016-03-04 01:09:54 +010056#if defined(CONFIG_ARM64)
Alexander Grafe317fe82016-03-04 01:09:47 +010057 unsigned long tlb_fillptr;
58 unsigned long tlb_emerg;
Sergey Temerkhanov78eaa492015-10-14 09:55:45 -070059#endif
Simon Glass6b4ee152012-12-13 20:48:39 +000060#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050061#ifdef CFG_SYS_MEM_RESERVE_SECURE
York Sun1ef95cc2016-06-24 16:46:18 -070062#define MEM_RESERVE_SECURE_SECURED 0x1
63#define MEM_RESERVE_SECURE_MAINTAINED 0x2
64#define MEM_RESERVE_SECURE_ADDR_MASK (~0x3)
65 /*
66 * Secure memory addr
67 * This variable needs maintenance if the RAM base is not zero,
68 * or if RAM splits into non-consecutive banks. It also has a
69 * flag indicating the secure memory is marked as secure by MMU.
70 * Flags used: 0x1 secured
71 * 0x2 maintained
72 */
73 phys_addr_t secure_ram;
York Sunf84f81e2016-06-24 16:46:19 -070074 unsigned long tlb_allocated;
York Sun1ef95cc2016-06-24 16:46:18 -070075#endif
York Sund6964b32017-03-06 09:02:24 -080076#ifdef CONFIG_RESV_RAM
77 /*
78 * Reserved RAM for memory resident, eg. Management Complex (MC)
79 * driver which continues to run after U-Boot exits.
80 */
81 phys_addr_t resv_ram;
82#endif
SRICHARAN R4af19882013-04-24 00:41:23 +000083
Masahiro Yamada6e1288c2017-04-25 13:10:11 +090084#ifdef CONFIG_ARCH_OMAP2PLUS
Paul Kocialkowskid5b76242015-07-15 16:02:19 +020085 u32 omap_boot_device;
86 u32 omap_boot_mode;
87 u8 omap_ch_flags;
SRICHARAN R4af19882013-04-24 00:41:23 +000088#endif
Prabhakar Kushwaha122bcfd2015-11-09 16:42:07 +053089#if defined(CONFIG_FSL_LSCH3) && defined(CONFIG_SYS_FSL_HAS_DP_DDR)
York Sun1ecab782015-01-06 13:18:49 -080090 unsigned long mem2_clk;
91#endif
Peng Fanf17a0ce2018-10-18 14:28:10 +020092
93#ifdef CONFIG_ARCH_IMX8
94 struct udevice *scu_dev;
95#endif
Ye Li0db17f42021-08-07 16:00:41 +080096
Peng Fand5c31832023-06-15 18:09:05 +080097#ifdef CONFIG_IMX_ELE
98 struct udevice *ele_dev;
Peng Fan3700c472022-07-26 16:40:56 +080099 u32 soc_rev;
100 u32 lifecycle;
101 u32 uid[4];
Ye Li0db17f42021-08-07 16:00:41 +0800102#endif
103
Ye Li80b33152023-01-31 16:42:17 +0800104#ifdef CONFIG_ARCH_IMX8ULP
105 bool m33_handshake_done;
106#endif
Simon Glass9b388102023-09-19 21:00:15 -0600107#ifdef CONFIG_SMBIOS
108 ulong smbios_start; /* Start address of SMBIOS table */
109#endif
Simon Glass3ac47d72012-12-13 20:48:30 +0000110};
111
Simon Glass6878cd12012-12-13 20:49:14 +0000112#include <asm-generic/global_data.h>
wdenk0157ced2002-10-21 17:04:47 +0000113
Simon Glass6c8ec912022-08-03 12:13:08 -0600114#if defined(__clang__) || defined(LTO_ENABLE)
Jeroen Hofstee43614d12014-07-30 21:54:52 +0200115
116#define DECLARE_GLOBAL_DATA_PTR
117#define gd get_gd()
118
119static inline gd_t *get_gd(void)
120{
121 gd_t *gd_ptr;
122
123#ifdef CONFIG_ARM64
Jeroen Hofstee43614d12014-07-30 21:54:52 +0200124 __asm__ volatile("mov %0, x18\n" : "=r" (gd_ptr));
125#else
126 __asm__ volatile("mov %0, r9\n" : "=r" (gd_ptr));
127#endif
128
129 return gd_ptr;
130}
131
132#else
133
David Feng85fd5f12013-12-14 11:47:35 +0800134#ifdef CONFIG_ARM64
135#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("x18")
136#else
137#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r9")
138#endif
Jeroen Hofstee43614d12014-07-30 21:54:52 +0200139#endif
wdenk0157ced2002-10-21 17:04:47 +0000140
Heinrich Schuchardt1a3732c2020-05-27 01:58:30 +0200141static inline void set_gd(volatile gd_t *gd_ptr)
142{
143#ifdef CONFIG_ARM64
144 __asm__ volatile("ldr x18, %0\n" : : "m"(gd_ptr));
Marek BehĂșnc2854e02021-05-20 13:24:09 +0200145#elif __ARM_ARCH >= 7
Heinrich Schuchardt1a3732c2020-05-27 01:58:30 +0200146 __asm__ volatile("ldr r9, %0\n" : : "m"(gd_ptr));
Marek BehĂșnc2854e02021-05-20 13:24:09 +0200147#else
148 __asm__ volatile("mov r9, %0\n" : : "r"(gd_ptr));
Heinrich Schuchardt1a3732c2020-05-27 01:58:30 +0200149#endif
150}
151
Siew Chin Lim3dbd3492021-02-23 14:34:37 +0800152#endif /* __ASSEMBLY__ */
153
wdenk0157ced2002-10-21 17:04:47 +0000154#endif /* __ASM_GBL_DATA_H */