start.S 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. /* Establish C runtime stack and frame */
  47. mov %sp, CONFIG_SYS_INIT_SP_ADDR
  48. mov %fp, %sp
  49. /* Allocate reserved area from current top of stack */
  50. mov %r0, %sp
  51. bl board_init_f_alloc_reserve
  52. /* Set stack below reserved area, adjust frame pointer accordingly */
  53. mov %sp, %r0
  54. mov %fp, %sp
  55. /* Initialize reserved area - note: r0 already contains address */
  56. bl board_init_f_init_reserve
  57. /* Zero the one and only argument of "board_init_f" */
  58. mov_s %r0, 0
  59. j board_init_f
  60. ENDPROC(_start)
  61. /*
  62. * void board_init_f_r_trampoline(stack-pointer address)
  63. *
  64. * This "function" does not return, instead it continues in RAM
  65. * after relocating the monitor code.
  66. *
  67. * r0 = new stack-pointer
  68. */
  69. ENTRY(board_init_f_r_trampoline)
  70. /* Set up the stack- and frame-pointers */
  71. mov %sp, %r0
  72. mov %fp, %sp
  73. /* Update position of intterupt vector table */
  74. lr %r0, [ARC_AUX_INTR_VEC_BASE]
  75. ld %r1, [%r25, GD_RELOC_OFF]
  76. add %r0, %r0, %r1
  77. sr %r0, [ARC_AUX_INTR_VEC_BASE]
  78. /* Re-enter U-Boot by calling board_init_f_r */
  79. j board_init_f_r
  80. ENDPROC(board_init_f_r_trampoline)