m520x.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. /*
  2. * m520x.h -- Definitions for Freescale Coldfire 520x
  3. *
  4. * Copyright (C) 2004-2009 Freescale Semiconductor, Inc.
  5. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. #ifndef __M520X__
  10. #define __M520X__
  11. /* *** System Control Module (SCM) *** */
  12. #define SCM_MPR_MPROT0(x) (((x) & 0x0F) << 28)
  13. #define SCM_MPR_MPROT1(x) (((x) & 0x0F) << 24)
  14. #define SCM_MPR_MPROT2(x) (((x) & 0x0F) << 20)
  15. #define MPROT_MTR 4
  16. #define MPROT_MTW 2
  17. #define MPROT_MPL 1
  18. #define SCM_PACRA_PACR0(x) (((x) & 0x0F) << 28)
  19. #define SCM_PACRA_PACR1(x) (((x) & 0x0F) << 24)
  20. #define SCM_PACRA_PACR2(x) (((x) & 0x0F) << 20)
  21. #define SCM_PACRB_PACR12(x) (((x) & 0x0F) << 12)
  22. #define SCM_PACRC_PACR16(x) (((x) & 0x0F) << 28)
  23. #define SCM_PACRC_PACR17(x) (((x) & 0x0F) << 24)
  24. #define SCM_PACRC_PACR18(x) (((x) & 0x0F) << 20)
  25. #define SCM_PACRC_PACR21(x) (((x) & 0x0F) << 8)
  26. #define SCM_PACRC_PACR22(x) (((x) & 0x0F) << 4)
  27. #define SCM_PACRC_PACR23(x) ((x) & 0x0F)
  28. #define SCM_PACRD_PACR24(x) (((x) & 0x0F) << 28)
  29. #define SCM_PACRD_PACR25(x) (((x) & 0x0F) << 24)
  30. #define SCM_PACRD_PACR26(x) (((x) & 0x0F) << 20)
  31. #define SCM_PACRD_PACR28(x) (((x) & 0x0F) << 12)
  32. #define SCM_PACRD_PACR29(x) (((x) & 0x0F) << 8)
  33. #define SCM_PACRD_PACR30(x) (((x) & 0x0F) << 4)
  34. #define SCM_PACRD_PACR31(x) ((x) & 0x0F)
  35. #define SCM_PACRE_PACR32(x) (((x) & 0x0F) << 28)
  36. #define SCM_PACRE_PACR33(x) (((x) & 0x0F) << 24)
  37. #define SCM_PACRE_PACR34(x) (((x) & 0x0F) << 20)
  38. #define SCM_PACRE_PACR35(x) (((x) & 0x0F) << 16)
  39. #define SCM_PACRE_PACR36(x) (((x) & 0x0F) << 12)
  40. #define SCM_PACRF_PACR40(x) (((x) & 0x0F) << 28)
  41. #define SCM_PACRF_PACR41(x) (((x) & 0x0F) << 24)
  42. #define SCM_PACRF_PACR42(x) (((x) & 0x0F) << 20)
  43. #define PACR_SP 4
  44. #define PACR_WP 2
  45. #define PACR_TP 1
  46. #define SCM_BMT_BME (0x00000008)
  47. #define SCM_BMT_BMT(x) ((x) & 0x07)
  48. #define SCM_BMT_BMT1024 (0x0000)
  49. #define SCM_BMT_BMT512 (0x0001)
  50. #define SCM_BMT_BMT256 (0x0002)
  51. #define SCM_BMT_BMT128 (0x0003)
  52. #define SCM_BMT_BMT64 (0x0004)
  53. #define SCM_BMT_BMT32 (0x0005)
  54. #define SCM_BMT_BMT16 (0x0006)
  55. #define SCM_BMT_BMT8 (0x0007)
  56. #define SCM_CWCR_RO (0x8000)
  57. #define SCM_CWCR_CWR_WH (0x0100)
  58. #define SCM_CWCR_CWE (0x0080)
  59. #define SCM_CWRI_WINDOW (0x0060)
  60. #define SCM_CWRI_RESET (0x0040)
  61. #define SCM_CWRI_INT_RESET (0x0020)
  62. #define SCM_CWRI_INT (0x0000)
  63. #define SCM_CWCR_CWT(x) (((x) & 0x001F))
  64. #define SCM_ISR_CFEI (0x02)
  65. #define SCM_ISR_CWIC (0x01)
  66. #define SCM_CFIER_ECFEI (0x01)
  67. #define SCM_CFLOC_LOC (0x80)
  68. #define SCM_CFATR_WRITE (0x80)
  69. #define SCM_CFATR_SZ32 (0x20)
  70. #define SCM_CFATR_SZ16 (0x10)
  71. #define SCM_CFATR_SZ08 (0x00)
  72. #define SCM_CFATR_CACHE (0x08)
  73. #define SCM_CFATR_MODE (0x02)
  74. #define SCM_CFATR_TYPE (0x01)
  75. /* *** Interrupt Controller (INTC) *** */
  76. #define INT0_LO_RSVD0 (0)
  77. #define INT0_LO_EPORT_F1 (1)
  78. #define INT0_LO_EPORT_F4 (2)
  79. #define INT0_LO_EPORT_F7 (3)
  80. #define INT1_LO_PIT0 (4)
  81. #define INT1_LO_PIT1 (5)
  82. /* 6 - 7 rsvd */
  83. #define INT0_LO_EDMA_00 (8)
  84. #define INT0_LO_EDMA_01 (9)
  85. #define INT0_LO_EDMA_02 (10)
  86. #define INT0_LO_EDMA_03 (11)
  87. #define INT0_LO_EDMA_04 (12)
  88. #define INT0_LO_EDMA_05 (13)
  89. #define INT0_LO_EDMA_06 (14)
  90. #define INT0_LO_EDMA_07 (15)
  91. #define INT0_LO_EDMA_08 (16)
  92. #define INT0_LO_EDMA_09 (17)
  93. #define INT0_LO_EDMA_10 (18)
  94. #define INT0_LO_EDMA_11 (19)
  95. #define INT0_LO_EDMA_12 (20)
  96. #define INT0_LO_EDMA_13 (21)
  97. #define INT0_LO_EDMA_14 (22)
  98. #define INT0_LO_EDMA_15 (23)
  99. #define INT0_LO_EDMA_ERR (24)
  100. #define INT0_LO_SCM_CWIC (25)
  101. #define INT0_LO_UART0 (26)
  102. #define INT0_LO_UART1 (27)
  103. #define INT0_LO_UART2 (28)
  104. /* 29 rsvd */
  105. #define INT0_LO_I2C (30)
  106. #define INT0_LO_QSPI (31)
  107. #define INT0_HI_DTMR0 (32)
  108. #define INT0_HI_DTMR1 (33)
  109. #define INT0_HI_DTMR2 (34)
  110. #define INT0_HI_DTMR3 (35)
  111. #define INT0_HI_FEC0_TXF (36)
  112. #define INT0_HI_FEC0_TXB (37)
  113. #define INT0_HI_FEC0_UN (38)
  114. #define INT0_HI_FEC0_RL (39)
  115. #define INT0_HI_FEC0_RXF (40)
  116. #define INT0_HI_FEC0_RXB (41)
  117. #define INT0_HI_FEC0_MII (42)
  118. #define INT0_HI_FEC0_LC (43)
  119. #define INT0_HI_FEC0_HBERR (44)
  120. #define INT0_HI_FEC0_GRA (45)
  121. #define INT0_HI_FEC0_EBERR (46)
  122. #define INT0_HI_FEC0_BABT (47)
  123. #define INT0_HI_FEC0_BABR (48)
  124. /* 49 - 61 rsvd */
  125. #define INT0_HI_SCMISR_CFEI (62)
  126. /* *** Reset Controller Module (RCM) *** */
  127. #define RCM_RCR_SOFTRST (0x80)
  128. #define RCM_RCR_FRCRSTOUT (0x40)
  129. #define RCM_RSR_SOFT (0x20)
  130. #define RCM_RSR_WDOG (0x10)
  131. #define RCM_RSR_POR (0x08)
  132. #define RCM_RSR_EXT (0x04)
  133. #define RCM_RSR_WDR_CORE (0x02)
  134. #define RCM_RSR_LOL (0x01)
  135. /* *** Chip Configuration Module (CCM) *** */
  136. #define CCM_CCR_CSC (0x0200)
  137. #define CCM_CCR_OSCFREQ (0x0080)
  138. #define CCM_CCR_LIMP (0x0040)
  139. #define CCM_CCR_LOAD (0x0020)
  140. #define CCM_CCR_BOOTPS(x) (((x) & 0x0003) << 3)
  141. #define CCM_CCR_OSC_MODE (0x0004)
  142. #define CCM_CCR_PLL_MODE (0x0002)
  143. #define CCM_CCR_RESERVED (0x0001)
  144. #define CCM_CIR_PIN(x) (((x) & 0xFFC0) >> 6)
  145. #define CCM_CIR_PRN(x) ((x) & 0x003F)
  146. /* *** General Purpose I/O (GPIO) *** */
  147. #define GPIO_PDR_BUSCTL(x) ((x) & 0x0F)
  148. #define GPIO_PDR_BE(x) ((x) & 0x0F)
  149. #define GPIO_PDR_CS(x) (((x) & 0x07) << 1)
  150. #define GPIO_PDR_FECI2C(x) ((x) & 0x0F)
  151. #define GPIO_PDR_QSPI(x) ((x) & 0x0F)
  152. #define GPIO_PDR_TIMER(x) ((x) & 0x0F)
  153. #define GPIO_PDR_UART(x) ((x) & 0xFF)
  154. #define GPIO_PDR_FECH(x) ((x) & 0xFF)
  155. #define GPIO_PDR_FECL(x) ((x) & 0xFF)
  156. #define GPIO_PAR_FBCTL_OE (0x10)
  157. #define GPIO_PAR_FBCTL_TA (0x08)
  158. #define GPIO_PAR_FBCTL_RWB (0x04)
  159. #define GPIO_PAR_FBCTL_TS_UNMASK (0xFC)
  160. #define GPIO_PAR_FBCTL_TS_TS (0x03)
  161. #define GPIO_PAR_FBCTL_TS_DMA (0x02)
  162. #define GPIO_PAR_BE3 (0x08)
  163. #define GPIO_PAR_BE2 (0x04)
  164. #define GPIO_PAR_BE1 (0x02)
  165. #define GPIO_PAR_BE0 (0x01)
  166. #define GPIO_PAR_CS3 (0x08)
  167. #define GPIO_PAR_CS2 (0x04)
  168. #define GPIO_PAR_CS1_UNMASK (0xFC)
  169. #define GPIO_PAR_CS1_CS1 (0x03)
  170. #define GPIO_PAR_CS1_SDCS1 (0x02)
  171. #define GPIO_PAR_FECI2C_RMII_UNMASK (0x0F)
  172. #define GPIO_PAR_FECI2C_MDC_UNMASK (0x3F)
  173. #define GPIO_PAR_FECI2C_MDC_MDC (0xC0)
  174. #define GPIO_PAR_FECI2C_MDC_SCL (0x80)
  175. #define GPIO_PAR_FECI2C_MDC_U2TXD (0x40)
  176. #define GPIO_PAR_FECI2C_MDIO_UNMASK (0xCF)
  177. #define GPIO_PAR_FECI2C_MDIO_MDIO (0x30)
  178. #define GPIO_PAR_FECI2C_MDIO_SDA (0x20)
  179. #define GPIO_PAR_FECI2C_MDIO_U2RXD (0x10)
  180. #define GPIO_PAR_FECI2C_I2C_UNMASK (0xF0)
  181. #define GPIO_PAR_FECI2C_SCL_UNMASK (0xF3)
  182. #define GPIO_PAR_FECI2C_SCL_SCL (0x0C)
  183. #define GPIO_PAR_FECI2C_SCL_U2RXD (0x04)
  184. #define GPIO_PAR_FECI2C_SDA_UNMASK (0xFC)
  185. #define GPIO_PAR_FECI2C_SDA_SDA (0x03)
  186. #define GPIO_PAR_FECI2C_SDA_U2TXD (0x01)
  187. #define GPIO_PAR_QSPI_PCS2_UNMASK (0x3F)
  188. #define GPIO_PAR_QSPI_PCS2_PCS2 (0xC0)
  189. #define GPIO_PAR_QSPI_PCS2_DACK0 (0x80)
  190. #define GPIO_PAR_QSPI_PCS2_U2RTS (0x40)
  191. #define GPIO_PAR_QSPI_DIN_UNMASK (0xCF)
  192. #define GPIO_PAR_QSPI_DIN_DIN (0x30)
  193. #define GPIO_PAR_QSPI_DIN_DREQ0 (0x20)
  194. #define GPIO_PAR_QSPI_DIN_U2CTS (0x10)
  195. #define GPIO_PAR_QSPI_DOUT_UNMASK (0xF3)
  196. #define GPIO_PAR_QSPI_DOUT_DOUT (0x0C)
  197. #define GPIO_PAR_QSPI_DOUT_SDA (0x08)
  198. #define GPIO_PAR_QSPI_SCK_UNMASK (0xFC)
  199. #define GPIO_PAR_QSPI_SCK_SCK (0x03)
  200. #define GPIO_PAR_QSPI_SCK_SCL (0x02)
  201. #define GPIO_PAR_TMR_TIN3(x) (((x) & 0x03) << 6)
  202. #define GPIO_PAR_TMR_TIN2(x) (((x) & 0x03) << 4)
  203. #define GPIO_PAR_TMR_TIN1(x) (((x) & 0x03) << 2)
  204. #define GPIO_PAR_TMR_TIN0(x) ((x) & 0x03)
  205. #define GPIO_PAR_TMR_TIN3_UNMASK (0x3F)
  206. #define GPIO_PAR_TMR_TIN3_TIN3 (0xC0)
  207. #define GPIO_PAR_TMR_TIN3_TOUT3 (0x80)
  208. #define GPIO_PAR_TMR_TIN3_U2CTS (0x40)
  209. #define GPIO_PAR_TMR_TIN2_UNMASK (0xCF)
  210. #define GPIO_PAR_TMR_TIN2_TIN2 (0x30)
  211. #define GPIO_PAR_TMR_TIN2_TOUT2 (0x20)
  212. #define GPIO_PAR_TMR_TIN2_U2RTS (0x10)
  213. #define GPIO_PAR_TMR_TIN1_UNMASK (0xF3)
  214. #define GPIO_PAR_TMR_TIN1_TIN1 (0x0C)
  215. #define GPIO_PAR_TMR_TIN1_TOUT1 (0x08)
  216. #define GPIO_PAR_TMR_TIN1_U2RXD (0x04)
  217. #define GPIO_PAR_TMR_TIN0_UNMASK (0xFC)
  218. #define GPIO_PAR_TMR_TIN0_TIN0 (0x03)
  219. #define GPIO_PAR_TMR_TIN0_TOUT0 (0x02)
  220. #define GPIO_PAR_TMR_TIN0_U2TXD (0x01)
  221. #define GPIO_PAR_UART1_UNMASK (0xF03F)
  222. #define GPIO_PAR_UART0_UNMASK (0xFFC0)
  223. #define GPIO_PAR_UART_U1CTS_UNMASK (0xF3FF)
  224. #define GPIO_PAR_UART_U1CTS_U1CTS (0x0C00)
  225. #define GPIO_PAR_UART_U1CTS_TIN1 (0x0800)
  226. #define GPIO_PAR_UART_U1CTS_PCS1 (0x0400)
  227. #define GPIO_PAR_UART_U1RTS_UNMASK (0xFCFF)
  228. #define GPIO_PAR_UART_U1RTS_U1RTS (0x0300)
  229. #define GPIO_PAR_UART_U1RTS_TOUT1 (0x0200)
  230. #define GPIO_PAR_UART_U1RTS_PCS1 (0x0100)
  231. #define GPIO_PAR_UART_U1TXD (0x0080)
  232. #define GPIO_PAR_UART_U1RXD (0x0040)
  233. #define GPIO_PAR_UART_U0CTS_UNMASK (0xFFCF)
  234. #define GPIO_PAR_UART_U0CTS_U0CTS (0x0030)
  235. #define GPIO_PAR_UART_U0CTS_TIN0 (0x0020)
  236. #define GPIO_PAR_UART_U0CTS_PCS0 (0x0010)
  237. #define GPIO_PAR_UART_U0RTS_UNMASK (0xFFF3)
  238. #define GPIO_PAR_UART_U0RTS_U0RTS (0x000C)
  239. #define GPIO_PAR_UART_U0RTS_TOUT0 (0x0008)
  240. #define GPIO_PAR_UART_U0RTS_PCS0 (0x0004)
  241. #define GPIO_PAR_UART_U0TXD (0x0002)
  242. #define GPIO_PAR_UART_U0RXD (0x0001)
  243. #define GPIO_PAR_FEC_7W_UNMASK (0xF3)
  244. #define GPIO_PAR_FEC_7W_FEC (0x0C)
  245. #define GPIO_PAR_FEC_7W_U1RTS (0x04)
  246. #define GPIO_PAR_FEC_MII_UNMASK (0xFC)
  247. #define GPIO_PAR_FEC_MII_FEC (0x03)
  248. #define GPIO_PAR_FEC_MII_UnCTS (0x01)
  249. #define GPIO_PAR_IRQ_IRQ4 (0x01)
  250. #define GPIO_MSCR_FB_FBCLK(x) (((x) & 0x03) << 6)
  251. #define GPIO_MSCR_FB_DUP(x) (((x) & 0x03) << 4)
  252. #define GPIO_MSCR_FB_DLO(x) (((x) & 0x03) << 2)
  253. #define GPIO_MSCR_FB_ADRCTL(x) ((x) & 0x03)
  254. #define GPIO_MSCR_FB_FBCLK_UNMASK (0x3F)
  255. #define GPIO_MSCR_FB_DUP_UNMASK (0xCF)
  256. #define GPIO_MSCR_FB_DLO_UNMASK (0xF3)
  257. #define GPIO_MSCR_FB_ADRCTL_UNMASK (0xFC)
  258. #define GPIO_MSCR_SDR_SDCLKB(x) (((x) & 0x03) << 4)
  259. #define GPIO_MSCR_SDR_SDCLK(x) (((x) & 0x03) << 2)
  260. #define GPIO_MSCR_SDR_SDRAM(x) ((x) & 0x03)
  261. #define GPIO_MSCR_SDR_SDCLKB_UNMASK (0xCF)
  262. #define GPIO_MSCR_SDR_SDCLK_UNMASK (0xF3)
  263. #define GPIO_MSCR_SDR_SDRAM_UNMASK (0xFC)
  264. #define MSCR_25VDDR (0x03)
  265. #define MSCR_18VDDR_FULL (0x02)
  266. #define MSCR_OPENDRAIN (0x01)
  267. #define MSCR_18VDDR_HALF (0x00)
  268. #define GPIO_DSCR_I2C(x) ((x) & 0x03)
  269. #define GPIO_DSCR_I2C_UNMASK (0xFC)
  270. #define GPIO_DSCR_MISC_DBG(x) (((x) & 0x03) << 4)
  271. #define GPIO_DSCR_MISC_DBG_UNMASK (0xCF)
  272. #define GPIO_DSCR_MISC_RSTOUT(x) (((x) & 0x03) << 2)
  273. #define GPIO_DSCR_MISC_RSTOUT_UNMASK (0xF3)
  274. #define GPIO_DSCR_MISC_TIMER(x) ((x) & 0x03)
  275. #define GPIO_DSCR_MISC_TIMER_UNMASK (0xFC)
  276. #define GPIO_DSCR_FEC(x) ((x) & 0x03)
  277. #define GPIO_DSCR_FEC_UNMASK (0xFC)
  278. #define GPIO_DSCR_UART_UART1(x) (((x) & 0x03) << 4)
  279. #define GPIO_DSCR_UART_UART1_UNMASK (0xCF)
  280. #define GPIO_DSCR_UART_UART0(x) (((x) & 0x03) << 2)
  281. #define GPIO_DSCR_UART_UART0_UNMASK (0xF3)
  282. #define GPIO_DSCR_UART_IRQ(x) ((x) & 0x03)
  283. #define GPIO_DSCR_UART_IRQ_UNMASK (0xFC)
  284. #define GPIO_DSCR_QSPI(x) ((x) & 0x03)
  285. #define GPIO_DSCR_QSPI_UNMASK (0xFC)
  286. #define DSCR_50PF (0x03)
  287. #define DSCR_30PF (0x02)
  288. #define DSCR_20PF (0x01)
  289. #define DSCR_10PF (0x00)
  290. /* *** Phase Locked Loop (PLL) *** */
  291. #define PLL_PODR_CPUDIV(x) (((x) & 0x0F) << 4)
  292. #define PLL_PODR_CPUDIV_UNMASK (0x0F)
  293. #define PLL_PODR_BUSDIV(x) ((x) & 0x0F)
  294. #define PLL_PODR_BUSDIV_UNMASK (0xF0)
  295. #define PLL_PCR_DITHEN (0x80)
  296. #define PLL_PCR_DITHDEV(x) ((x) & 0x07)
  297. #define PLL_PCR_DITHDEV_UNMASK (0xF8)
  298. #endif /* __M520X__ */