start.S 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <asm-offsets.h>
  7. #include <config.h>
  8. #include <linux/linkage.h>
  9. #include <asm/arcregs.h>
  10. ENTRY(_start)
  11. ; ARCompact devices are not supposed to be SMP so master/slave check
  12. ; makes no sense.
  13. #ifdef CONFIG_ISA_ARCV2
  14. ; Non-masters will be halted immediately, they might be kicked later
  15. ; by platform code right before passing control to the Linux kernel
  16. ; in bootm.c:boot_jump_linux().
  17. lr r5, [identity]
  18. lsr r5, r5, 8
  19. bmsk r5, r5, 7
  20. cmp r5, 0
  21. mov.nz r0, r5
  22. bz .Lmaster_proceed
  23. flag 1
  24. nop
  25. nop
  26. nop
  27. .Lmaster_proceed:
  28. #endif
  29. /* Setup interrupt vector base that matches "__text_start" */
  30. sr __ivt_start, [ARC_AUX_INTR_VEC_BASE]
  31. ; Disable/enable I-cache according to configuration
  32. lr r5, [ARC_BCR_IC_BUILD]
  33. breq r5, 0, 1f ; I$ doesn't exist
  34. lr r5, [ARC_AUX_IC_CTRL]
  35. #ifndef CONFIG_SYS_ICACHE_OFF
  36. bclr r5, r5, 0 ; 0 - Enable, 1 is Disable
  37. #else
  38. bset r5, r5, 0 ; I$ exists, but is not used
  39. #endif
  40. sr r5, [ARC_AUX_IC_CTRL]
  41. 1:
  42. ; Disable/enable D-cache according to configuration
  43. lr r5, [ARC_BCR_DC_BUILD]
  44. breq r5, 0, 1f ; D$ doesn't exist
  45. lr r5, [ARC_AUX_DC_CTRL]
  46. bclr r5, r5, 6 ; Invalidate (discard w/o wback)
  47. #ifndef CONFIG_SYS_DCACHE_OFF
  48. bclr r5, r5, 0 ; Enable (+Inv)
  49. #else
  50. bset r5, r5, 0 ; Disable (+Inv)
  51. #endif
  52. sr r5, [ARC_AUX_DC_CTRL]
  53. 1:
  54. #ifdef CONFIG_ISA_ARCV2
  55. ; Disable System-Level Cache (SLC)
  56. lr r5, [ARC_BCR_SLC]
  57. breq r5, 0, 1f ; SLC doesn't exist
  58. lr r5, [ARC_AUX_SLC_CTRL]
  59. bclr r5, r5, 6 ; Invalidate (discard w/o wback)
  60. bclr r5, r5, 0 ; Enable (+Inv)
  61. sr r5, [ARC_AUX_SLC_CTRL]
  62. 1:
  63. #endif
  64. /* Establish C runtime stack and frame */
  65. mov %sp, CONFIG_SYS_INIT_SP_ADDR
  66. mov %fp, %sp
  67. /* Allocate reserved area from current top of stack */
  68. mov %r0, %sp
  69. bl board_init_f_alloc_reserve
  70. /* Set stack below reserved area, adjust frame pointer accordingly */
  71. mov %sp, %r0
  72. mov %fp, %sp
  73. /* Initialize reserved area - note: r0 already contains address */
  74. bl board_init_f_init_reserve
  75. /* Zero the one and only argument of "board_init_f" */
  76. mov_s %r0, 0
  77. j board_init_f
  78. ENDPROC(_start)
  79. /*
  80. * void board_init_f_r_trampoline(stack-pointer address)
  81. *
  82. * This "function" does not return, instead it continues in RAM
  83. * after relocating the monitor code.
  84. *
  85. * r0 = new stack-pointer
  86. */
  87. ENTRY(board_init_f_r_trampoline)
  88. /* Set up the stack- and frame-pointers */
  89. mov %sp, %r0
  90. mov %fp, %sp
  91. /* Update position of intterupt vector table */
  92. lr %r0, [ARC_AUX_INTR_VEC_BASE]
  93. ld %r1, [%r25, GD_RELOC_OFF]
  94. add %r0, %r0, %r1
  95. sr %r0, [ARC_AUX_INTR_VEC_BASE]
  96. /* Re-enter U-Boot by calling board_init_f_r */
  97. j board_init_f_r
  98. ENDPROC(board_init_f_r_trampoline)