global_data.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * (C) Copyright 2002-2010
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef __ASM_GBL_DATA_H
  8. #define __ASM_GBL_DATA_H
  9. #ifdef CONFIG_OMAP
  10. #include <asm/omap_boot.h>
  11. #endif
  12. /* Architecture-specific global data */
  13. struct arch_global_data {
  14. #if defined(CONFIG_FSL_ESDHC)
  15. u32 sdhc_clk;
  16. #endif
  17. #if defined(CONFIG_U_QE)
  18. u32 qe_clk;
  19. u32 brg_clk;
  20. uint mp_alloc_base;
  21. uint mp_alloc_top;
  22. #endif /* CONFIG_U_QE */
  23. #ifdef CONFIG_AT91FAMILY
  24. /* "static data" needed by at91's clock.c */
  25. unsigned long cpu_clk_rate_hz;
  26. unsigned long main_clk_rate_hz;
  27. unsigned long mck_rate_hz;
  28. unsigned long plla_rate_hz;
  29. unsigned long pllb_rate_hz;
  30. unsigned long at91_pllb_usb_init;
  31. #endif
  32. /* "static data" needed by most of timer.c on ARM platforms */
  33. unsigned long timer_rate_hz;
  34. unsigned long tbu;
  35. unsigned long tbl;
  36. unsigned long lastinc;
  37. unsigned long long timer_reset_value;
  38. #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
  39. unsigned long tlb_addr;
  40. unsigned long tlb_size;
  41. #endif
  42. #ifdef CONFIG_OMAP
  43. struct omap_boot_parameters omap_boot_params;
  44. #endif
  45. };
  46. #include <asm-generic/global_data.h>
  47. #ifdef __clang__
  48. #define DECLARE_GLOBAL_DATA_PTR
  49. #define gd get_gd()
  50. static inline gd_t *get_gd(void)
  51. {
  52. gd_t *gd_ptr;
  53. #ifdef CONFIG_ARM64
  54. /*
  55. * Make will already error that reserving x18 is not supported at the
  56. * time of writing, clang: error: unknown argument: '-ffixed-x18'
  57. */
  58. __asm__ volatile("mov %0, x18\n" : "=r" (gd_ptr));
  59. #else
  60. __asm__ volatile("mov %0, r9\n" : "=r" (gd_ptr));
  61. #endif
  62. return gd_ptr;
  63. }
  64. #else
  65. #ifdef CONFIG_ARM64
  66. #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("x18")
  67. #else
  68. #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r9")
  69. #endif
  70. #endif
  71. #endif /* __ASM_GBL_DATA_H */