init.S 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /*
  2. * Copyright 2007 Wind River Systemes, Inc. <www.windriver.com>
  3. * Copyright 2007 Embedded Specialties, Inc.
  4. * Joe Hamman joe.hamman@embeddedspecialties.com
  5. *
  6. * Copyright 2004 Freescale Semiconductor.
  7. * Jeff Brown
  8. * Srikanth Srinivasan (srikanth.srinivasan@freescale.com)
  9. *
  10. * See file CREDITS for list of people who contributed to this
  11. * project.
  12. *
  13. * This program is free software; you can redistribute it and/or
  14. * modify it under the terms of the GNU General Public License as
  15. * published by the Free Software Foundation; either version 2 of
  16. * the License, or (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  26. * MA 02111-1307 USA
  27. */
  28. #include <ppc_asm.tmpl>
  29. #include <ppc_defs.h>
  30. #include <asm/cache.h>
  31. #include <asm/mmu.h>
  32. #include <config.h>
  33. #include <mpc86xx.h>
  34. /*
  35. * LAW(Local Access Window) configuration:
  36. *
  37. * 0x0000_0000 0x0fff_ffff DDR1 256M
  38. * 0x1000_0000 0x1fff_ffff DDR2 256M
  39. * 0xe000_0000 0xffff_ffff LBC 512M
  40. *
  41. * Notes:
  42. * CCSRBAR doesn't need a configured Local Access Window.
  43. * If flash is 8M at default position (last 8M), no LAW needed.
  44. */
  45. # DDR Bank 1
  46. # #define LAWBAR1 ((CFG_DDR_SDRAM_BASE>>12) & 0xffffff)
  47. # #define LAWAR1 (LAWAR_EN | LAWAR_TRGT_IF_DDR1 | (LAWAR_SIZE & LAWAR_SIZE_256M))
  48. # DDR Bank 2
  49. # #define LAWBAR2 ((CFG_DDR_SDRAM_BASE2>>12) & 0xffffff)
  50. # #define LAWAR2 (LAWAR_EN | LAWAR_TRGT_IF_DDR2 | (LAWAR_SIZE & LAWAR_SIZE_256M))
  51. # LBC
  52. # #define LAWBAR3 ((0xe0000000>>12) & 0xffffff)
  53. # #define LAWAR3 (LAWAR_EN & (LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_512M)))
  54. /*
  55. * LAW (Local Access Window) configuration:
  56. *
  57. * 0x0000_0000 DDR 256M
  58. * 0x1000_0000 DDR2 256M
  59. * 0x8000_0000 PCI1 MEM 512M
  60. * 0xa000_0000 PCI2 MEM 512M
  61. * 0xc000_0000 RapidIO 512M
  62. * 0xe200_0000 PCI1 IO 16M
  63. * 0xe300_0000 PCI2 IO 16M
  64. * 0xf800_0000 CCSRBAR 2M
  65. * 0xfe00_0000 FLASH (boot bank) 32M
  66. *
  67. */
  68. #define LAWBAR1 ((CFG_DDR_SDRAM_BASE>>12) & 0xffffff)
  69. #define LAWAR1 (LAWAR_EN | LAWAR_TRGT_IF_DDR1 | (LAWAR_SIZE & LAWAR_SIZE_256M))
  70. #define LAWBAR2 ((CFG_PCI1_MEM_BASE>>12) & 0xffffff)
  71. #define LAWAR2 (LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_512M))
  72. #define LAWBAR3 ((CFG_PCI2_MEM_BASE>>12) & 0xffffff)
  73. #define LAWAR3 (~LAWAR_EN & (LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_512M)))
  74. #define LAWBAR4 ((0xf8000000>>12) & 0xffffff)
  75. #define LAWAR4 (LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_2M))
  76. #define LAWBAR5 ((CFG_PCI1_IO_BASE>>12) & 0xffffff)
  77. #define LAWAR5 (LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_16M))
  78. #define LAWBAR6 ((CFG_PCI2_IO_BASE>>12) & 0xffffff)
  79. #define LAWAR6 (~LAWAR_EN &( LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_16M)))
  80. #define LAWBAR7 ((0xfe000000 >>12) & 0xffffff)
  81. #define LAWAR7 (LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_32M))
  82. #define LAWBAR8 ((CFG_DDR_SDRAM_BASE2>>12) & 0xffffff)
  83. #define LAWAR8 (LAWAR_EN | LAWAR_TRGT_IF_DDR2 | (LAWAR_SIZE & LAWAR_SIZE_256M))
  84. #define LAWBAR9 ((CFG_RIO_MEM_BASE>>12) & 0xfffff)
  85. #define LAWAR9 (LAWAR_EN | LAWAR_TRGT_IF_RIO | (LAWAR_SIZE & LAWAR_SIZE_512M))
  86. .section .bootpg, "ax"
  87. .globl law_entry
  88. law_entry:
  89. lis r7,CFG_CCSRBAR@h
  90. ori r7,r7,CFG_CCSRBAR@l
  91. addi r4,r7,0
  92. addi r5,r7,0
  93. /* Skip LAWAR0, start at LAWAR1 */
  94. lis r6,LAWBAR1@h
  95. ori r6,r6,LAWBAR1@l
  96. stwu r6, 0xc28(r4)
  97. lis r6,LAWAR1@h
  98. ori r6,r6,LAWAR1@l
  99. stwu r6, 0xc30(r5)
  100. /* LAWBAR2, LAWAR2 */
  101. lis r6,LAWBAR2@h
  102. ori r6,r6,LAWBAR2@l
  103. stwu r6, 0x20(r4)
  104. lis r6,LAWAR2@h
  105. ori r6,r6,LAWAR2@l
  106. stwu r6, 0x20(r5)
  107. /* LAWBAR3, LAWAR3 */
  108. lis r6,LAWBAR3@h
  109. ori r6,r6,LAWBAR3@l
  110. stwu r6, 0x20(r4)
  111. lis r6,LAWAR3@h
  112. ori r6,r6,LAWAR3@l
  113. stwu r6, 0x20(r5)
  114. /* LAWBAR4, LAWAR4 */
  115. lis r6,LAWBAR4@h
  116. ori r6,r6,LAWBAR4@l
  117. stwu r6, 0x20(r4)
  118. lis r6,LAWAR4@h
  119. ori r6,r6,LAWAR4@l
  120. stwu r6, 0x20(r5)
  121. /* LAWBAR5, LAWAR5 */
  122. lis r6,LAWBAR5@h
  123. ori r6,r6,LAWBAR5@l
  124. stwu r6, 0x20(r4)
  125. lis r6,LAWAR5@h
  126. ori r6,r6,LAWAR5@l
  127. stwu r6, 0x20(r5)
  128. /* LAWBAR6, LAWAR6 */
  129. lis r6,LAWBAR6@h
  130. ori r6,r6,LAWBAR6@l
  131. stwu r6, 0x20(r4)
  132. lis r6,LAWAR6@h
  133. ori r6,r6,LAWAR6@l
  134. stwu r6, 0x20(r5)
  135. /* LAWBAR7, LAWAR7 */
  136. lis r6,LAWBAR7@h
  137. ori r6,r6,LAWBAR7@l
  138. stwu r6, 0x20(r4)
  139. lis r6,LAWAR7@h
  140. ori r6,r6,LAWAR7@l
  141. stwu r6, 0x20(r5)
  142. /* LAWBAR8, LAWAR8 */
  143. lis r6,LAWBAR8@h
  144. ori r6,r6,LAWBAR8@l
  145. stwu r6, 0x20(r4)
  146. lis r6,LAWAR8@h
  147. ori r6,r6,LAWAR8@l
  148. stwu r6, 0x20(r5)
  149. /* LAWBAR9, LAWAR9 */
  150. lis r6,LAWBAR9@h
  151. ori r6,r6,LAWBAR9@l
  152. stwu r6, 0x20(r4)
  153. lis r6,LAWAR9@h
  154. ori r6,r6,LAWAR9@l
  155. stwu r6, 0x20(r5)
  156. blr