blob: 7c0905d240eb4fde666929ed2c5d5ee5f6e37894 [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
10/* Architecture-specific global data */
11struct arch_global_data {
Yangbo Lu73340382019-06-21 11:42:28 +080012#if defined(CONFIG_FSL_ESDHC) || defined(CONFIG_FSL_ESDHC_IMX)
Simon Glass9e247d12012-12-13 20:49:05 +000013 u32 sdhc_clk;
14#endif
Zhao Qiang5ad93952014-09-25 13:52:25 +080015
Yangbo Lu0fa68762019-12-19 18:59:28 +080016#if defined(CONFIG_FSL_ESDHC)
17 u32 sdhc_per_clk;
18#endif
19
Zhao Qiang5ad93952014-09-25 13:52:25 +080020#if defined(CONFIG_U_QE)
21 u32 qe_clk;
22 u32 brg_clk;
23 uint mp_alloc_base;
24 uint mp_alloc_top;
25#endif /* CONFIG_U_QE */
26
Simon Glasse61accc2012-12-13 20:48:31 +000027#ifdef CONFIG_AT91FAMILY
28 /* "static data" needed by at91's clock.c */
29 unsigned long cpu_clk_rate_hz;
30 unsigned long main_clk_rate_hz;
31 unsigned long mck_rate_hz;
32 unsigned long plla_rate_hz;
33 unsigned long pllb_rate_hz;
34 unsigned long at91_pllb_usb_init;
35#endif
Simon Glass6ed6e032012-12-13 20:48:32 +000036 /* "static data" needed by most of timer.c on ARM platforms */
37 unsigned long timer_rate_hz;
Peng Fanf2d397b2017-05-09 10:32:02 +080038 unsigned int tbu;
39 unsigned int tbl;
Simon Glassa848da52012-12-13 20:48:35 +000040 unsigned long lastinc;
Simon Glass9cbe003a2012-12-13 20:48:36 +000041 unsigned long long timer_reset_value;
Trevor Woerner43ec7e02019-05-03 09:41:00 -040042#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
Simon Glass6b4ee152012-12-13 20:48:39 +000043 unsigned long tlb_addr;
Alexander Grafe317fe82016-03-04 01:09:47 +010044 unsigned long tlb_size;
Alexander Grafce0a64e2016-03-04 01:09:54 +010045#if defined(CONFIG_ARM64)
Alexander Grafe317fe82016-03-04 01:09:47 +010046 unsigned long tlb_fillptr;
47 unsigned long tlb_emerg;
Sergey Temerkhanov78eaa492015-10-14 09:55:45 -070048#endif
Simon Glass6b4ee152012-12-13 20:48:39 +000049#endif
York Sun1ef95cc2016-06-24 16:46:18 -070050#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
51#define MEM_RESERVE_SECURE_SECURED 0x1
52#define MEM_RESERVE_SECURE_MAINTAINED 0x2
53#define MEM_RESERVE_SECURE_ADDR_MASK (~0x3)
54 /*
55 * Secure memory addr
56 * This variable needs maintenance if the RAM base is not zero,
57 * or if RAM splits into non-consecutive banks. It also has a
58 * flag indicating the secure memory is marked as secure by MMU.
59 * Flags used: 0x1 secured
60 * 0x2 maintained
61 */
62 phys_addr_t secure_ram;
York Sunf84f81e2016-06-24 16:46:19 -070063 unsigned long tlb_allocated;
York Sun1ef95cc2016-06-24 16:46:18 -070064#endif
York Sund6964b32017-03-06 09:02:24 -080065#ifdef CONFIG_RESV_RAM
66 /*
67 * Reserved RAM for memory resident, eg. Management Complex (MC)
68 * driver which continues to run after U-Boot exits.
69 */
70 phys_addr_t resv_ram;
71#endif
SRICHARAN R4af19882013-04-24 00:41:23 +000072
Masahiro Yamada6e1288c2017-04-25 13:10:11 +090073#ifdef CONFIG_ARCH_OMAP2PLUS
Paul Kocialkowskid5b76242015-07-15 16:02:19 +020074 u32 omap_boot_device;
75 u32 omap_boot_mode;
76 u8 omap_ch_flags;
SRICHARAN R4af19882013-04-24 00:41:23 +000077#endif
Prabhakar Kushwaha122bcfd2015-11-09 16:42:07 +053078#if defined(CONFIG_FSL_LSCH3) && defined(CONFIG_SYS_FSL_HAS_DP_DDR)
York Sun1ecab782015-01-06 13:18:49 -080079 unsigned long mem2_clk;
80#endif
Peng Fanf17a0ce2018-10-18 14:28:10 +020081
82#ifdef CONFIG_ARCH_IMX8
83 struct udevice *scu_dev;
84#endif
Simon Glass3ac47d72012-12-13 20:48:30 +000085};
86
Simon Glass6878cd12012-12-13 20:49:14 +000087#include <asm-generic/global_data.h>
wdenk0157ced2002-10-21 17:04:47 +000088
Jeroen Hofstee43614d12014-07-30 21:54:52 +020089#ifdef __clang__
90
91#define DECLARE_GLOBAL_DATA_PTR
92#define gd get_gd()
93
94static inline gd_t *get_gd(void)
95{
96 gd_t *gd_ptr;
97
98#ifdef CONFIG_ARM64
99 /*
100 * Make will already error that reserving x18 is not supported at the
101 * time of writing, clang: error: unknown argument: '-ffixed-x18'
102 */
103 __asm__ volatile("mov %0, x18\n" : "=r" (gd_ptr));
104#else
105 __asm__ volatile("mov %0, r9\n" : "=r" (gd_ptr));
106#endif
107
108 return gd_ptr;
109}
110
111#else
112
David Feng85fd5f12013-12-14 11:47:35 +0800113#ifdef CONFIG_ARM64
114#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("x18")
115#else
116#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r9")
117#endif
Jeroen Hofstee43614d12014-07-30 21:54:52 +0200118#endif
wdenk0157ced2002-10-21 17:04:47 +0000119
Heinrich Schuchardt1a3732c2020-05-27 01:58:30 +0200120static inline void set_gd(volatile gd_t *gd_ptr)
121{
122#ifdef CONFIG_ARM64
123 __asm__ volatile("ldr x18, %0\n" : : "m"(gd_ptr));
124#else
125 __asm__ volatile("ldr r9, %0\n" : : "m"(gd_ptr));
126#endif
127}
128
wdenk0157ced2002-10-21 17:04:47 +0000129#endif /* __ASM_GBL_DATA_H */