m520x.h 12 KB

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