lowlevel_init.S 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Copyright (C) 2012 Nobuhiro Iwamatsu <nobuhiro.Iwamatsu.yj@renesas.com>
  3. * Copyright (C) 2012 Renesas Solutions Corp.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <config.h>
  24. #include <linux/linkage.h>
  25. ENTRY(lowlevel_init)
  26. ldr r0, =MERAM_BASE
  27. mov r1, #0x0
  28. str r1, [r0]
  29. mrc p15, 0, r0, c0, c0, 5
  30. ands r0, r0, #0xF
  31. beq lowlevel_init__
  32. b wait_interrupt
  33. .pool
  34. .align 4
  35. wait_interrupt:
  36. #ifdef ICCICR
  37. ldr r1, =ICCICR
  38. mov r2, #0x0
  39. str r2, [r1]
  40. mov r2, #0xF0
  41. adds r1, r1, #4 /* ICCPMR */
  42. str r2, [r1]
  43. ldr r1, =ICCICR
  44. mov r2, #0x1
  45. str r2, [r1]
  46. #endif
  47. wait_loop:
  48. .long 0xE320F003 /* wfi */
  49. ldr r2, [r1, #0xC]
  50. str r2, [r1, #0x10]
  51. ldr r0, =MERAM_BASE
  52. ldr r2, [r0]
  53. cmp r2, #0
  54. movne pc, r2
  55. b wait_loop
  56. wait_loop_end:
  57. .pool
  58. .align 4
  59. lowlevel_init__:
  60. mov r0, #0x200000
  61. loop0:
  62. subs r0, r0, #1
  63. bne loop0
  64. ldr sp, MERAM_STACK
  65. str ip, [sp] /* stash old link register */
  66. mov ip, lr /* save link reg across call */
  67. bl s_init
  68. ldr ip, [sp] /* restore save ip */
  69. mov lr, ip /* restore link reg */
  70. /* back to arch calling code */
  71. mov pc, lr
  72. .pool
  73. .align 4
  74. ENDPROC(lowlevel_init)
  75. .ltorg
  76. MERAM_STACK:
  77. .word LOW_LEVEL_MERAM_STACK