lowlevel_init.S 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. ldr r1, =ICCICR
  37. mov r2, #0x0
  38. str r2, [r1]
  39. mov r2, #0xF0
  40. adds r1, r1, #4 /* ICCPMR */
  41. str r2, [r1]
  42. ldr r1, =ICCICR
  43. mov r2, #0x1
  44. str r2, [r1]
  45. wait_loop:
  46. .long 0xE320F003 /* wfi */
  47. ldr r2, [r1, #0xC]
  48. str r2, [r1, #0x10]
  49. ldr r0, =MERAM_BASE
  50. ldr r2, [r0]
  51. cmp r2, #0
  52. movne pc, r2
  53. b wait_loop
  54. wait_loop_end:
  55. .pool
  56. .align 4
  57. lowlevel_init__:
  58. mov r0, #0x200000
  59. loop0:
  60. subs r0, r0, #1
  61. bne loop0
  62. ldr sp, MERAM_STACK
  63. str ip, [sp] /* stash old link register */
  64. mov ip, lr /* save link reg across call */
  65. bl s_init
  66. ldr ip, [sp] /* restore save ip */
  67. mov lr, ip /* restore link reg */
  68. /* back to arch calling code */
  69. mov pc, lr
  70. .pool
  71. .align 4
  72. ENDPROC(lowlevel_init)
  73. .ltorg
  74. MERAM_STACK:
  75. .word LOW_LEVEL_MERAM_STACK