macro.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. * SPDX-License-Identifier: GPL-2.0+
  11. */
  12. #ifndef __ASM_ARM_ARCH_MACRO_H__
  13. #define __ASM_ARM_ARCH_MACRO_H__
  14. #ifdef __ASSEMBLY__
  15. #include <asm/arch/imx-regs.h>
  16. #include <generated/asm-offsets.h>
  17. #include <asm/macro.h>
  18. /*
  19. * AIPS setup - Only setup MPROTx registers.
  20. * The PACR default values are good.
  21. *
  22. * Default argument values:
  23. * - MPR: Set all MPROTx to be non-bufferable, trusted for R/W, not forced to
  24. * user-mode.
  25. */
  26. .macro init_aips mpr=0x77777777
  27. ldr r0, =IMX_AIPS1_BASE
  28. ldr r1, =\mpr
  29. str r1, [r0, #AIPS_MPR_0_7]
  30. str r1, [r0, #AIPS_MPR_8_15]
  31. ldr r2, =IMX_AIPS2_BASE
  32. str r1, [r2, #AIPS_MPR_0_7]
  33. str r1, [r2, #AIPS_MPR_8_15]
  34. .endm
  35. /*
  36. * MAX (Multi-Layer AHB Crossbar Switch) setup
  37. *
  38. * Default argument values:
  39. * - MPR: priority is IAHB > DAHB > USBOTG > RTIC > eSDHC2/SDMA
  40. * - SGPCR: always park on last master
  41. * - MGPCR: restore default values
  42. */
  43. .macro init_max mpr=0x00043210, sgpcr=0x00000010, mgpcr=0x00000000
  44. ldr r0, =IMX_MAX_BASE
  45. ldr r1, =\mpr
  46. str r1, [r0, #MAX_MPR0] /* for S0 */
  47. str r1, [r0, #MAX_MPR1] /* for S1 */
  48. str r1, [r0, #MAX_MPR2] /* for S2 */
  49. str r1, [r0, #MAX_MPR3] /* for S3 */
  50. str r1, [r0, #MAX_MPR4] /* for S4 */
  51. ldr r1, =\sgpcr
  52. str r1, [r0, #MAX_SGPCR0] /* for S0 */
  53. str r1, [r0, #MAX_SGPCR1] /* for S1 */
  54. str r1, [r0, #MAX_SGPCR2] /* for S2 */
  55. str r1, [r0, #MAX_SGPCR3] /* for S3 */
  56. str r1, [r0, #MAX_SGPCR4] /* for S4 */
  57. ldr r1, =\mgpcr
  58. str r1, [r0, #MAX_MGPCR0] /* for M0 */
  59. str r1, [r0, #MAX_MGPCR1] /* for M1 */
  60. str r1, [r0, #MAX_MGPCR2] /* for M2 */
  61. str r1, [r0, #MAX_MGPCR3] /* for M3 */
  62. str r1, [r0, #MAX_MGPCR4] /* for M4 */
  63. .endm
  64. /*
  65. * M3IF setup
  66. *
  67. * Default argument values:
  68. * - CTL:
  69. * MRRP[0] = LCDC on priority list (1 << 0) = 0x00000001
  70. * MRRP[1] = MAX1 not on priority list (0 << 1) = 0x00000000
  71. * MRRP[2] = MAX0 not on priority list (0 << 2) = 0x00000000
  72. * MRRP[3] = USBH not on priority list (0 << 3) = 0x00000000
  73. * MRRP[4] = SDMA not on priority list (0 << 4) = 0x00000000
  74. * MRRP[5] = eSDHC1/ATA/FEC not on priority list (0 << 5) = 0x00000000
  75. * MRRP[6] = LCDC/SLCDC/MAX2 not on priority list (0 << 6) = 0x00000000
  76. * MRRP[7] = CSI not on priority list (0 << 7) = 0x00000000
  77. * ------------
  78. * 0x00000001
  79. */
  80. .macro init_m3if ctl=0x00000001
  81. /* M3IF Control Register (M3IFCTL) */
  82. write32 IMX_M3IF_CTRL_BASE, \ctl
  83. .endm
  84. #endif /* __ASSEMBLY__ */
  85. #endif /* __ASM_ARM_ARCH_MACRO_H__ */