lowlevel_init_gen3.S 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * arch/arm/cpu/armv8/rcar_gen3/lowlevel_init.S
  4. * This file is lowlevel initialize routine.
  5. *
  6. * (C) Copyright 2015 Renesas Electronics Corporation
  7. *
  8. * This file is based on the arch/arm/cpu/armv8/start.S
  9. *
  10. * (C) Copyright 2013
  11. * David Feng <fenghua@phytium.com.cn>
  12. */
  13. #include <asm-offsets.h>
  14. #include <config.h>
  15. #include <linux/linkage.h>
  16. #include <asm/macro.h>
  17. ENTRY(lowlevel_init)
  18. mov x29, lr /* Save LR */
  19. #ifndef CONFIG_ARMV8_MULTIENTRY
  20. /*
  21. * For single-entry systems the lowlevel init is very simple.
  22. */
  23. ldr x0, =GICD_BASE
  24. bl gic_init_secure
  25. #else /* CONFIG_ARMV8_MULTIENTRY is set */
  26. #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3)
  27. branch_if_slave x0, 1f
  28. ldr x0, =GICD_BASE
  29. bl gic_init_secure
  30. 1:
  31. #if defined(CONFIG_GICV3)
  32. ldr x0, =GICR_BASE
  33. bl gic_init_secure_percpu
  34. #elif defined(CONFIG_GICV2)
  35. ldr x0, =GICD_BASE
  36. ldr x1, =GICC_BASE
  37. bl gic_init_secure_percpu
  38. #endif
  39. #endif
  40. branch_if_master x0, x1, 2f
  41. /*
  42. * Slave should wait for master clearing spin table.
  43. * This sync prevent salves observing incorrect
  44. * value of spin table and jumping to wrong place.
  45. */
  46. #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3)
  47. #ifdef CONFIG_GICV2
  48. ldr x0, =GICC_BASE
  49. #endif
  50. bl gic_wait_for_interrupt
  51. #endif
  52. /*
  53. * All slaves will enter EL2 and optionally EL1.
  54. */
  55. adr x4, lowlevel_in_el2
  56. ldr x5, =ES_TO_AARCH64
  57. bl armv8_switch_to_el2
  58. lowlevel_in_el2:
  59. #ifdef CONFIG_ARMV8_SWITCH_TO_EL1
  60. adr x4, lowlevel_in_el1
  61. ldr x5, =ES_TO_AARCH64
  62. bl armv8_switch_to_el1
  63. lowlevel_in_el1:
  64. #endif
  65. #endif /* CONFIG_ARMV8_MULTIENTRY */
  66. bl s_init
  67. 2:
  68. mov lr, x29 /* Restore LR */
  69. ret
  70. ENDPROC(lowlevel_init)