lowlevel_macro.S 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
  3. *
  4. * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation; either version 2 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  19. * MA 02111-1307 USA
  20. */
  21. /*
  22. * AIPS setup - Only setup MPROTx registers.
  23. * The PACR default values are good.
  24. */
  25. .macro init_aips
  26. /*
  27. * Set all MPROTx to be non-bufferable, trusted for R/W,
  28. * not forced to user-mode.
  29. */
  30. ldr r0, =AIPS1_BASE_ADDR
  31. ldr r1, =AIPS_MPR_CONFIG
  32. str r1, [r0, #0x00]
  33. str r1, [r0, #0x04]
  34. ldr r0, =AIPS2_BASE_ADDR
  35. str r1, [r0, #0x00]
  36. str r1, [r0, #0x04]
  37. /*
  38. * Clear the on and off peripheral modules Supervisor Protect bit
  39. * for SDMA to access them. Did not change the AIPS control registers
  40. * (offset 0x20) access type
  41. */
  42. ldr r0, =AIPS1_BASE_ADDR
  43. ldr r1, =AIPS_OPACR_CONFIG
  44. str r1, [r0, #0x40]
  45. str r1, [r0, #0x44]
  46. str r1, [r0, #0x48]
  47. str r1, [r0, #0x4C]
  48. str r1, [r0, #0x50]
  49. ldr r0, =AIPS2_BASE_ADDR
  50. str r1, [r0, #0x40]
  51. str r1, [r0, #0x44]
  52. str r1, [r0, #0x48]
  53. str r1, [r0, #0x4C]
  54. str r1, [r0, #0x50]
  55. .endm
  56. /* MAX (Multi-Layer AHB Crossbar Switch) setup */
  57. .macro init_max
  58. ldr r0, =MAX_BASE_ADDR
  59. /* MPR - priority is M4 > M2 > M3 > M5 > M0 > M1 */
  60. ldr r1, =MAX_MPR_CONFIG
  61. str r1, [r0, #0x000] /* for S0 */
  62. str r1, [r0, #0x100] /* for S1 */
  63. str r1, [r0, #0x200] /* for S2 */
  64. str r1, [r0, #0x300] /* for S3 */
  65. str r1, [r0, #0x400] /* for S4 */
  66. /* SGPCR - always park on last master */
  67. ldr r1, =MAX_SGPCR_CONFIG
  68. str r1, [r0, #0x010] /* for S0 */
  69. str r1, [r0, #0x110] /* for S1 */
  70. str r1, [r0, #0x210] /* for S2 */
  71. str r1, [r0, #0x310] /* for S3 */
  72. str r1, [r0, #0x410] /* for S4 */
  73. /* MGPCR - restore default values */
  74. ldr r1, =MAX_MGPCR_CONFIG
  75. str r1, [r0, #0x800] /* for M0 */
  76. str r1, [r0, #0x900] /* for M1 */
  77. str r1, [r0, #0xA00] /* for M2 */
  78. str r1, [r0, #0xB00] /* for M3 */
  79. str r1, [r0, #0xC00] /* for M4 */
  80. str r1, [r0, #0xD00] /* for M5 */
  81. .endm
  82. /* M3IF setup */
  83. .macro init_m3if
  84. /* Configure M3IF registers */
  85. ldr r1, =M3IF_BASE_ADDR
  86. /*
  87. * M3IF Control Register (M3IFCTL)
  88. * MRRP[0] = L2CC0 not on priority list (0 << 0) = 0x00000000
  89. * MRRP[1] = L2CC1 not on priority list (0 << 0) = 0x00000000
  90. * MRRP[2] = MBX not on priority list (0 << 0) = 0x00000000
  91. * MRRP[3] = MAX1 not on priority list (0 << 0) = 0x00000000
  92. * MRRP[4] = SDMA not on priority list (0 << 0) = 0x00000000
  93. * MRRP[5] = MPEG4 not on priority list (0 << 0) = 0x00000000
  94. * MRRP[6] = IPU1 on priority list (1 << 6) = 0x00000040
  95. * MRRP[7] = IPU2 not on priority list (0 << 0) = 0x00000000
  96. * ------------
  97. * 0x00000040
  98. */
  99. ldr r0, =M3IF_CONFIG
  100. str r0, [r1] /* M3IF control reg */
  101. .endm
  102. .macro core_init
  103. mrc 15, 0, r1, c1, c0, 0
  104. mrc 15, 0, r0, c1, c0, 1
  105. orr r0, r0, #7
  106. mcr 15, 0, r0, c1, c0, 1
  107. orr r1, r1, #(1<<11)
  108. /* Set unaligned access enable */
  109. orr r1, r1, #(1<<22)
  110. /* Set low int latency enable */
  111. orr r1, r1, #(1<<21)
  112. mcr 15, 0, r1, c1, c0, 0
  113. mov r0, #0
  114. /* Set branch prediction enable */
  115. mcr 15, 0, r0, c15, c2, 4
  116. mcr 15, 0, r0, c7, c7, 0 /* invalidate I cache and D cache */
  117. mcr 15, 0, r0, c8, c7, 0 /* invalidate TLBs */
  118. mcr 15, 0, r0, c7, c10, 4 /* Drain the write buffer */
  119. /*
  120. * initializes very early AIPS
  121. * Then it also initializes Multi-Layer AHB Crossbar Switch,
  122. * M3IF
  123. * Also setup the Peripheral Port Remap register inside the core
  124. */
  125. ldr r0, =0x40000015 /* start from AIPS 2GB region */
  126. mcr p15, 0, r0, c15, c2, 4
  127. .endm