lowlevel_macro.S 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. #include <asm/arch/imx-regs.h>
  22. #include <generated/asm-offsets.h>
  23. #include <asm/macro.h>
  24. /*
  25. * AIPS setup - Only setup MPROTx registers.
  26. * The PACR default values are good.
  27. *
  28. * Default argument values:
  29. * - MPR: Set all MPROTx to be non-bufferable, trusted for R/W, not forced to
  30. * user-mode.
  31. * - OPACR: Clear the on and off peripheral modules Supervisor Protect bit for
  32. * SDMA to access them.
  33. */
  34. .macro init_aips mpr=0x77777777, opacr=0x00000000
  35. ldr r0, =AIPS1_BASE_ADDR
  36. ldr r1, =\mpr
  37. str r1, [r0, #AIPS_MPR_0_7]
  38. str r1, [r0, #AIPS_MPR_8_15]
  39. ldr r2, =AIPS2_BASE_ADDR
  40. str r1, [r2, #AIPS_MPR_0_7]
  41. str r1, [r2, #AIPS_MPR_8_15]
  42. /* Did not change the AIPS control registers access type. */
  43. ldr r1, =\opacr
  44. str r1, [r0, #AIPS_OPACR_0_7]
  45. str r1, [r0, #AIPS_OPACR_8_15]
  46. str r1, [r0, #AIPS_OPACR_16_23]
  47. str r1, [r0, #AIPS_OPACR_24_31]
  48. str r1, [r0, #AIPS_OPACR_32_39]
  49. str r1, [r2, #AIPS_OPACR_0_7]
  50. str r1, [r2, #AIPS_OPACR_8_15]
  51. str r1, [r2, #AIPS_OPACR_16_23]
  52. str r1, [r2, #AIPS_OPACR_24_31]
  53. str r1, [r2, #AIPS_OPACR_32_39]
  54. .endm
  55. /*
  56. * MAX (Multi-Layer AHB Crossbar Switch) setup
  57. *
  58. * Default argument values:
  59. * - MPR: priority is M4 > M2 > M3 > M5 > M0 > M1
  60. * - SGPCR: always park on last master
  61. * - MGPCR: restore default values
  62. */
  63. .macro init_max mpr=0x00302154, sgpcr=0x00000010, mgpcr=0x00000000
  64. ldr r0, =MAX_BASE_ADDR
  65. ldr r1, =\mpr
  66. str r1, [r0, #MAX_MPR0] /* for S0 */
  67. str r1, [r0, #MAX_MPR1] /* for S1 */
  68. str r1, [r0, #MAX_MPR2] /* for S2 */
  69. str r1, [r0, #MAX_MPR3] /* for S3 */
  70. str r1, [r0, #MAX_MPR4] /* for S4 */
  71. ldr r1, =\sgpcr
  72. str r1, [r0, #MAX_SGPCR0] /* for S0 */
  73. str r1, [r0, #MAX_SGPCR1] /* for S1 */
  74. str r1, [r0, #MAX_SGPCR2] /* for S2 */
  75. str r1, [r0, #MAX_SGPCR3] /* for S3 */
  76. str r1, [r0, #MAX_SGPCR4] /* for S4 */
  77. ldr r1, =\mgpcr
  78. str r1, [r0, #MAX_MGPCR0] /* for M0 */
  79. str r1, [r0, #MAX_MGPCR1] /* for M1 */
  80. str r1, [r0, #MAX_MGPCR2] /* for M2 */
  81. str r1, [r0, #MAX_MGPCR3] /* for M3 */
  82. str r1, [r0, #MAX_MGPCR4] /* for M4 */
  83. str r1, [r0, #MAX_MGPCR5] /* for M5 */
  84. .endm
  85. /*
  86. * M3IF setup
  87. *
  88. * Default argument values:
  89. * - CTL:
  90. * MRRP[0] = L2CC0 not on priority list (0 << 0) = 0x00000000
  91. * MRRP[1] = L2CC1 not on priority list (0 << 1) = 0x00000000
  92. * MRRP[2] = MBX not on priority list (0 << 2) = 0x00000000
  93. * MRRP[3] = MAX1 not on priority list (0 << 3) = 0x00000000
  94. * MRRP[4] = SDMA not on priority list (0 << 4) = 0x00000000
  95. * MRRP[5] = MPEG4 not on priority list (0 << 5) = 0x00000000
  96. * MRRP[6] = IPU1 on priority list (1 << 6) = 0x00000040
  97. * MRRP[7] = IPU2 not on priority list (0 << 7) = 0x00000000
  98. * ------------
  99. * 0x00000040
  100. */
  101. .macro init_m3if ctl=0x00000040
  102. /* M3IF Control Register (M3IFCTL) */
  103. write32 M3IF_BASE_ADDR, \ctl
  104. .endm
  105. .macro core_init
  106. mrc p15, 0, r1, c1, c0, 0
  107. /* Set branch prediction enable */
  108. mrc p15, 0, r0, c1, c0, 1
  109. orr r0, r0, #7
  110. mcr p15, 0, r0, c1, c0, 1
  111. orr r1, r1, #1 << 11
  112. /* Set unaligned access enable */
  113. orr r1, r1, #1 << 22
  114. /* Set low int latency enable */
  115. orr r1, r1, #1 << 21
  116. mcr p15, 0, r1, c1, c0, 0
  117. mov r0, #0
  118. mcr p15, 0, r0, c15, c2, 4
  119. mcr p15, 0, r0, c7, c7, 0 /* Invalidate I cache and D cache */
  120. mcr p15, 0, r0, c8, c7, 0 /* Invalidate TLBs */
  121. mcr p15, 0, r0, c7, c10, 4 /* Drain the write buffer */
  122. /* Setup the Peripheral Port Memory Remap Register */
  123. ldr r0, =0x40000015 /* Start from AIPS 2-GB region */
  124. mcr p15, 0, r0, c15, c2, 4
  125. .endm