lowlevel_init.S 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (C) 2012 Altera Corporation <www.altera.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #include <config.h>
  18. #include <version.h>
  19. /* Save the parameter pass in by previous boot loader */
  20. .global save_boot_params
  21. save_boot_params:
  22. /* save the parameter here */
  23. /*
  24. * Setup stack for exception, which is located
  25. * at the end of on-chip RAM. We don't expect exception prior to
  26. * relocation and if that happens, we won't worry -- it will overide
  27. * global data region as the code will goto reset. After relocation,
  28. * this region won't be used by other part of program.
  29. * Hence it is safe.
  30. */
  31. ldr r0, =(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE)
  32. ldr r1, =IRQ_STACK_START_IN
  33. str r0, [r1]
  34. bx lr
  35. /* Set up the platform, once the cpu has been initialized */
  36. .globl lowlevel_init
  37. lowlevel_init:
  38. /* Remap */
  39. #ifdef CONFIG_SPL_BUILD
  40. /*
  41. * SPL : configure the remap (L3 NIC-301 GPV)
  42. * so the on-chip RAM at lower memory instead ROM.
  43. */
  44. ldr r0, =SOCFPGA_L3REGS_ADDRESS
  45. mov r1, #0x19
  46. str r1, [r0]
  47. #else
  48. /*
  49. * U-Boot : configure the remap (L3 NIC-301 GPV)
  50. * so the SDRAM at lower memory instead on-chip RAM.
  51. */
  52. ldr r0, =SOCFPGA_L3REGS_ADDRESS
  53. mov r1, #0x2
  54. str r1, [r0]
  55. /* Private components security */
  56. /*
  57. * U-Boot : configure private timer, global timer and cpu
  58. * component access as non secure for kernel stage (as required
  59. * by kernel)
  60. */
  61. mrc p15,4,r0,c15,c0,0
  62. add r1, r0, #0x54
  63. ldr r2, [r1]
  64. orr r2, r2, #0xff
  65. orr r2, r2, #0xf00
  66. str r2, [r1]
  67. #endif /* #ifdef CONFIG_SPL_BUILD */
  68. mov pc, lr