macro.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * (C) Copyright 2011
  3. * Matthias Weisser <weisserm@arcor.de>
  4. *
  5. * (C) Copyright 2009 DENX Software Engineering
  6. * Author: John Rigby <jrigby@gmail.com>
  7. *
  8. * Common asm macros for imx25
  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. #ifndef __ASM_ARM_ARCH_MACRO_H__
  29. #define __ASM_ARM_ARCH_MACRO_H__
  30. #ifdef __ASSEMBLY__
  31. #include <asm/arch/imx-regs.h>
  32. #include <generated/asm-offsets.h>
  33. #include <asm/macro.h>
  34. /*
  35. * AIPS setup - Only setup MPROTx registers.
  36. * The PACR default values are good.
  37. *
  38. * Default argument values:
  39. * - MPR: Set all MPROTx to be non-bufferable, trusted for R/W, not forced to
  40. * user-mode.
  41. */
  42. .macro init_aips mpr=0x77777777
  43. ldr r0, =IMX_AIPS1_BASE
  44. ldr r1, =\mpr
  45. str r1, [r0, #AIPS_MPR_0_7]
  46. str r1, [r0, #AIPS_MPR_8_15]
  47. ldr r2, =IMX_AIPS2_BASE
  48. str r1, [r2, #AIPS_MPR_0_7]
  49. str r1, [r2, #AIPS_MPR_8_15]
  50. .endm
  51. /*
  52. * MAX (Multi-Layer AHB Crossbar Switch) setup
  53. *
  54. * Default argument values:
  55. * - MPR: priority is IAHB > DAHB > USBOTG > RTIC > eSDHC2/SDMA
  56. * - SGPCR: always park on last master
  57. * - MGPCR: restore default values
  58. */
  59. .macro init_max mpr=0x00043210, sgpcr=0x00000010, mgpcr=0x00000000
  60. ldr r0, =IMX_MAX_BASE
  61. ldr r1, =\mpr
  62. str r1, [r0, #MAX_MPR0] /* for S0 */
  63. str r1, [r0, #MAX_MPR1] /* for S1 */
  64. str r1, [r0, #MAX_MPR2] /* for S2 */
  65. str r1, [r0, #MAX_MPR3] /* for S3 */
  66. str r1, [r0, #MAX_MPR4] /* for S4 */
  67. ldr r1, =\sgpcr
  68. str r1, [r0, #MAX_SGPCR0] /* for S0 */
  69. str r1, [r0, #MAX_SGPCR1] /* for S1 */
  70. str r1, [r0, #MAX_SGPCR2] /* for S2 */
  71. str r1, [r0, #MAX_SGPCR3] /* for S3 */
  72. str r1, [r0, #MAX_SGPCR4] /* for S4 */
  73. ldr r1, =\mgpcr
  74. str r1, [r0, #MAX_MGPCR0] /* for M0 */
  75. str r1, [r0, #MAX_MGPCR1] /* for M1 */
  76. str r1, [r0, #MAX_MGPCR2] /* for M2 */
  77. str r1, [r0, #MAX_MGPCR3] /* for M3 */
  78. str r1, [r0, #MAX_MGPCR4] /* for M4 */
  79. .endm
  80. /*
  81. * M3IF setup
  82. *
  83. * Default argument values:
  84. * - CTL:
  85. * MRRP[0] = LCDC on priority list (1 << 0) = 0x00000001
  86. * MRRP[1] = MAX1 not on priority list (0 << 1) = 0x00000000
  87. * MRRP[2] = MAX0 not on priority list (0 << 2) = 0x00000000
  88. * MRRP[3] = USBH not on priority list (0 << 3) = 0x00000000
  89. * MRRP[4] = SDMA not on priority list (0 << 4) = 0x00000000
  90. * MRRP[5] = eSDHC1/ATA/FEC not on priority list (0 << 5) = 0x00000000
  91. * MRRP[6] = LCDC/SLCDC/MAX2 not on priority list (0 << 6) = 0x00000000
  92. * MRRP[7] = CSI not on priority list (0 << 7) = 0x00000000
  93. * ------------
  94. * 0x00000001
  95. */
  96. .macro init_m3if ctl=0x00000001
  97. /* M3IF Control Register (M3IFCTL) */
  98. write32 IMX_M3IF_CTRL_BASE, \ctl
  99. .endm
  100. #endif /* __ASSEMBLY__ */
  101. #endif /* __ASM_ARM_ARCH_MACRO_H__ */