lowlevel_init.S 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * (C) Copyright 2008
  3. * Mark Jonas <mark.jonas@de.bosch.com>
  4. *
  5. * (C) Copyright 2007
  6. * Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
  7. *
  8. * board/mpr2/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. .global lowlevel_init
  26. .text
  27. .align 2
  28. lowlevel_init:
  29. /*
  30. * Set frequency multipliers and dividers in FRQCR.
  31. */
  32. mov.l WTCSR_A,r1
  33. mov.l WTCSR_D,r0
  34. mov.w r0,@r1
  35. mov.l WTCNT_A,r1
  36. mov.l WTCNT_D,r0
  37. mov.w r0,@r1
  38. mov.l FRQCR_A,r1
  39. mov.l FRQCR_D,r0
  40. mov.w r0,@r1
  41. /*
  42. * Setup CS0 (Flash).
  43. */
  44. mov.l CS0BCR_A, r1
  45. mov.l CS0BCR_D, r0
  46. mov.l r0, @r1
  47. mov.l CS0WCR_A, r1
  48. mov.l CS0WCR_D, r0
  49. mov.l r0, @r1
  50. /*
  51. * Setup CS3 (SDRAM).
  52. */
  53. mov.l CS3BCR_A, r1
  54. mov.l CS3BCR_D, r0
  55. mov.l r0, @r1
  56. mov.l CS3WCR_A, r1
  57. mov.l CS3WCR_D, r0
  58. mov.l r0, @r1
  59. mov.l SDCR_A, r1
  60. mov.l SDCR_D1, r0
  61. mov.l r0, @r1
  62. mov.l RTCSR_A, r1
  63. mov.l RTCSR_D, r0
  64. mov.l r0, @r1
  65. mov.l RTCNT_A, r1
  66. mov.l RTCNT_D, r0
  67. mov.l r0, @r1
  68. mov.l RTCOR_A, r1
  69. mov.l RTCOR_D, r0
  70. mov.l r0, @r1
  71. mov.l SDCR_A, r1
  72. mov.l SDCR_D2, r0
  73. mov.l r0, @r1
  74. mov.l SDMR3_A, r1
  75. mov.l SDMR3_D, r0
  76. add r0, r1
  77. mov #0, r0
  78. mov.w r0, @r1
  79. rts
  80. nop
  81. .align 4
  82. /*
  83. * Configuration for MPR2 A.3 through A.7
  84. */
  85. /*
  86. * PLL Settings
  87. */
  88. FRQCR_D: .long 0x1103 /* I:B:P=8:4:2 */
  89. WTCNT_D: .long 0x5A00 /* start counting at zero */
  90. WTCSR_D: .long 0xA507 /* divide by 4096 */
  91. /*
  92. * Spansion S29GL256N11 @ 48 MHz
  93. */
  94. CS0BCR_D: .long 0x12490400 /* 1 idle cycle inserted, normal space, 16 bit */
  95. CS0WCR_D: .long 0x00000340 /* tSW=0.5ck, 6 wait cycles, NO external wait, tHW=0.5ck */
  96. /*
  97. * Samsung K4S511632B-UL75 @ 48 MHz
  98. * Micron MT48LC32M16A2-75 @ 48 MHz
  99. */
  100. CS3BCR_D: .long 0x10004400 /* CS3BCR = 0x10004400, minimum idle cycles, SDRAM, 16 bit */
  101. CS3WCR_D: .long 0x00000091 /* tRP=1ck, tRCD=1ck, CL=2, tRWL=2ck, tRC=4ck */
  102. SDCR_D1: .long 0x00000012 /* no refresh, 13 rows, 10 cols, NO bank active mode */
  103. SDCR_D2: .long 0x00000812 /* refresh */
  104. RTCSR_D: .long 0xA55A0008 /* 1/4, once */
  105. RTCNT_D: .long 0xA55A005D /* count 93 */
  106. RTCOR_D: .long 0xa55a005d /* count 93 */
  107. SDMR3_D: .long 0x440 /* mode register CL2, burst read and SINGLE WRITE */
  108. /*
  109. * Registers
  110. */
  111. FRQCR_A: .long 0xA415FF80
  112. WTCNT_A: .long 0xA415FF84
  113. WTCSR_A: .long 0xA415FF86
  114. #define BSC_BASE 0xA4FD0000
  115. CS0BCR_A: .long BSC_BASE + 0x04
  116. CS3BCR_A: .long BSC_BASE + 0x0C
  117. CS0WCR_A: .long BSC_BASE + 0x24
  118. CS3WCR_A: .long BSC_BASE + 0x2C
  119. SDCR_A: .long BSC_BASE + 0x44
  120. RTCSR_A: .long BSC_BASE + 0x48
  121. RTCNT_A: .long BSC_BASE + 0x4C
  122. RTCOR_A: .long BSC_BASE + 0x50
  123. SDMR3_A: .long BSC_BASE + 0x5000