init.S 4.9 KB

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