lowlevel_init.S 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. /*
  2. * Copyright (C) 2007
  3. * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  4. *
  5. * Copyright (C) 2007
  6. * Kenati Technologies, Inc.
  7. *
  8. * board/ms7722se/lowlevel_init.S
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. #include <config.h>
  26. #include <version.h>
  27. #include <asm/processor.h>
  28. #include <asm/macro.h>
  29. /*
  30. * Board specific low level init code, called _very_ early in the
  31. * startup sequence. Relocation to SDRAM has not happened yet, no
  32. * stack is available, bss section has not been initialised, etc.
  33. *
  34. * (Note: As no stack is available, no subroutines can be called...).
  35. */
  36. .global lowlevel_init
  37. .text
  38. .align 2
  39. lowlevel_init:
  40. /*
  41. * Cache Control Register
  42. * Instruction Cache Invalidate
  43. */
  44. write32 CCR_A, CCR_D
  45. /*
  46. * Address of MMU Control Register
  47. * TI == TLB Invalidate bit
  48. */
  49. write32 MMUCR_A, MMUCR_D
  50. /* Address of Power Control Register 0 */
  51. write32 MSTPCR0_A, MSTPCR0_D
  52. /* Address of Power Control Register 2 */
  53. write32 MSTPCR2_A, MSTPCR2_D
  54. write16 SBSCR_A, SBSCR_D
  55. write16 PSCR_A, PSCR_D
  56. /* 0xA4520004 (Watchdog Control / Status Register) */
  57. ! write16 RWTCSR_A, RWTCSR_D_1 /* 0xA507 -> timer_STOP/WDT_CLK=max */
  58. /* 0xA4520000 (Watchdog Count Register) */
  59. write16 RWTCNT_A, RWTCNT_D /*0x5A00 -> Clear */
  60. /* 0xA4520004 (Watchdog Control / Status Register) */
  61. write16 RWTCSR_A, RWTCSR_D_2 /* 0xA504 -> timer_STOP/CLK=500ms */
  62. /* 0xA4150000 Frequency control register */
  63. write32 FRQCR_A, FRQCR_D
  64. write32 CCR_A, CCR_D_2
  65. bsc_init:
  66. write16 PSELA_A, PSELA_D
  67. write16 DRVCR_A, DRVCR_D
  68. write16 PCCR_A, PCCR_D
  69. write16 PECR_A, PECR_D
  70. write16 PJCR_A, PJCR_D
  71. write16 PXCR_A, PXCR_D
  72. write32 CMNCR_A, CMNCR_D
  73. write32 CS0BCR_A, CS0BCR_D
  74. write32 CS2BCR_A, CS2BCR_D
  75. write32 CS4BCR_A, CS4BCR_D
  76. write32 CS5ABCR_A, CS5ABCR_D
  77. write32 CS5BBCR_A, CS5BBCR_D
  78. write32 CS6ABCR_A, CS6ABCR_D
  79. write32 CS0WCR_A, CS0WCR_D
  80. write32 CS2WCR_A, CS2WCR_D
  81. write32 CS4WCR_A, CS4WCR_D
  82. write32 CS5AWCR_A, CS5AWCR_D
  83. write32 CS5BWCR_A, CS5BWCR_D
  84. write32 CS6AWCR_A, CS6AWCR_D
  85. ! SDRAM initialization
  86. write32 SDCR_A, SDCR_D
  87. write32 SDWCR_A, SDWCR_D
  88. write32 SDPCR_A, SDPCR_D
  89. write32 RTCOR_A, RTCOR_D
  90. write32 RTCSR_A, RTCSR_D
  91. write8 SDMR3_A, SDMR3_D
  92. ! BL bit off (init = ON) (?!?)
  93. stc sr, r0 ! BL bit off(init=ON)
  94. mov.l SR_MASK_D, r1
  95. and r1, r0
  96. ldc r0, sr
  97. rts
  98. mov #0, r0
  99. .align 2
  100. CCR_A: .long CCR
  101. MMUCR_A: .long MMUCR
  102. MSTPCR0_A: .long MSTPCR0
  103. MSTPCR2_A: .long MSTPCR2
  104. SBSCR_A: .long SBSCR
  105. PSCR_A: .long PSCR
  106. RWTCSR_A: .long RWTCSR
  107. RWTCNT_A: .long RWTCNT
  108. FRQCR_A: .long FRQCR
  109. CCR_D: .long 0x00000800
  110. CCR_D_2: .long 0x00000103
  111. MMUCR_D: .long 0x00000004
  112. MSTPCR0_D: .long 0x00001001
  113. MSTPCR2_D: .long 0xffffffff
  114. FRQCR_D: .long 0x07022538
  115. PSELA_A: .long 0xa405014E
  116. PSELA_D: .word 0x0A10
  117. .align 2
  118. DRVCR_A: .long 0xa405018A
  119. DRVCR_D: .word 0x0554
  120. .align 2
  121. PCCR_A: .long 0xa4050104
  122. PCCR_D: .word 0x8800
  123. .align 2
  124. PECR_A: .long 0xa4050108
  125. PECR_D: .word 0x0000
  126. .align 2
  127. PJCR_A: .long 0xa4050110
  128. PJCR_D: .word 0x1000
  129. .align 2
  130. PXCR_A: .long 0xa4050148
  131. PXCR_D: .word 0x0AAA
  132. .align 2
  133. CMNCR_A: .long CMNCR
  134. CMNCR_D: .long 0x00000013
  135. CS0BCR_A: .long CS0BCR ! Flash bank 1
  136. CS0BCR_D: .long 0x24920400
  137. CS2BCR_A: .long CS2BCR ! SRAM
  138. CS2BCR_D: .long 0x24920400
  139. CS4BCR_A: .long CS4BCR ! FPGA, PCMCIA, USB, ext slot
  140. CS4BCR_D: .long 0x24920400
  141. CS5ABCR_A: .long CS5ABCR ! Ext slot
  142. CS5ABCR_D: .long 0x24920400
  143. CS5BBCR_A: .long CS5BBCR ! USB controller
  144. CS5BBCR_D: .long 0x24920400
  145. CS6ABCR_A: .long CS6ABCR ! Ethernet
  146. CS6ABCR_D: .long 0x24920400
  147. CS0WCR_A: .long CS0WCR
  148. CS0WCR_D: .long 0x00000300
  149. CS2WCR_A: .long CS2WCR
  150. CS2WCR_D: .long 0x00000300
  151. CS4WCR_A: .long CS4WCR
  152. CS4WCR_D: .long 0x00000300
  153. CS5AWCR_A: .long CS5AWCR
  154. CS5AWCR_D: .long 0x00000300
  155. CS5BWCR_A: .long CS5BWCR
  156. CS5BWCR_D: .long 0x00000300
  157. CS6AWCR_A: .long CS6AWCR
  158. CS6AWCR_D: .long 0x00000300
  159. SDCR_A: .long SBSC_SDCR
  160. SDCR_D: .long 0x00020809
  161. SDWCR_A: .long SBSC_SDWCR
  162. SDWCR_D: .long 0x00164d0d
  163. SDPCR_A: .long SBSC_SDPCR
  164. SDPCR_D: .long 0x00000087
  165. RTCOR_A: .long SBSC_RTCOR
  166. RTCOR_D: .long 0xA55A0034
  167. RTCSR_A: .long SBSC_RTCSR
  168. RTCSR_D: .long 0xA55A0010
  169. SDMR3_A: .long 0xFE500180
  170. SDMR3_D: .long 0x0
  171. .align 1
  172. SBSCR_D: .word 0x0040
  173. PSCR_D: .word 0x0000
  174. RWTCSR_D_1: .word 0xA507
  175. RWTCSR_D_2: .word 0xA507
  176. RWTCNT_D: .word 0x5A00
  177. .align 2
  178. SR_MASK_D: .long 0xEFFFFF0F