lowlevel_init.S 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Board specific setup info
  4. *
  5. * (C) Copyright 2010
  6. * Texas Instruments, <www.ti.com>
  7. *
  8. * Author :
  9. * Aneesh V <aneesh@ti.com>
  10. */
  11. #include <config.h>
  12. #include <asm/arch/omap.h>
  13. #include <asm/omap_common.h>
  14. #include <asm/arch/spl.h>
  15. #include <linux/linkage.h>
  16. .arch_extension sec
  17. #ifdef CONFIG_SPL
  18. ENTRY(save_boot_params)
  19. ldr r1, =OMAP_SRAM_SCRATCH_BOOT_PARAMS
  20. str r0, [r1]
  21. b save_boot_params_ret
  22. ENDPROC(save_boot_params)
  23. #if !defined(CONFIG_TI_SECURE_DEVICE) && defined(CONFIG_ARMV7_LPAE)
  24. ENTRY(switch_to_hypervisor)
  25. /*
  26. * Switch to hypervisor mode
  27. */
  28. adr r0, save_sp
  29. str sp, [r0]
  30. adr r1, restore_from_hyp
  31. ldr r0, =0x102
  32. b omap_smc1
  33. restore_from_hyp:
  34. adr r0, save_sp
  35. ldr sp, [r0]
  36. MRC p15, 4, R0, c1, c0, 0
  37. ldr r1, =0X1004 @Set cache enable bits for hypervisor mode
  38. orr r0, r0, r1
  39. MCR p15, 4, R0, c1, c0, 0
  40. b switch_to_hypervisor_ret
  41. save_sp:
  42. .word 0x0
  43. ENDPROC(switch_to_hypervisor)
  44. #endif
  45. #endif
  46. ENTRY(omap_smc1)
  47. push {r4-r12, lr} @ save registers - ROM code may pollute
  48. @ our registers
  49. mov r12, r0 @ Service
  50. mov r0, r1 @ Argument
  51. dsb
  52. dmb
  53. smc 0 @ SMC #0 to enter monitor mode
  54. @ call ROM Code API for the service requested
  55. pop {r4-r12, pc}
  56. ENDPROC(omap_smc1)
  57. ENTRY(omap_smc_sec)
  58. push {r4-r12, lr} @ save registers - ROM code may pollute
  59. @ our registers
  60. mov r6, #0xFF @ Indicate new Task call
  61. mov r12, #0x00 @ Secure Service ID in R12
  62. dsb
  63. dmb
  64. smc 0 @ SMC #0 to enter monitor mode
  65. b omap_smc_sec_end @ exit at end of the service execution
  66. nop
  67. @ In case of IRQ happening in Secure, then ARM will branch here.
  68. @ At that moment, IRQ will be pending and ARM will jump to Non Secure
  69. @ IRQ handler
  70. mov r12, #0xFE
  71. dsb
  72. dmb
  73. smc 0 @ SMC #0 to enter monitor mode
  74. omap_smc_sec_end:
  75. pop {r4-r12, pc}
  76. ENDPROC(omap_smc_sec)