m525xsim.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /****************************************************************************/
  2. /*
  3. * m525xsim.h -- ColdFire 525x System Integration Module support.
  4. *
  5. * (C) Copyright 2012, Steven king <sfking@fdwdc.com>
  6. * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
  7. */
  8. /****************************************************************************/
  9. #ifndef m525xsim_h
  10. #define m525xsim_h
  11. /****************************************************************************/
  12. #define CPU_NAME "COLDFIRE(m525x)"
  13. #define CPU_INSTR_PER_JIFFY 3
  14. #define MCF_BUSCLK (MCF_CLK / 2)
  15. #include <asm/m52xxacr.h>
  16. /*
  17. * The 525x has a second MBAR region, define its address.
  18. */
  19. #define MCF_MBAR2 0x80000000
  20. /*
  21. * Define the 525x SIM register set addresses.
  22. */
  23. #define MCFSIM_RSR (MCF_MBAR + 0x00) /* Reset Status */
  24. #define MCFSIM_SYPCR (MCF_MBAR + 0x01) /* System Protection */
  25. #define MCFSIM_SWIVR (MCF_MBAR + 0x02) /* SW Watchdog intr */
  26. #define MCFSIM_SWSR (MCF_MBAR + 0x03) /* SW Watchdog srv */
  27. #define MCFSIM_MPARK (MCF_MBAR + 0x0C) /* BUS Master Ctrl */
  28. #define MCFSIM_IPR (MCF_MBAR + 0x40) /* Interrupt Pending */
  29. #define MCFSIM_IMR (MCF_MBAR + 0x44) /* Interrupt Mask */
  30. #define MCFSIM_ICR0 (MCF_MBAR + 0x4c) /* Intr Ctrl reg 0 */
  31. #define MCFSIM_ICR1 (MCF_MBAR + 0x4d) /* Intr Ctrl reg 1 */
  32. #define MCFSIM_ICR2 (MCF_MBAR + 0x4e) /* Intr Ctrl reg 2 */
  33. #define MCFSIM_ICR3 (MCF_MBAR + 0x4f) /* Intr Ctrl reg 3 */
  34. #define MCFSIM_ICR4 (MCF_MBAR + 0x50) /* Intr Ctrl reg 4 */
  35. #define MCFSIM_ICR5 (MCF_MBAR + 0x51) /* Intr Ctrl reg 5 */
  36. #define MCFSIM_ICR6 (MCF_MBAR + 0x52) /* Intr Ctrl reg 6 */
  37. #define MCFSIM_ICR7 (MCF_MBAR + 0x53) /* Intr Ctrl reg 7 */
  38. #define MCFSIM_ICR8 (MCF_MBAR + 0x54) /* Intr Ctrl reg 8 */
  39. #define MCFSIM_ICR9 (MCF_MBAR + 0x55) /* Intr Ctrl reg 9 */
  40. #define MCFSIM_ICR10 (MCF_MBAR + 0x56) /* Intr Ctrl reg 10 */
  41. #define MCFSIM_ICR11 (MCF_MBAR + 0x57) /* Intr Ctrl reg 11 */
  42. #define MCFSIM_CSAR0 (MCF_MBAR + 0x80) /* CS 0 Address reg */
  43. #define MCFSIM_CSMR0 (MCF_MBAR + 0x84) /* CS 0 Mask reg */
  44. #define MCFSIM_CSCR0 (MCF_MBAR + 0x8a) /* CS 0 Control reg */
  45. #define MCFSIM_CSAR1 (MCF_MBAR + 0x8c) /* CS 1 Address reg */
  46. #define MCFSIM_CSMR1 (MCF_MBAR + 0x90) /* CS 1 Mask reg */
  47. #define MCFSIM_CSCR1 (MCF_MBAR + 0x96) /* CS 1 Control reg */
  48. #define MCFSIM_CSAR2 (MCF_MBAR + 0x98) /* CS 2 Address reg */
  49. #define MCFSIM_CSMR2 (MCF_MBAR + 0x9c) /* CS 2 Mask reg */
  50. #define MCFSIM_CSCR2 (MCF_MBAR + 0xa2) /* CS 2 Control reg */
  51. #define MCFSIM_CSAR3 (MCF_MBAR + 0xa4) /* CS 3 Address reg */
  52. #define MCFSIM_CSMR3 (MCF_MBAR + 0xa8) /* CS 3 Mask reg */
  53. #define MCFSIM_CSCR3 (MCF_MBAR + 0xae) /* CS 3 Control reg */
  54. #define MCFSIM_CSAR4 (MCF_MBAR + 0xb0) /* CS 4 Address reg */
  55. #define MCFSIM_CSMR4 (MCF_MBAR + 0xb4) /* CS 4 Mask reg */
  56. #define MCFSIM_CSCR4 (MCF_MBAR + 0xba) /* CS 4 Control reg */
  57. #define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */
  58. #define MCFSIM_DACR0 (MCF_MBAR + 0x108) /* DRAM 0 Addr/Ctrl */
  59. #define MCFSIM_DMR0 (MCF_MBAR + 0x10c) /* DRAM 0 Mask */
  60. /*
  61. * Secondary Interrupt Controller (in MBAR2)
  62. */
  63. #define MCFINTC2_INTBASE (MCF_MBAR2 + 0x168) /* Base Vector Reg */
  64. #define MCFINTC2_INTPRI1 (MCF_MBAR2 + 0x140) /* 0-7 priority */
  65. #define MCFINTC2_INTPRI2 (MCF_MBAR2 + 0x144) /* 8-15 priority */
  66. #define MCFINTC2_INTPRI3 (MCF_MBAR2 + 0x148) /* 16-23 priority */
  67. #define MCFINTC2_INTPRI4 (MCF_MBAR2 + 0x14c) /* 24-31 priority */
  68. #define MCFINTC2_INTPRI5 (MCF_MBAR2 + 0x150) /* 32-39 priority */
  69. #define MCFINTC2_INTPRI6 (MCF_MBAR2 + 0x154) /* 40-47 priority */
  70. #define MCFINTC2_INTPRI7 (MCF_MBAR2 + 0x158) /* 48-55 priority */
  71. #define MCFINTC2_INTPRI8 (MCF_MBAR2 + 0x15c) /* 56-63 priority */
  72. #define MCFINTC2_INTPRI_REG(i) (MCFINTC2_INTPRI1 + \
  73. ((((i) - MCFINTC2_VECBASE) / 8) * 4))
  74. #define MCFINTC2_INTPRI_BITS(b, i) ((b) << (((i) % 8) * 4))
  75. /*
  76. * Timer module.
  77. */
  78. #define MCFTIMER_BASE1 (MCF_MBAR + 0x140) /* Base of TIMER1 */
  79. #define MCFTIMER_BASE2 (MCF_MBAR + 0x180) /* Base of TIMER2 */
  80. /*
  81. * UART module.
  82. */
  83. #define MCFUART_BASE0 (MCF_MBAR + 0x1c0) /* Base address UART0 */
  84. #define MCFUART_BASE1 (MCF_MBAR + 0x200) /* Base address UART1 */
  85. /*
  86. * QSPI module.
  87. */
  88. #define MCFQSPI_BASE (MCF_MBAR + 0x300) /* Base address QSPI */
  89. #define MCFQSPI_SIZE 0x40 /* Register set size */
  90. #define MCFQSPI_CS0 15
  91. #define MCFQSPI_CS1 16
  92. #define MCFQSPI_CS2 24
  93. #define MCFQSPI_CS3 28
  94. /*
  95. * I2C module.
  96. */
  97. #define MCFI2C_BASE0 (MCF_MBAR + 0x280) /* Base addreess I2C0 */
  98. #define MCFI2C_SIZE0 0x20 /* Register set size */
  99. #define MCFI2C_BASE1 (MCF_MBAR2 + 0x440) /* Base addreess I2C1 */
  100. #define MCFI2C_SIZE1 0x20 /* Register set size */
  101. /*
  102. * DMA unit base addresses.
  103. */
  104. #define MCFDMA_BASE0 (MCF_MBAR + 0x300) /* Base address DMA 0 */
  105. #define MCFDMA_BASE1 (MCF_MBAR + 0x340) /* Base address DMA 1 */
  106. #define MCFDMA_BASE2 (MCF_MBAR + 0x380) /* Base address DMA 2 */
  107. #define MCFDMA_BASE3 (MCF_MBAR + 0x3C0) /* Base address DMA 3 */
  108. /*
  109. * Some symbol defines for the above...
  110. */
  111. #define MCFSIM_SWDICR MCFSIM_ICR0 /* Watchdog timer ICR */
  112. #define MCFSIM_TIMER1ICR MCFSIM_ICR1 /* Timer 1 ICR */
  113. #define MCFSIM_TIMER2ICR MCFSIM_ICR2 /* Timer 2 ICR */
  114. #define MCFSIM_I2CICR MCFSIM_ICR3 /* I2C ICR */
  115. #define MCFSIM_UART1ICR MCFSIM_ICR4 /* UART 1 ICR */
  116. #define MCFSIM_UART2ICR MCFSIM_ICR5 /* UART 2 ICR */
  117. #define MCFSIM_DMA0ICR MCFSIM_ICR6 /* DMA 0 ICR */
  118. #define MCFSIM_DMA1ICR MCFSIM_ICR7 /* DMA 1 ICR */
  119. #define MCFSIM_DMA2ICR MCFSIM_ICR8 /* DMA 2 ICR */
  120. #define MCFSIM_DMA3ICR MCFSIM_ICR9 /* DMA 3 ICR */
  121. #define MCFSIM_QSPIICR MCFSIM_ICR10 /* QSPI ICR */
  122. /*
  123. * Define system peripheral IRQ usage.
  124. */
  125. #define MCF_IRQ_QSPI 28 /* QSPI, Level 4 */
  126. #define MCF_IRQ_I2C0 29
  127. #define MCF_IRQ_TIMER 30 /* Timer0, Level 6 */
  128. #define MCF_IRQ_PROFILER 31 /* Timer1, Level 7 */
  129. #define MCF_IRQ_UART0 73 /* UART0 */
  130. #define MCF_IRQ_UART1 74 /* UART1 */
  131. /*
  132. * Define the base interrupt for the second interrupt controller.
  133. * We set it to 128, out of the way of the base interrupts, and plenty
  134. * of room for its 64 interrupts.
  135. */
  136. #define MCFINTC2_VECBASE 128
  137. #define MCF_IRQ_GPIO0 (MCFINTC2_VECBASE + 32)
  138. #define MCF_IRQ_GPIO1 (MCFINTC2_VECBASE + 33)
  139. #define MCF_IRQ_GPIO2 (MCFINTC2_VECBASE + 34)
  140. #define MCF_IRQ_GPIO3 (MCFINTC2_VECBASE + 35)
  141. #define MCF_IRQ_GPIO4 (MCFINTC2_VECBASE + 36)
  142. #define MCF_IRQ_GPIO5 (MCFINTC2_VECBASE + 37)
  143. #define MCF_IRQ_GPIO6 (MCFINTC2_VECBASE + 38)
  144. #define MCF_IRQ_USBWUP (MCFINTC2_VECBASE + 40)
  145. #define MCF_IRQ_I2C1 (MCFINTC2_VECBASE + 62)
  146. /*
  147. * General purpose IO registers (in MBAR2).
  148. */
  149. #define MCFSIM2_GPIOREAD (MCF_MBAR2 + 0x000) /* GPIO read values */
  150. #define MCFSIM2_GPIOWRITE (MCF_MBAR2 + 0x004) /* GPIO write values */
  151. #define MCFSIM2_GPIOENABLE (MCF_MBAR2 + 0x008) /* GPIO enabled */
  152. #define MCFSIM2_GPIOFUNC (MCF_MBAR2 + 0x00C) /* GPIO function */
  153. #define MCFSIM2_GPIO1READ (MCF_MBAR2 + 0x0B0) /* GPIO1 read values */
  154. #define MCFSIM2_GPIO1WRITE (MCF_MBAR2 + 0x0B4) /* GPIO1 write values */
  155. #define MCFSIM2_GPIO1ENABLE (MCF_MBAR2 + 0x0B8) /* GPIO1 enabled */
  156. #define MCFSIM2_GPIO1FUNC (MCF_MBAR2 + 0x0BC) /* GPIO1 function */
  157. #define MCFSIM2_GPIOINTSTAT (MCF_MBAR2 + 0xc0) /* GPIO intr status */
  158. #define MCFSIM2_GPIOINTCLEAR (MCF_MBAR2 + 0xc0) /* GPIO intr clear */
  159. #define MCFSIM2_GPIOINTENABLE (MCF_MBAR2 + 0xc4) /* GPIO intr enable */
  160. /*
  161. * Generic GPIO support
  162. */
  163. #define MCFGPIO_PIN_MAX 64
  164. #define MCFGPIO_IRQ_MAX 7
  165. #define MCFGPIO_IRQ_VECBASE MCF_IRQ_GPIO0
  166. /****************************************************************************/
  167. #endif /* m525xsim_h */