blob: 09f352269e53a27474320b62b644196aaf539783 [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;
Sergey Temerkhanov78eaa492015-10-14 09:55:45 -070055#endif
Simon Glass6b4ee152012-12-13 20:48:39 +000056#endif
York Sun1ef95cc2016-06-24 16:46:18 -070057#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
58#define MEM_RESERVE_SECURE_SECURED 0x1
59#define MEM_RESERVE_SECURE_MAINTAINED 0x2
60#define MEM_RESERVE_SECURE_ADDR_MASK (~0x3)
61 /*
62 * Secure memory addr
63 * This variable needs maintenance if the RAM base is not zero,
64 * or if RAM splits into non-consecutive banks. It also has a
65 * flag indicating the secure memory is marked as secure by MMU.
66 * Flags used: 0x1 secured
67 * 0x2 maintained
68 */
69 phys_addr_t secure_ram;
York Sunf84f81e2016-06-24 16:46:19 -070070 unsigned long tlb_allocated;
York Sun1ef95cc2016-06-24 16:46:18 -070071#endif
York Sund6964b32017-03-06 09:02:24 -080072#ifdef CONFIG_RESV_RAM
73 /*
74 * Reserved RAM for memory resident, eg. Management Complex (MC)
75 * driver which continues to run after U-Boot exits.
76 */
77 phys_addr_t resv_ram;
78#endif
SRICHARAN R4af19882013-04-24 00:41:23 +000079
Masahiro Yamada6e1288c2017-04-25 13:10:11 +090080#ifdef CONFIG_ARCH_OMAP2PLUS
Paul Kocialkowskid5b76242015-07-15 16:02:19 +020081 u32 omap_boot_device;
82 u32 omap_boot_mode;
83 u8 omap_ch_flags;
SRICHARAN R4af19882013-04-24 00:41:23 +000084#endif
Prabhakar Kushwaha122bcfd2015-11-09 16:42:07 +053085#if defined(CONFIG_FSL_LSCH3) && defined(CONFIG_SYS_FSL_HAS_DP_DDR)
York Sun1ecab782015-01-06 13:18:49 -080086 unsigned long mem2_clk;
87#endif
Peng Fanf17a0ce2018-10-18 14:28:10 +020088
89#ifdef CONFIG_ARCH_IMX8
90 struct udevice *scu_dev;
91#endif
Ye Li0db17f42021-08-07 16:00:41 +080092
Ye Lic408ed32022-07-26 16:40:49 +080093#ifdef CONFIG_IMX_SENTINEL
Ye Li0db17f42021-08-07 16:00:41 +080094 struct udevice *s400_dev;
95#endif
96
Simon Glass3ac47d72012-12-13 20:48:30 +000097};
98
Simon Glass6878cd12012-12-13 20:49:14 +000099#include <asm-generic/global_data.h>
wdenk0157ced2002-10-21 17:04:47 +0000100
Marek Behúna8cf1552021-05-20 13:24:10 +0200101#if defined(__clang__) || defined(CONFIG_LTO)
Jeroen Hofstee43614d12014-07-30 21:54:52 +0200102
103#define DECLARE_GLOBAL_DATA_PTR
104#define gd get_gd()
105
106static inline gd_t *get_gd(void)
107{
108 gd_t *gd_ptr;
109
110#ifdef CONFIG_ARM64
Jeroen Hofstee43614d12014-07-30 21:54:52 +0200111 __asm__ volatile("mov %0, x18\n" : "=r" (gd_ptr));
112#else
113 __asm__ volatile("mov %0, r9\n" : "=r" (gd_ptr));
114#endif
115
116 return gd_ptr;
117}
118
119#else
120
David Feng85fd5f12013-12-14 11:47:35 +0800121#ifdef CONFIG_ARM64
122#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("x18")
123#else
124#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r9")
125#endif
Jeroen Hofstee43614d12014-07-30 21:54:52 +0200126#endif
wdenk0157ced2002-10-21 17:04:47 +0000127
Heinrich Schuchardt1a3732c2020-05-27 01:58:30 +0200128static inline void set_gd(volatile gd_t *gd_ptr)
129{
130#ifdef CONFIG_ARM64
131 __asm__ volatile("ldr x18, %0\n" : : "m"(gd_ptr));
Marek Behúnc2854e02021-05-20 13:24:09 +0200132#elif __ARM_ARCH >= 7
Heinrich Schuchardt1a3732c2020-05-27 01:58:30 +0200133 __asm__ volatile("ldr r9, %0\n" : : "m"(gd_ptr));
Marek Behúnc2854e02021-05-20 13:24:09 +0200134#else
135 __asm__ volatile("mov r9, %0\n" : : "r"(gd_ptr));
Heinrich Schuchardt1a3732c2020-05-27 01:58:30 +0200136#endif
137}
138
Siew Chin Lim3dbd3492021-02-23 14:34:37 +0800139#endif /* __ASSEMBLY__ */
140
wdenk0157ced2002-10-21 17:04:47 +0000141#endif /* __ASM_GBL_DATA_H */