lowlevel_init_gen3.S 1.6 KB

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