low_levelinit.S 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. /*
  2. * Board specific setup info
  3. *
  4. * (C) Copyright 2005-2008 Samsung Electronics
  5. * Kyungmin Park <kyungmin.park@samsung.com>
  6. *
  7. * Derived from board/omap2420h4/platform.S
  8. *
  9. * See file CREDITS for list of people who contributed to this
  10. * project.
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License as
  14. * published by the Free Software Foundation; either version 2 of
  15. * the License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  25. * MA 02111-1307 USA
  26. */
  27. #include <config.h>
  28. #include <asm/arch/omap2420.h>
  29. #include <asm/arch/mem.h>
  30. #include <asm/arch/clocks.h>
  31. #define APOLLON_CS0_BASE 0x00000000
  32. #ifdef PRCM_CONFIG_I
  33. #define SDRC_ACTIM_CTRLA_0_VAL 0x7BA35907
  34. #define SDRC_ACTIM_CTRLB_0_VAL 0x00000013
  35. #define SDRC_RFR_CTRL_0_VAL 0x00044C01
  36. /* GPMC */
  37. #define APOLLON_GPMC_CONFIG1_0 0xe30d1201
  38. #define APOLLON_GPMC_CONFIG2_0 0x000c1000
  39. #define APOLLON_GPMC_CONFIG3_0 0x00030400
  40. #define APOLLON_GPMC_CONFIG4_0 0x0B841006
  41. #define APOLLON_GPMC_CONFIG5_0 0x020F0C11
  42. #define APOLLON_GPMC_CONFIG6_0 0x00000000
  43. #define APOLLON_GPMC_CONFIG7_0 (0x00000e40 | (APOLLON_CS0_BASE >> 24))
  44. #elif defined(PRCM_CONFIG_II)
  45. #define SDRC_ACTIM_CTRLA_0_VAL 0x4A59B485
  46. #define SDRC_ACTIM_CTRLB_0_VAL 0x0000000C
  47. #define SDRC_RFR_CTRL_0_VAL 0x00030001
  48. /* GPMC */
  49. #define APOLLON_GPMC_CONFIG1_0 0xe30d1201
  50. #define APOLLON_GPMC_CONFIG2_0 0x00080E81
  51. #define APOLLON_GPMC_CONFIG3_0 0x00030400
  52. #define APOLLON_GPMC_CONFIG4_0 0x08041586
  53. #define APOLLON_GPMC_CONFIG5_0 0x020C090E
  54. #define APOLLON_GPMC_CONFIG6_0 0x00000000
  55. #define APOLLON_GPMC_CONFIG7_0 (0x00000e40 | (APOLLON_CS0_BASE >> 24))
  56. #else
  57. #error "Please configure PRCM schecm"
  58. #endif
  59. _TEXT_BASE:
  60. .word TEXT_BASE /* sdram load addr from config.mk */
  61. .globl lowlevel_init
  62. lowlevel_init:
  63. mov r3, r0 /* save skip information */
  64. /* Disable watchdog */
  65. ldr r0, =WD2_BASE
  66. ldr r1, =WD_UNLOCK1
  67. str r1, [r0, #WSPR]
  68. ldr r1, =WD_UNLOCK2
  69. str r1, [r0, #WSPR]
  70. #ifdef DEBUG_LED
  71. /* LED0 OFF */
  72. ldr r0, =0x480000E5 /* ball AA10, mode 3 */
  73. mov r1, #0x0b
  74. strb r1, [r0]
  75. #endif
  76. /* Pin muxing for SDRC */
  77. mov r1, #0x00
  78. ldr r0, =0x480000A1 /* ball C12, mode 0 */
  79. strb r1, [r0]
  80. ldr r0, =0x48000032 /* ball D11, mode 0 */
  81. strb r1, [r0]
  82. ldr r0, =0x480000A3 /* ball B13, mode 0 */
  83. strb r1, [r0]
  84. /* SDRC setting */
  85. ldr r0, =OMAP2420_SDRC_BASE
  86. ldr r1, =0x00000010
  87. str r1, [r0, #0x10]
  88. ldr r1, =0x00000100
  89. str r1, [r0, #0x44]
  90. /* SDRC CS0 configuration */
  91. #ifdef CONFIG_APOLLON_PLUS
  92. ldr r1, =0x01702011
  93. #else
  94. ldr r1, =0x00d04011
  95. #endif
  96. str r1, [r0, #0x80]
  97. ldr r1, =SDRC_ACTIM_CTRLA_0_VAL
  98. str r1, [r0, #0x9C]
  99. ldr r1, =SDRC_ACTIM_CTRLB_0_VAL
  100. str r1, [r0, #0xA0]
  101. ldr r1, =SDRC_RFR_CTRL_0_VAL
  102. str r1, [r0, #0xA4]
  103. ldr r1, =0x00000041
  104. str r1, [r0, #0x70]
  105. /* Manual command sequence */
  106. ldr r1, =0x00000007
  107. str r1, [r0, #0xA8]
  108. ldr r1, =0x00000000
  109. str r1, [r0, #0xA8]
  110. ldr r1, =0x00000001
  111. str r1, [r0, #0xA8]
  112. ldr r1, =0x00000002
  113. str r1, [r0, #0xA8]
  114. str r1, [r0, #0xA8]
  115. /*
  116. * CS0 SDRC Mode register
  117. * Burst length = 4 - DDR memory
  118. * Serial mode
  119. * CAS latency = 3
  120. */
  121. ldr r1, =0x00000032
  122. str r1, [r0, #0x84]
  123. /* Note: You MUST set EMR values */
  124. /* EMR1 & EMR2 */
  125. ldr r1, =0x00000000
  126. str r1, [r0, #0x88]
  127. str r1, [r0, #0x8C]
  128. #ifdef OLD_SDRC_DLLA_CTRL
  129. /* SDRC_DLLA_CTRL */
  130. ldr r1, =0x00007306
  131. str r1, [r0, #0x60]
  132. ldr r1, =0x00007303
  133. str r1, [r0, #0x60]
  134. #else
  135. /* SDRC_DLLA_CTRL */
  136. ldr r1, =0x00000506
  137. str r1, [r0, #0x60]
  138. ldr r1, =0x00000503
  139. str r1, [r0, #0x60]
  140. #endif
  141. #ifdef __BROKEN_FEATURE__
  142. /* SDRC_DLLB_CTRL */
  143. ldr r1, =0x00000506
  144. str r1, [r0, #0x68]
  145. ldr r1, =0x00000503
  146. str r1, [r0, #0x68]
  147. #endif
  148. /* little delay after init */
  149. mov r2, #0x1800
  150. 1:
  151. subs r2, r2, #0x1
  152. bne 1b
  153. ldr sp, SRAM_STACK
  154. str ip, [sp] /* stash old link register */
  155. mov ip, lr /* save link reg across call */
  156. mov r0, r3 /* pass skip info to s_init */
  157. bl s_init /* go setup pll,mux,memory */
  158. ldr ip, [sp] /* restore save ip */
  159. mov lr, ip /* restore link reg */
  160. /* back to arch calling code */
  161. mov pc, lr
  162. /* the literal pools origin */
  163. .ltorg
  164. SRAM_STACK:
  165. .word LOW_LEVEL_SRAM_STACK