mx31-regs.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /*
  2. *
  3. * (c) 2007 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #ifndef __ASM_ARCH_MX31_REGS_H
  24. #define __ASM_ARCH_MX31_REGS_H
  25. #define __REG(x) (*((volatile u32 *)(x)))
  26. #define __REG16(x) (*((volatile u16 *)(x)))
  27. #define __REG8(x) (*((volatile u8 *)(x)))
  28. #define CCM_BASE 0x53f80000
  29. #define CCM_CCMR (CCM_BASE + 0x00)
  30. #define CCM_PDR0 (CCM_BASE + 0x04)
  31. #define CCM_PDR1 (CCM_BASE + 0x08)
  32. #define CCM_RCSR (CCM_BASE + 0x0c)
  33. #define CCM_MPCTL (CCM_BASE + 0x10)
  34. #define CCM_UPCTL (CCM_BASE + 0x14)
  35. #define CCM_SPCTL (CCM_BASE + 0x18)
  36. #define CCM_COSR (CCM_BASE + 0x1C)
  37. #define CCM_CGR0 (CCM_BASE + 0x20)
  38. #define CCM_CGR1 (CCM_BASE + 0x24)
  39. #define CCM_CGR2 (CCM_BASE + 0x28)
  40. #define CCMR_MDS (1 << 7)
  41. #define CCMR_SBYCS (1 << 4)
  42. #define CCMR_MPE (1 << 3)
  43. #define CCMR_PRCS_MASK (3 << 1)
  44. #define CCMR_FPM (1 << 1)
  45. #define CCMR_CKIH (2 << 1)
  46. #define PDR0_CSI_PODF(x) (((x) & 0x1ff) << 23)
  47. #define PDR0_PER_PODF(x) (((x) & 0x1f) << 16)
  48. #define PDR0_HSP_PODF(x) (((x) & 0x7) << 11)
  49. #define PDR0_NFC_PODF(x) (((x) & 0x7) << 8)
  50. #define PDR0_IPG_PODF(x) (((x) & 0x3) << 6)
  51. #define PDR0_MAX_PODF(x) (((x) & 0x7) << 3)
  52. #define PDR0_MCU_PODF(x) ((x) & 0x7)
  53. #define PLL_PD(x) (((x) & 0xf) << 26)
  54. #define PLL_MFD(x) (((x) & 0x3ff) << 16)
  55. #define PLL_MFI(x) (((x) & 0xf) << 10)
  56. #define PLL_MFN(x) (((x) & 0x3ff) << 0)
  57. #define WEIM_BASE 0xb8002000
  58. #define CSCR_U(x) (WEIM_BASE + (x) * 0x10)
  59. #define CSCR_L(x) (WEIM_BASE + 4 + (x) * 0x10)
  60. #define CSCR_A(x) (WEIM_BASE + 8 + (x) * 0x10)
  61. #define IOMUXC_BASE 0x43FAC000
  62. #define IOMUXC_GPR (IOMUXC_BASE + 0x8)
  63. #define IOMUXC_SW_MUX_CTL(x) (IOMUXC_BASE + 0xc + (x) * 4)
  64. #define IOMUXC_SW_PAD_CTL(x) (IOMUXC_BASE + 0x154 + (x) * 4)
  65. #define IPU_BASE 0x53fc0000
  66. #define IPU_CONF IPU_BASE
  67. #define IPU_CONF_PXL_ENDIAN (1<<8)
  68. #define IPU_CONF_DU_EN (1<<7)
  69. #define IPU_CONF_DI_EN (1<<6)
  70. #define IPU_CONF_ADC_EN (1<<5)
  71. #define IPU_CONF_SDC_EN (1<<4)
  72. #define IPU_CONF_PF_EN (1<<3)
  73. #define IPU_CONF_ROT_EN (1<<2)
  74. #define IPU_CONF_IC_EN (1<<1)
  75. #define IPU_CONF_SCI_EN (1<<0)
  76. #define WDOG_BASE 0x53FDC000
  77. /*
  78. * GPIO
  79. */
  80. #define GPIO1_BASE 0x53FCC000
  81. #define GPIO2_BASE 0x53FD0000
  82. #define GPIO3_BASE 0x53FA4000
  83. #define GPIO_DR 0x00000000 /* data register */
  84. #define GPIO_GDIR 0x00000004 /* direction register */
  85. #define GPIO_PSR 0x00000008 /* pad status register */
  86. /*
  87. * Signal Multiplexing (IOMUX)
  88. */
  89. /* bits in the SW_MUX_CTL registers */
  90. #define MUX_CTL_OUT_GPIO_DR (0 << 4)
  91. #define MUX_CTL_OUT_FUNC (1 << 4)
  92. #define MUX_CTL_OUT_ALT1 (2 << 4)
  93. #define MUX_CTL_OUT_ALT2 (3 << 4)
  94. #define MUX_CTL_OUT_ALT3 (4 << 4)
  95. #define MUX_CTL_OUT_ALT4 (5 << 4)
  96. #define MUX_CTL_OUT_ALT5 (6 << 4)
  97. #define MUX_CTL_OUT_ALT6 (7 << 4)
  98. #define MUX_CTL_IN_NONE (0 << 0)
  99. #define MUX_CTL_IN_GPIO (1 << 0)
  100. #define MUX_CTL_IN_FUNC (2 << 0)
  101. #define MUX_CTL_IN_ALT1 (4 << 0)
  102. #define MUX_CTL_IN_ALT2 (8 << 0)
  103. #define MUX_CTL_FUNC (MUX_CTL_OUT_FUNC | MUX_CTL_IN_FUNC)
  104. #define MUX_CTL_ALT1 (MUX_CTL_OUT_ALT1 | MUX_CTL_IN_ALT1)
  105. #define MUX_CTL_ALT2 (MUX_CTL_OUT_ALT2 | MUX_CTL_IN_ALT2)
  106. #define MUX_CTL_GPIO (MUX_CTL_OUT_GPIO_DR | MUX_CTL_IN_GPIO)
  107. /* Register offsets based on IOMUXC_BASE */
  108. /* 0x00 .. 0x7b */
  109. #define MUX_CTL_RTS1 0x7c
  110. #define MUX_CTL_CTS1 0x7d
  111. #define MUX_CTL_DTR_DCE1 0x7e
  112. #define MUX_CTL_DSR_DCE1 0x7f
  113. #define MUX_CTL_CSPI2_SCLK 0x80
  114. #define MUX_CTL_CSPI2_SPI_RDY 0x81
  115. #define MUX_CTL_RXD1 0x82
  116. #define MUX_CTL_TXD1 0x83
  117. #define MUX_CTL_CSPI2_MISO 0x84
  118. #define MUX_CTL_CSPI2_SS0 0x85
  119. #define MUX_CTL_CSPI2_SS1 0x86
  120. #define MUX_CTL_CSPI2_SS2 0x87
  121. #define MUX_CTL_CSPI1_SS2 0x88
  122. #define MUX_CTL_CSPI1_SCLK 0x89
  123. #define MUX_CTL_CSPI1_SPI_RDY 0x8a
  124. #define MUX_CTL_CSPI2_MOSI 0x8b
  125. #define MUX_CTL_CSPI1_MOSI 0x8c
  126. #define MUX_CTL_CSPI1_MISO 0x8d
  127. #define MUX_CTL_CSPI1_SS0 0x8e
  128. #define MUX_CTL_CSPI1_SS1 0x8f
  129. /*
  130. * Helper macros for the MUX_[contact name]__[pin function] macros
  131. */
  132. #define IOMUX_MODE_POS 9
  133. #define IOMUX_MODE(contact, mode) (((mode) << IOMUX_MODE_POS) | (contact))
  134. /*
  135. * These macros can be used in mx31_gpio_mux() and have the form
  136. * MUX_[contact name]__[pin function]
  137. */
  138. #define MUX_RXD1__UART1_RXD_MUX IOMUX_MODE(MUX_CTL_RXD1, MUX_CTL_FUNC)
  139. #define MUX_TXD1__UART1_TXD_MUX IOMUX_MODE(MUX_CTL_TXD1, MUX_CTL_FUNC)
  140. #define MUX_RTS1__UART1_RTS_B IOMUX_MODE(MUX_CTL_RTS1, MUX_CTL_FUNC)
  141. #define MUX_CTS1__UART1_CTS_B IOMUX_MODE(MUX_CTL_CTS1, MUX_CTL_FUNC)
  142. #define MUX_CSPI2_SS0__CSPI2_SS0_B IOMUX_MODE(MUX_CTL_CSPI2_SS0, MUX_CTL_FUNC)
  143. #define MUX_CSPI2_SS1__CSPI2_SS1_B IOMUX_MODE(MUX_CTL_CSPI2_SS1, MUX_CTL_FUNC)
  144. #define MUX_CSPI2_SS2__CSPI2_SS2_B IOMUX_MODE(MUX_CTL_CSPI2_SS2, MUX_CTL_FUNC)
  145. #define MUX_CSPI2_MOSI__CSPI2_MOSI IOMUX_MODE(MUX_CTL_CSPI2_MOSI, MUX_CTL_FUNC)
  146. #define MUX_CSPI2_MISO__CSPI2_MISO IOMUX_MODE(MUX_CTL_CSPI2_MISO, MUX_CTL_FUNC)
  147. #define MUX_CSPI2_SPI_RDY__CSPI2_DATAREADY_B \
  148. IOMUX_MODE(MUX_CTL_CSPI2_SPI_RDY, MUX_CTL_FUNC)
  149. #define MUX_CSPI2_SCLK__CSPI2_CLK IOMUX_MODE(MUX_CTL_CSPI2_SCLK, MUX_CTL_FUNC)
  150. #define MUX_CSPI1_SS0__CSPI1_SS0_B IOMUX_MODE(MUX_CTL_CSPI1_SS0, MUX_CTL_FUNC)
  151. #define MUX_CSPI1_SS1__CSPI1_SS1_B IOMUX_MODE(MUX_CTL_CSPI1_SS1, MUX_CTL_FUNC)
  152. #define MUX_CSPI1_SS2__CSPI1_SS2_B IOMUX_MODE(MUX_CTL_CSPI1_SS2, MUX_CTL_FUNC)
  153. #define MUX_CSPI1_MOSI__CSPI1_MOSI IOMUX_MODE(MUX_CTL_CSPI1_MOSI, MUX_CTL_FUNC)
  154. #define MUX_CSPI1_MISO__CSPI1_MISO IOMUX_MODE(MUX_CTL_CSPI1_MISO, MUX_CTL_FUNC)
  155. #define MUX_CSPI1_SPI_RDY__CSPI1_DATAREADY_B \
  156. IOMUX_MODE(MUX_CTL_CSPI1_SPI_RDY, MUX_CTL_FUNC)
  157. #define MUX_CSPI1_SCLK__CSPI1_CLK IOMUX_MODE(MUX_CTL_CSPI1_SCLK, MUX_CTL_FUNC)
  158. #define MUX_CSPI2_MOSI__I2C2_SCL IOMUX_MODE(MUX_CTL_CSPI2_MOSI, MUX_CTL_ALT1)
  159. #define MUX_CSPI2_MISO__I2C2_SDA IOMUX_MODE(MUX_CTL_CSPI2_MISO, MUX_CTL_ALT1)
  160. /*
  161. * Memory regions and CS
  162. */
  163. #define IPU_MEM_BASE 0x70000000
  164. #define CSD0_BASE 0x80000000
  165. #define CSD1_BASE 0x90000000
  166. #define CS0_BASE 0xA0000000
  167. #define CS1_BASE 0xA8000000
  168. #define CS2_BASE 0xB0000000
  169. #define CS3_BASE 0xB2000000
  170. #define CS4_BASE 0xB4000000
  171. #define CS4_PSRAM_BASE 0xB5000000
  172. #define CS5_BASE 0xB6000000
  173. #define PCMCIA_MEM_BASE 0xC0000000
  174. /*
  175. * NAND controller
  176. */
  177. #define NFC_BASE_ADDR 0xB8000000
  178. #endif /* __ASM_ARCH_MX31_REGS_H */