init.S 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * Copyright 2004 Freescale Semiconductor.
  3. * Jeff Brown (jeffrey@freescale.com)
  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. * 0xe000_0000 0xe000_ffff CCSR 1M
  38. * 0xe200_0000 0xe2ff_ffff PCI1 IO 16M
  39. * 0xe300_0000 0xe3ff_ffff PCI2 IO 16M
  40. * 0xf000_0000 0xf7ff_ffff SDRAM 128M
  41. * 0xf800_0000 0xf80f_ffff BCSR 1M
  42. * 0xfe00_0000 0xffff_ffff FLASH (boot bank) 32M
  43. *
  44. * Notes:
  45. * CCSRBAR don't need a configured Local Access Window.
  46. * If flash is 8M at default position (last 8M), no LAW needed.
  47. */
  48. #if !defined(CONFIG_SPD_EEPROM)
  49. #define LAWBAR1 ((CFG_DDR_SDRAM_BASE>>12) & 0xffffff)
  50. #define LAWAR1 (LAWAR_EN | LAWAR_TRGT_IF_DDR1 | (LAWAR_SIZE & LAWAR_SIZE_256M))
  51. #else
  52. #define LAWBAR1 0
  53. #define LAWAR1 ((LAWAR_TRGT_IF_DDR1 | (LAWAR_SIZE & LAWAR_SIZE_512M)) & ~LAWAR_EN)
  54. #endif
  55. #define LAWBAR2 ((CFG_PCI1_MEM_BASE>>12) & 0xffffff)
  56. #define LAWAR2 (LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_512M))
  57. #define LAWBAR3 ((CFG_PCI2_MEM_BASE>>12) & 0xffffff)
  58. /*#define LAWAR3 (LAWAR_EN | LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_512M)) */
  59. #define LAWAR3 (~LAWAR_EN & (LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_512M)))
  60. /*
  61. * This is not so much the SDRAM map as it is the whole localbus map.
  62. */
  63. #define LAWBAR4 ((0xf8100000>>12) & 0xffffff)
  64. #define LAWAR4 (LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_2M))
  65. #define LAWBAR5 ((CFG_PCI1_IO_BASE>>12) & 0xffffff)
  66. #define LAWAR5 (LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_16M))
  67. #define LAWBAR6 ((CFG_PCI2_IO_BASE>>12) & 0xffffff)
  68. /*#define LAWAR6 (LAWAR_EN | LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_16M)) */
  69. #define LAWAR6 (~LAWAR_EN &( LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_16M)))
  70. #define LAWBAR7 ((0xfe000000 >>12) & 0xffffff)
  71. #define LAWAR7 (LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_32M))
  72. .section .bootpg, "ax"
  73. .globl law_entry
  74. law_entry:
  75. lis r7,CFG_CCSRBAR@h
  76. ori r7,r7,CFG_CCSRBAR@l
  77. addi r4,r7,0
  78. addi r5,r7,0
  79. /* Skip LAWAR0, start at LAWAR1 */
  80. lis r6,LAWBAR1@h
  81. ori r6,r6,LAWBAR1@l
  82. stwu r6, 0xc28(r4)
  83. lis r6,LAWAR1@h
  84. ori r6,r6,LAWAR1@l
  85. stwu r6, 0xc30(r5)
  86. /* LAWBAR2, LAWAR2 */
  87. lis r6,LAWBAR2@h
  88. ori r6,r6,LAWBAR2@l
  89. stwu r6, 0x20(r4)
  90. lis r6,LAWAR2@h
  91. ori r6,r6,LAWAR2@l
  92. stwu r6, 0x20(r5)
  93. /* LAWBAR3, LAWAR3 */
  94. lis r6,LAWBAR3@h
  95. ori r6,r6,LAWBAR3@l
  96. stwu r6, 0x20(r4)
  97. lis r6,LAWAR3@h
  98. ori r6,r6,LAWAR3@l
  99. stwu r6, 0x20(r5)
  100. /* LAWBAR4, LAWAR4 */
  101. lis r6,LAWBAR4@h
  102. ori r6,r6,LAWBAR4@l
  103. stwu r6, 0x20(r4)
  104. lis r6,LAWAR4@h
  105. ori r6,r6,LAWAR4@l
  106. stwu r6, 0x20(r5)
  107. /* LAWBAR5, LAWAR5 */
  108. lis r6,LAWBAR5@h
  109. ori r6,r6,LAWBAR5@l
  110. stwu r6, 0x20(r4)
  111. lis r6,LAWAR5@h
  112. ori r6,r6,LAWAR5@l
  113. stwu r6, 0x20(r5)
  114. /* LAWBAR6, LAWAR6 */
  115. lis r6,LAWBAR6@h
  116. ori r6,r6,LAWBAR6@l
  117. stwu r6, 0x20(r4)
  118. lis r6,LAWAR6@h
  119. ori r6,r6,LAWAR6@l
  120. stwu r6, 0x20(r5)
  121. /* LAWBAR7, LAWAR7 */
  122. lis r6,LAWBAR7@h
  123. ori r6,r6,LAWBAR7@l
  124. stwu r6, 0x20(r4)
  125. lis r6,LAWAR7@h
  126. ori r6,r6,LAWAR7@l
  127. stwu r6, 0x20(r5)
  128. blr