start.S 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. /* Setup interrupt vector base that matches "__text_start" */
  12. sr __ivt_start, [ARC_AUX_INTR_VEC_BASE]
  13. ; Disable/enable I-cache according to configuration
  14. lr r5, [ARC_BCR_IC_BUILD]
  15. breq r5, 0, 1f ; I$ doesn't exist
  16. lr r5, [ARC_AUX_IC_CTRL]
  17. #ifndef CONFIG_SYS_ICACHE_OFF
  18. bclr r5, r5, 0 ; 0 - Enable, 1 is Disable
  19. #else
  20. bset r5, r5, 0 ; I$ exists, but is not used
  21. #endif
  22. sr r5, [ARC_AUX_IC_CTRL]
  23. 1:
  24. ; Disable/enable D-cache according to configuration
  25. lr r5, [ARC_BCR_DC_BUILD]
  26. breq r5, 0, 1f ; D$ doesn't exist
  27. lr r5, [ARC_AUX_DC_CTRL]
  28. bclr r5, r5, 6 ; Invalidate (discard w/o wback)
  29. #ifndef CONFIG_SYS_DCACHE_OFF
  30. bclr r5, r5, 0 ; Enable (+Inv)
  31. #else
  32. bset r5, r5, 0 ; Disable (+Inv)
  33. #endif
  34. sr r5, [ARC_AUX_DC_CTRL]
  35. 1:
  36. #ifdef CONFIG_ISA_ARCV2
  37. ; Disable System-Level Cache (SLC)
  38. lr r5, [ARC_BCR_SLC]
  39. breq r5, 0, 1f ; SLC doesn't exist
  40. lr r5, [ARC_AUX_SLC_CTRL]
  41. bclr r5, r5, 6 ; Invalidate (discard w/o wback)
  42. bclr r5, r5, 0 ; Enable (+Inv)
  43. sr r5, [ARC_AUX_SLC_CTRL]
  44. 1:
  45. #endif
  46. /* Setup stack- and frame-pointers */
  47. mov %sp, CONFIG_SYS_INIT_SP_ADDR
  48. mov %fp, %sp
  49. /* Allocate and zero GD, update SP */
  50. mov %r0, %sp
  51. bl board_init_f_mem
  52. /* Update stack- and frame-pointers */
  53. mov %sp, %r0
  54. mov %fp, %sp
  55. /* Zero the one and only argument of "board_init_f" */
  56. mov_s %r0, 0
  57. j board_init_f
  58. ENDPROC(_start)
  59. /*
  60. * void board_init_f_r_trampoline(stack-pointer address)
  61. *
  62. * This "function" does not return, instead it continues in RAM
  63. * after relocating the monitor code.
  64. *
  65. * r0 = new stack-pointer
  66. */
  67. ENTRY(board_init_f_r_trampoline)
  68. /* Set up the stack- and frame-pointers */
  69. mov %sp, %r0
  70. mov %fp, %sp
  71. /* Update position of intterupt vector table */
  72. lr %r0, [ARC_AUX_INTR_VEC_BASE]
  73. ld %r1, [%r25, GD_RELOC_OFF]
  74. add %r0, %r0, %r1
  75. sr %r0, [ARC_AUX_INTR_VEC_BASE]
  76. /* Re-enter U-Boot by calling board_init_f_r */
  77. j board_init_f_r
  78. ENDPROC(board_init_f_r_trampoline)