0004-riscv-delay-initialization-of-caches-and-debug-UART.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From 2503ccc55ff2031ae2ff476fb06f666e6d1c7a64 Mon Sep 17 00:00:00 2001
  2. From: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
  3. Date: Sun, 17 Mar 2019 19:28:35 +0100
  4. Subject: [PATCH 04/18] riscv: delay initialization of caches and debug UART
  5. Move the initialization of the caches and the debug UART until after
  6. board_init_f_init_reserve. This is in preparation for SMP support, where
  7. code prior to this point will be executed by all harts. This ensures
  8. that initialization will only be performed once on the main hart running
  9. U-Boot.
  10. Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
  11. Reviewed-by: Anup Patel <anup.patel@wdc.com>
  12. Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
  13. ---
  14. arch/riscv/cpu/start.S | 16 ++++++++--------
  15. 1 file changed, 8 insertions(+), 8 deletions(-)
  16. diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S
  17. index 81ea52b170..a30f6f7194 100644
  18. --- a/arch/riscv/cpu/start.S
  19. +++ b/arch/riscv/cpu/start.S
  20. @@ -45,10 +45,6 @@ _start:
  21. /* mask all interrupts */
  22. csrw MODE_PREFIX(ie), zero
  23. - /* Enable cache */
  24. - jal icache_enable
  25. - jal dcache_enable
  26. -
  27. /*
  28. * Set stackpointer in internal/ex RAM to call board_init_f
  29. */
  30. @@ -57,10 +53,6 @@ call_board_init_f:
  31. li t1, CONFIG_SYS_INIT_SP_ADDR
  32. and sp, t1, t0 /* force 16 byte alignment */
  33. -#ifdef CONFIG_DEBUG_UART
  34. - jal debug_uart_init
  35. -#endif
  36. -
  37. call_board_init_f_0:
  38. mv a0, sp
  39. jal board_init_f_alloc_reserve
  40. @@ -74,6 +66,14 @@ call_board_init_f_0:
  41. /* save the boot hart id to global_data */
  42. SREG s0, GD_BOOT_HART(gp)
  43. + /* Enable cache */
  44. + jal icache_enable
  45. + jal dcache_enable
  46. +
  47. +#ifdef CONFIG_DEBUG_UART
  48. + jal debug_uart_init
  49. +#endif
  50. +
  51. mv a0, zero /* a0 <-- boot_flags = 0 */
  52. la t5, board_init_f
  53. jr t5 /* jump to board_init_f() */
  54. --
  55. 2.21.0