m5301x.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. /*
  2. * m5301x.h -- Definitions for Freescale Coldfire 5301x
  3. *
  4. * Copyright (C) 2004-2008 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 m5301x_h
  26. #define m5301x_h
  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 SCM_MPR_MPROT4(x) (((x) & 0x0F) << 12)
  32. #define SCM_MPR_MPROT5(x) (((x) & 0x0F) << 8)
  33. #define SCM_MPR_MPROT6(x) (((x) & 0x0F) << 4)
  34. #define MPROT_MTR 4
  35. #define MPROT_MTW 2
  36. #define MPROT_MPL 1
  37. #define SCM_PACRA_PACR0(x) (((x) & 0x0F) << 28)
  38. #define SCM_PACRA_PACR1(x) (((x) & 0x0F) << 24)
  39. #define SCM_PACRA_PACR2(x) (((x) & 0x0F) << 20)
  40. #define SCM_PACRA_PACR5(x) (((x) & 0x0F) << 8)
  41. #define SCM_PACRB_PACR12(x) (((x) & 0x0F) << 12)
  42. #define SCM_PACRB_PACR13(x) (((x) & 0x0F) << 8)
  43. #define SCM_PACRC_PACR16(x) (((x) & 0x0F) << 28)
  44. #define SCM_PACRC_PACR17(x) (((x) & 0x0F) << 24)
  45. #define SCM_PACRC_PACR18(x) (((x) & 0x0F) << 20)
  46. #define SCM_PACRC_PACR19(x) (((x) & 0x0F) << 16)
  47. #define SCM_PACRC_PACR21(x) (((x) & 0x0F) << 8)
  48. #define SCM_PACRC_PACR22(x) (((x) & 0x0F) << 4)
  49. #define SCM_PACRC_PACR23(x) ((x) & 0x0F)
  50. #define SCM_PACRD_PACR24(x) (((x) & 0x0F) << 28)
  51. #define SCM_PACRD_PACR25(x) (((x) & 0x0F) << 24)
  52. #define SCM_PACRD_PACR26(x) (((x) & 0x0F) << 20)
  53. #define SCM_PACRD_PACR28(x) (((x) & 0x0F) << 12)
  54. #define SCM_PACRD_PACR29(x) (((x) & 0x0F) << 8)
  55. #define SCM_PACRD_PACR30(x) (((x) & 0x0F) << 4)
  56. #define SCM_PACRD_PACR31(x) ((x) & 0x0F)
  57. #define SCM_PACRE_PACR32(x) (((x) & 0x0F) << 28)
  58. #define SCM_PACRE_PACR33(x) (((x) & 0x0F) << 24)
  59. #define SCM_PACRE_PACR34(x) (((x) & 0x0F) << 20)
  60. #define SCM_PACRE_PACR35(x) (((x) & 0x0F) << 16)
  61. #define SCM_PACRE_PACR36(x) (((x) & 0x0F) << 12)
  62. #define SCM_PACRE_PACR37(x) (((x) & 0x0F) << 8)
  63. #define SCM_PACRE_PACR39(x) ((x) & 0x0F)
  64. #define SCM_PACRF_PACR40(x) (((x) & 0x0F) << 28)
  65. #define SCM_PACRF_PACR41(x) (((x) & 0x0F) << 24)
  66. #define SCM_PACRF_PACR42(x) (((x) & 0x0F) << 20)
  67. #define SCM_PACRF_PACR43(x) (((x) & 0x0F) << 16)
  68. #define SCM_PACRF_PACR44(x) (((x) & 0x0F) << 12)
  69. #define SCM_PACRF_PACR45(x) (((x) & 0x0F) << 8)
  70. #define SCM_PACRF_PACR46(x) (((x) & 0x0F) << 4)
  71. #define SCM_PACRF_PACR47(x) ((x) & 0x0F)
  72. #define SCM_PACRG_PACR48(x) (((x) & 0x0F) << 28)
  73. #define SCM_PACRG_PACR49(x) (((x) & 0x0F) << 24)
  74. #define SCM_PACRG_PACR50(x) (((x) & 0x0F) << 20)
  75. #define SCM_PACRG_PACR51(x) (((x) & 0x0F) << 16)
  76. #define PACR_SP 4
  77. #define PACR_WP 2
  78. #define PACR_TP 1
  79. #define SCM_CWCR_RO (0x8000)
  80. #define SCM_CWCR_CWR_WH (0x0100)
  81. #define SCM_CWCR_CWE (0x0080)
  82. #define SCM_CWCR_CWRI_WINDOW (0x0060)
  83. #define SCM_CWCR_CWRI_RESET (0x0040)
  84. #define SCM_CWCR_CWRI_INT_RESET (0x0020)
  85. #define SCM_CWCR_CWRI_INT (0x0000)
  86. #define SCM_CWCR_CWT(x) (((x) & 0x001F))
  87. #define SCM_ISR_CFEI (0x02)
  88. #define SCM_ISR_CWIC (0x01)
  89. #define BCR_GBR (0x00000200)
  90. #define BCR_GBW (0x00000100)
  91. #define BCR_S7 (0x00000080)
  92. #define BCR_S6 (0x00000040)
  93. #define BCR_S4 (0x00000010)
  94. #define BCR_S1 (0x00000002)
  95. #define SCM_CFIER_ECFEI (0x01)
  96. #define SCM_CFLOC_LOC (0x80)
  97. #define SCM_CFATR_WRITE (0x80)
  98. #define SCM_CFATR_SZ32 (0x20)
  99. #define SCM_CFATR_SZ16 (0x10)
  100. #define SCM_CFATR_SZ08 (0x00)
  101. #define SCM_CFATR_CACHE (0x08)
  102. #define SCM_CFATR_MODE (0x02)
  103. #define SCM_CFATR_TYPE (0x01)
  104. /* *** Interrupt Controller (INTC) *** */
  105. #define INT0_LO_RSVD0 (0)
  106. #define INT0_LO_EPORT1 (1)
  107. #define INT0_LO_EPORT2 (2)
  108. #define INT0_LO_EPORT3 (3)
  109. #define INT0_LO_EPORT4 (4)
  110. #define INT0_LO_EPORT5 (5)
  111. #define INT0_LO_EPORT6 (6)
  112. #define INT0_LO_EPORT7 (7)
  113. #define INT0_LO_EDMA_00 (8)
  114. #define INT0_LO_EDMA_01 (9)
  115. #define INT0_LO_EDMA_02 (10)
  116. #define INT0_LO_EDMA_03 (11)
  117. #define INT0_LO_EDMA_04 (12)
  118. #define INT0_LO_EDMA_05 (13)
  119. #define INT0_LO_EDMA_06 (14)
  120. #define INT0_LO_EDMA_07 (15)
  121. #define INT0_LO_EDMA_08 (16)
  122. #define INT0_LO_EDMA_09 (17)
  123. #define INT0_LO_EDMA_10 (18)
  124. #define INT0_LO_EDMA_11 (19)
  125. #define INT0_LO_EDMA_12 (20)
  126. #define INT0_LO_EDMA_13 (21)
  127. #define INT0_LO_EDMA_14 (22)
  128. #define INT0_LO_EDMA_15 (23)
  129. #define INT0_LO_EDMA_ERR (24)
  130. #define INT0_LO_SCM_CWIC (25)
  131. #define INT0_LO_UART0 (26)
  132. #define INT0_LO_UART1 (27)
  133. #define INT0_LO_UART2 (28)
  134. #define INT0_LO_RSVD1 (29)
  135. #define INT0_LO_I2C (30)
  136. #define INT0_LO_DSPI (31)
  137. #define INT0_HI_DTMR0 (32)
  138. #define INT0_HI_DTMR1 (33)
  139. #define INT0_HI_DTMR2 (34)
  140. #define INT0_HI_DTMR3 (35)
  141. #define INT0_HI_FEC0_TXF (36)
  142. #define INT0_HI_FEC0_TXB (37)
  143. #define INT0_HI_FEC0_UN (38)
  144. #define INT0_HI_FEC0_RL (39)
  145. #define INT0_HI_FEC0_RXF (40)
  146. #define INT0_HI_FEC0_RXB (41)
  147. #define INT0_HI_FEC0_MII (42)
  148. #define INT0_HI_FEC0_LC (43)
  149. #define INT0_HI_FEC0_HBERR (44)
  150. #define INT0_HI_FEC0_GRA (45)
  151. #define INT0_HI_FEC0_EBERR (46)
  152. #define INT0_HI_FEC0_BABT (47)
  153. #define INT0_HI_FEC0_BABR (48)
  154. #define INT0_HI_FEC1_TXF (49)
  155. #define INT0_HI_FEC1_TXB (50)
  156. #define INT0_HI_FEC1_UN (51)
  157. #define INT0_HI_FEC1_RL (52)
  158. #define INT0_HI_FEC1_RXF (53)
  159. #define INT0_HI_FEC1_RXB (54)
  160. #define INT0_HI_FEC1_MII (55)
  161. #define INT0_HI_FEC1_LC (56)
  162. #define INT0_HI_FEC1_HBERR (57)
  163. #define INT0_HI_FEC1_GRA (58)
  164. #define INT0_HI_FEC1_EBERR (59)
  165. #define INT0_HI_FEC1_BABT (60)
  166. #define INT0_HI_FEC1_BABR (61)
  167. #define INT0_HI_SCM_CFEI (62)
  168. /* 0 - 24 reserved */
  169. #define INT1_LO_EPORT1_FLAG0 (25)
  170. #define INT1_LO_EPORT1_FLAG1 (26)
  171. #define INT1_LO_EPORT1_FLAG2 (27)
  172. #define INT1_LO_EPORT1_FLAG3 (28)
  173. #define INT1_LO_EPORT1_FLAG4 (29)
  174. #define INT1_LO_EPORT1_FLAG5 (30)
  175. #define INT1_LO_EPORT1_FLAG6 (31)
  176. #define INT1_LO_EPORT1_FLAG7 (32)
  177. #define INT1_HI_DSPI_EOQF (33)
  178. #define INT1_HI_DSPI_TFFF (34)
  179. #define INT1_HI_DSPI_TCF (35)
  180. #define INT1_HI_DSPI_TFUF (36)
  181. #define INT1_HI_DSPI_RFDF (37)
  182. #define INT1_HI_DSPI_RFOF (38)
  183. #define INT1_HI_DSPI_RFOF_TFUF (39)
  184. #define INT1_HI_RNG_EI (40)
  185. #define INT1_HI_PLL_LOCF (41)
  186. #define INT1_HI_PLL_LOLF (42)
  187. #define INT1_HI_PIT0 (43)
  188. #define INT1_HI_PIT1 (44)
  189. #define INT1_HI_PIT2 (45)
  190. #define INT1_HI_PIT3 (46)
  191. #define INT1_HI_USBOTG_STS (47)
  192. #define INT1_HI_USBHOST_STS (48)
  193. #define INT1_HI_SSI (49)
  194. /* 50 - 51 reserved */
  195. #define INT1_HI_RTC (52)
  196. #define INT1_HI_CCM_USBSTAT (53)
  197. #define INT1_HI_CODEC_OR (54)
  198. #define INT1_HI_CODEC_RF_TE (55)
  199. #define INT1_HI_CODEC_ROE (56)
  200. #define INT1_HI_CODEC_TUE (57)
  201. /* 58 reserved */
  202. #define INT1_HI_SIM1_DATA (59)
  203. #define INT1_HI_SIM1_GENERAL (60)
  204. /* 61 - 62 reserved */
  205. #define INT1_HI_SDHC (63)
  206. /* *** Reset Controller Module (RCM) *** */
  207. #define RCM_RCR_SOFTRST (0x80)
  208. #define RCM_RCR_FRCRSTOUT (0x40)
  209. #define RCM_RSR_SOFT (0x20)
  210. #define RCM_RSR_LOC (0x10)
  211. #define RCM_RSR_POR (0x08)
  212. #define RCM_RSR_EXT (0x04)
  213. #define RCM_RSR_WDR_CORE (0x02)
  214. #define RCM_RSR_LOL (0x01)
  215. /* *** Chip Configuration Module (CCM) *** */
  216. #define CCM_CCR_CSC (0x0020)
  217. #define CCM_CCR_BOOTPS (0x0010)
  218. #define CCM_CCR_LOAD (0x0008)
  219. #define CCM_CCR_OSC_MODE (0x0004)
  220. #define CCM_CCR_SDR_MODE (0x0002)
  221. #define CCM_CCR_RESERVED (0x0001)
  222. #define CCM_RCON_SDR_32BIT_UNIFIED (0x0012)
  223. #define CCM_RCON_DDR_8BIT_SPLIT (0x0010)
  224. #define CCM_RCON_SDR_16BIT_UNIFIED (0x0002)
  225. #define CCM_RCON_DDR_16BIT_SPLIT (0x0000)
  226. #define CCM_CIR_PIN(x) (((x) & 0x03FF) << 6)
  227. #define CCM_CIR_PRN(x) ((x) & 0x003F)
  228. #define CCM_MISCCR_FECM (0x8000)
  229. #define CCM_MISCCR_CDCSRC (0x4000)
  230. #define CCM_MISCCR_PLL_LOCK (0x2000)
  231. #define CCM_MISCCR_LIMP (0x1000)
  232. #define CCM_MISCCR_BME (0x8000)
  233. #define CCM_MISCCR_BMT_MASK (0xF8FF)
  234. #define CCM_MISCCR_BMT(x) (((x) & 0x0007) << 8)
  235. #define CCM_MISCCR_BMT_512 (0x0700)
  236. #define CCM_MISCCR_BMT_1024 (0x0600)
  237. #define CCM_MISCCR_BMT_2048 (0x0500)
  238. #define CCM_MISCCR_BMT_4096 (0x0400)
  239. #define CCM_MISCCR_BMT_8192 (0x0300)
  240. #define CCM_MISCCR_BMT_16384 (0x0200)
  241. #define CCM_MISCCR_BMT_32768 (0x0100)
  242. #define CCM_MISCCR_BMT_65536 (0x0000)
  243. #define CCM_MISCCR_TIM_DMA (0x0020)
  244. #define CCM_MISCCR_SSI_SRC (0x0010)
  245. #define CCM_MISCCR_USBH_OC (0x0008)
  246. #define CCM_MISCCR_USBO_OC (0x0004)
  247. #define CCM_MISCCR_USB_PUE (0x0002)
  248. #define CCM_MISCCR_USB_SRC (0x0001)
  249. #define CCM_CDR_LPDIV(x) (((x) & 0x0F) << 8)
  250. #define CCM_CDR_SSIDIV(x) ((x) & 0xFF)
  251. #define CCM_UOCSR_DPPD (0x2000)
  252. #define CCM_UOCSR_DMPD (0x1000)
  253. #define CCM_UOCSR_DRV_VBUS (0x0800)
  254. #define CCM_UOCSR_CRG_VBUS (0x0400)
  255. #define CCM_UOCSR_DCR_VBUS (0x0200)
  256. #define CCM_UOCSR_DPPU (0x0100)
  257. #define CCM_UOCSR_AVLD (0x0080)
  258. #define CCM_UOCSR_BVLD (0x0040)
  259. #define CCM_UOCSR_VVLD (0x0020)
  260. #define CCM_UOCSR_SEND (0x0010)
  261. #define CCM_UOCSR_PWRFLT (0x0008)
  262. #define CCM_UOCSR_WKUP (0x0004)
  263. #define CCM_UOCSR_UOMIE (0x0002)
  264. #define CCM_UOCSR_XPDE (0x0001)
  265. #define CCM_UHCSR_PORTIND(x) (((x) & 0x0003) << 14)
  266. #define CCM_UHCSR_DRV_VBUS (0x0010)
  267. #define CCM_UHCSR_PWRFLT (0x0008)
  268. #define CCM_UHCSR_WKUP (0x0004)
  269. #define CCM_UHCSR_UHMIE (0x0002)
  270. #define CCM_UHCSR_XPDE (0x0001)
  271. #define CCM_CODCR_BGREN (0x8000)
  272. #define CCM_CODCR_REGEN (0x0080)
  273. #define CCM_MISC2_IGNLL (0x0008)
  274. #define CCM_MISC2_DPS (0x0001)
  275. /* *** General Purpose I/O (GPIO) *** */
  276. #define GPIO_PDR_FBCTL ((x) & 0x0F)
  277. #define GPIO_PDR_BE ((x) & 0x0F)
  278. #define GPIO_PDR_CS32 (((x) & 0x03) << 4)
  279. #define GPIO_PDR_CS10 (((x) & 0x03) << 4)
  280. #define GPIO_PDR_DSPI ((x) & 0x7F)
  281. #define GPIO_PDR_FEC0 ((x) & 0x7F)
  282. #define GPIO_PDR_FECI2C ((x) & 0x3F)
  283. #define GPIO_PDR_SIMP1 ((x) & 0x1F)
  284. #define GPIO_PDR_SIMP0 ((x) & 0x1F)
  285. #define GPIO_PDR_TIMER ((x) & 0x0F)
  286. #define GPIO_PDR_UART ((x) & 0x3F)
  287. #define GPIO_PDR_DEBUG (0x01)
  288. #define GPIO_PDR_SDHC ((x) & 0x3F)
  289. #define GPIO_PDR_SSI ((x) & 0x1F)
  290. #define GPIO_PAR_FBCTL_OE (0x80)
  291. #define GPIO_PAR_FBCTL_TA (0x40)
  292. #define GPIO_PAR_FBCTL_RWB (0x20)
  293. #define GPIO_PAR_FBCTL_TS (0x18)
  294. #define GPIO_PAR_BE3 (0x40)
  295. #define GPIO_PAR_BE2 (0x10)
  296. #define GPIO_PAR_BE1 (0x04)
  297. #define GPIO_PAR_BE0 (0x01)
  298. #define GPIO_PAR_CS5 (0x40)
  299. #define GPIO_PAR_CS4 (0x10)
  300. #define GPIO_PAR_CS1_MASK (0xF3)
  301. #define GPIO_PAR_CS1_CS1 (0x0C)
  302. #define GPIO_PAR_CS1_SDCS1 (0x08)
  303. #define GPIO_PAR_CS0_MASK (0xFC)
  304. #define GPIO_PAR_CS0_CS0 (0x03)
  305. #define GPIO_PAR_CS0_CS4 (0x02)
  306. #define GPIO_PAR_DSPIH_SIN_MASK (0x3F)
  307. #define GPIO_PAR_DSPIH_SIN (0xC0)
  308. #define GPIO_PAR_DSPIH_SIN_U2RXD (0x80)
  309. #define GPIO_PAR_DSPIH_SOUT_MASK (0xCF)
  310. #define GPIO_PAR_DSPIH_SOUT (0x30)
  311. #define GPIO_PAR_DSPIH_SOUT_U2TXD (0x20)
  312. #define GPIO_PAR_DSPIH_SCK_MASK (0xF3)
  313. #define GPIO_PAR_DSPIH_SCK (0x0C)
  314. #define GPIO_PAR_DSPIH_SCK_U2CTS (0x08)
  315. #define GPIO_PAR_DSPIH_PCS0_MASK (0xFC)
  316. #define GPIO_PAR_DSPIH_PCS0 (0x03)
  317. #define GPIO_PAR_DSPIH_PCS0_U2RTS (0x02)
  318. #define GPIO_PAR_DSPIL_PCS1_MASK (0x3F)
  319. #define GPIO_PAR_DSPIL_PCS1 (0xC0)
  320. #define GPIO_PAR_DSPIL_PCS2_MASK (0xCF)
  321. #define GPIO_PAR_DSPIL_PCS2 (0x30)
  322. #define GPIO_PAR_DSPIL_PCS2_USBH_OC (0x20)
  323. #define GPIO_PAR_DSPIL_PCS3_MASK (0xF3)
  324. #define GPIO_PAR_DSPIL_PCS3 (0x0C)
  325. #define GPIO_PAR_DSPIL_PCS3_USBH_EN (0x08)
  326. #define GPIO_PAR_FEC1_7W_FEC (0x40)
  327. #define GPIO_PAR_FEC1_RMII_FEC (0x10)
  328. #define GPIO_PAR_FEC0_7W_FEC (0x04)
  329. #define GPIO_PAR_FEC0_RMII_FEC (0x01)
  330. /* GPIO_PAR_FECI2C */
  331. #define GPIO_PAR_FECI2C_RMII0_MASK (0x3F)
  332. #define GPIO_PAR_FECI2C_MDC0 (0x80)
  333. #define GPIO_PAR_FECI2C_MDIO0 (0x40)
  334. #define GPIO_PAR_FECI2C_RMII1_MASK (0xCF)
  335. #define GPIO_PAR_FECI2C_MDC1 (0x20)
  336. #define GPIO_PAR_FECI2C_MDIO1 (0x10)
  337. #define GPIO_PAR_FECI2C_SDA_MASK (0xF3)
  338. #define GPIO_PAR_FECI2C_SDA(x) (((x) & 0x03) << 2)
  339. #define GPIO_PAR_FECI2C_SDA_SDA (0x0C)
  340. #define GPIO_PAR_FECI2C_SDA_U2TXD (0x08)
  341. #define GPIO_PAR_FECI2C_SDA_MDIO1 (0x04)
  342. #define GPIO_PAR_FECI2C_SCL_MASK (0xFC)
  343. #define GPIO_PAR_FECI2C_SCL(x) ((x) & 0x03)
  344. #define GPIO_PAR_FECI2C_SCL_SCL (0x03)
  345. #define GPIO_PAR_FECI2C_SCL_U2RXD (0x02)
  346. #define GPIO_PAR_FECI2C_SCL_MDC1 (0x01)
  347. #define GPIO_PAR_IRQ0H_IRQ07_MASK (0x3F)
  348. #define GPIO_PAR_IRQ0H_IRQ06_MASK (0xCF)
  349. #define GPIO_PAR_IRQ0H_IRQ06_USBCLKIN (0x10)
  350. #define GPIO_PAR_IRQ0H_IRQ04_MASK (0xFC)
  351. #define GPIO_PAR_IRQ0H_IRQ04_DREQ0 (0x02)
  352. #define GPIO_PAR_IRQ0L_IRQ01_MASK (0xF3)
  353. #define GPIO_PAR_IRQ0L_IRQ01_DREQ1 (0x08)
  354. #define GPIO_PAR_IRQ1H_IRQ17_DDATA3 (0x40)
  355. #define GPIO_PAR_IRQ1H_IRQ16_DDATA2 (0x10)
  356. #define GPIO_PAR_IRQ1H_IRQ15_DDATA1 (0x04)
  357. #define GPIO_PAR_IRQ1H_IRQ14_DDATA0 (0x01)
  358. #define GPIO_PAR_IRQ1L_IRQ13_PST3 (0x40)
  359. #define GPIO_PAR_IRQ1L_IRQ12_PST2 (0x10)
  360. #define GPIO_PAR_IRQ1L_IRQ11_PST1 (0x04)
  361. #define GPIO_PAR_IRQ1L_IRQ10_PST0 (0x01)
  362. #define GPIO_PAR_SIMP1H_DATA1_MASK (0x3F)
  363. #define GPIO_PAR_SIMP1H_DATA1_SIMDATA1 (0xC0)
  364. #define GPIO_PAR_SIMP1H_DATA1_SSITXD (0x80)
  365. #define GPIO_PAR_SIMP1H_DATA1_U1TXD (0x40)
  366. #define GPIO_PAR_SIMP1H_VEN1_MASK (0xCF)
  367. #define GPIO_PAR_SIMP1H_VEN1_SIMVEN1 (0x30)
  368. #define GPIO_PAR_SIMP1H_VEN1_SSIRXD (0x20)
  369. #define GPIO_PAR_SIMP1H_VEN1_U1RXD (0x10)
  370. #define GPIO_PAR_SIMP1H_RST1_MASK (0xF3)
  371. #define GPIO_PAR_SIMP1H_RST1_SIMRST1 (0x0C)
  372. #define GPIO_PAR_SIMP1H_RST1_SSIFS (0x08)
  373. #define GPIO_PAR_SIMP1H_RST1_U1RTS (0x04)
  374. #define GPIO_PAR_SIMP1H_PD1_MASK (0xFC)
  375. #define GPIO_PAR_SIMP1H_PD1_SIMPD1 (0x03)
  376. #define GPIO_PAR_SIMP1H_PD1_SSIBCLK (0x02)
  377. #define GPIO_PAR_SIMP1H_PD1_U1CTS (0x01)
  378. #define GPIO_PAR_SIMP1L_CLK_MASK (0x3F)
  379. #define GPIO_PAR_SIMP1L_CLK_CLK1 (0xC0)
  380. #define GPIO_PAR_SIMP1L_CLK_SSIMCLK (0x80)
  381. #define GPIO_PAR_SIMP0_DATA0 (0x10)
  382. #define GPIO_PAR_SIMP0_VEN0 (0x08)
  383. #define GPIO_PAR_SIMP0_RST0 (0x04)
  384. #define GPIO_PAR_SIMP0_PD0 (0x02)
  385. #define GPIO_PAR_SIMP0_CLK0 (0x01)
  386. #define GPIO_PAR_TIN3(x) (((x) & 0x03) << 6)
  387. #define GPIO_PAR_TIN2(x) (((x) & 0x03) << 4)
  388. #define GPIO_PAR_TIN1(x) (((x) & 0x03) << 2)
  389. #define GPIO_PAR_TIN0(x) ((x) & 0x03)
  390. #define GPIO_PAR_TIN3_MASK (0x3F)
  391. #define GPIO_PAR_TIN3_TIN3 (0xC0)
  392. #define GPIO_PAR_TIN3_TOUT3 (0x80)
  393. #define GPIO_PAR_TIN3_IRQ03 (0x40)
  394. #define GPIO_PAR_TIN2_MASK (0xCF)
  395. #define GPIO_PAR_TIN2_TIN2 (0x30)
  396. #define GPIO_PAR_TIN2_TOUT2 (0x20)
  397. #define GPIO_PAR_TIN2_IRQ02 (0x10)
  398. #define GPIO_PAR_TIN1_MASK (0xF3)
  399. #define GPIO_PAR_TIN1_TIN1 (0x0C)
  400. #define GPIO_PAR_TIN1_TOUT1 (0x08)
  401. #define GPIO_PAR_TIN1_DACK1 (0x04)
  402. #define GPIO_PAR_TIN0_MASK (0xFC)
  403. #define GPIO_PAR_TIN0_TIN0 (0x03)
  404. #define GPIO_PAR_TIN0_TOUT0 (0x02)
  405. #define GPIO_PAR_TIN0_CODEC_ALTCLK (0x01)
  406. #define GPIO_PAR_UART_U2TXD (0x80)
  407. #define GPIO_PAR_UART_U2RXD (0x40)
  408. #define GPIO_PAR_UART_U0TXD (0x20)
  409. #define GPIO_PAR_UART_U0RXD (0x10)
  410. #define GPIO_PAR_UART_RTS0(x) (((x) & 0x03) << 2)
  411. #define GPIO_PAR_UART_CTS0(x) ((x) & 0x03)
  412. #define GPIO_PAR_UART_RTS0_MASK (0xF3)
  413. #define GPIO_PAR_UART_RTS0_U0RTS (0x0C)
  414. #define GPIO_PAR_UART_RTS0_USBO_VBOC (0x08)
  415. #define GPIO_PAR_UART_CTS0_MASK (0xFC)
  416. #define GPIO_PAR_UART_CTS0_U0CTS (0x03)
  417. #define GPIO_PAR_UART_CTS0_USB0_VBEN (0x02)
  418. #define GPIO_PAR_UART_CTS0_USB_PULLUP (0x01)
  419. #define GPIO_PAR_DEBUG_ALLPST (0x80)
  420. #define GPIO_PAR_SDHC_DATA3 (0x20)
  421. #define GPIO_PAR_SDHC_DATA2 (0x10)
  422. #define GPIO_PAR_SDHC_DATA1 (0x08)
  423. #define GPIO_PAR_SDHC_DATA0 (0x04)
  424. #define GPIO_PAR_SDHC_CMD (0x02)
  425. #define GPIO_PAR_SDHC_CLK (0x01)
  426. #define GPIO_PAR_SSIH_RXD(x) (((x) & 0x03) << 6)
  427. #define GPIO_PAR_SSIH_TXD(x) (((x) & 0x03) << 4)
  428. #define GPIO_PAR_SSIH_FS(x) (((x) & 0x03) << 2)
  429. #define GPIO_PAR_SSIH_MCLK(x) ((x) & 0x03)
  430. #define GPIO_PAR_SSIH_RXD_MASK (0x3F)
  431. #define GPIO_PAR_SSIH_RXD_SSIRXD (0xC0)
  432. #define GPIO_PAR_SSIH_RXD_U1RXD (0x40)
  433. #define GPIO_PAR_SSIH_TXD_MASK (0xCF)
  434. #define GPIO_PAR_SSIH_TXD_SSIRXD (0x30)
  435. #define GPIO_PAR_SSIH_TXD_U1TXD (0x10)
  436. #define GPIO_PAR_SSIH_FS_MASK (0xF3)
  437. #define GPIO_PAR_SSIH_FS_SSIFS (0x0C)
  438. #define GPIO_PAR_SSIH_FS_U1RTS (0x04)
  439. #define GPIO_PAR_SSIH_MCLK_MASK (0xFC)
  440. #define GPIO_PAR_SSIH_MCLK_SSIMCLK (0x03)
  441. #define GPIO_PAR_SSIH_MCLK_SSICLKIN (0x01)
  442. #define GPIO_PAR_SSIL_MASK (0x3F)
  443. #define GPIO_PAR_SSIL_BCLK (0xC0)
  444. #define GPIO_PAR_SSIL_U1CTS (0x40)
  445. #define GPIO_MSCR_MSCR1(x) (((x) & 0x07) << 5)
  446. #define GPIO_MSCR_MSCR2(x) (((x) & 0x07) << 5)
  447. #define GPIO_MSCR_MSCR3(x) (((x) & 0x07) << 5)
  448. #define GPIO_MSCR_MSCR4(x) (((x) & 0x07) << 5)
  449. #define GPIO_MSCR_MSCRn_MASK (0x1F)
  450. #define GPIO_MSCR_MSCRn_SDR (0xE0)
  451. #define GPIO_MSCR_MSCRn_25VDDR (0x60)
  452. #define GPIO_MSCR_MSCRn_18VDDR_FULL (0x20)
  453. #define GPIO_MSCR_MSCRn_18VDDR_HALF (0x00)
  454. #define GPIO_MSCR_MSCR5(x) (((x) & 0x07) << 2)
  455. #define GPIO_MSCR_MSCR5_MASK (0xE3)
  456. #define GPIO_MSCR_MSCR5_SDR (0x1C)
  457. #define GPIO_MSCR_MSCR5_25VDDR (0x0C)
  458. #define GPIO_MSCR_MSCR5_18VDDR_FULL (0x04)
  459. #define GPIO_MSCR_MSCR5_18VDDR_HALF (0x00)
  460. #define GPIO_SRCR_DSPI_MASK (0xFC)
  461. #define GPIO_SRCR_DSPI(x) ((x) & 0x03)
  462. #define GPIO_SRCR_I2C_MASK (0xFC)
  463. #define GPIO_SRCR_I2C(x) ((x) & 0x03)
  464. #define GPIO_SRCR_IRQ_IRQ0_MASK (0xF3)
  465. #define GPIO_SRCR_IRQ_IRQ0(x) (((x) & 0x03) << 2)
  466. #define GPIO_SRCR_IRQ_IRQ1DBG_MASK (0xFC)
  467. #define GPIO_SRCR_IRQ_IRQ1DBG(x) ((x) & 0x03)
  468. #define GPIO_SRCR_SIM_SIMP0_MASK (0xF3)
  469. #define GPIO_SRCR_SIM_SIMP0(x) (((x) & 0x03) << 2)
  470. #define GPIO_SRCR_SIM_SIMP1_MASK (0xFC)
  471. #define GPIO_SRCR_SIM_SIMP1(x) ((x) & 0x03)
  472. #define GPIO_SRCR_TIMER_MASK (0xFC)
  473. #define GPIO_SRCR_TIMER(x) ((x) & 0x03)
  474. #define GPIO_SRCR_UART2_MASK (0xF3)
  475. #define GPIO_SRCR_UART2(x) (((x) & 0x03) << 2)
  476. #define GPIO_SRCR_UART0_MASK (0xFC)
  477. #define GPIO_SRCR_UART0(x) ((x) & 0x03)
  478. #define GPIO_SRCR_SDHC_MASK (0xFC)
  479. #define GPIO_SRCR_SDHC(x) ((x) & 0x03)
  480. #define GPIO_SRCR_SSI_MASK (0xFC)
  481. #define GPIO_SRCR_SSI(x) ((x) & 0x03)
  482. #define SRCR_HIGHEST (0x03)
  483. #define SRCR_HIGH (0x02)
  484. #define SRCR_LOW (0x01)
  485. #define SRCR_LOWEST (0x00)
  486. #define GPIO_DSCR_FEC_RMIICLK_MASK (0xCF)
  487. #define GPIO_DSCR_FEC_RMIICLK(x) (((x) & 0x03) << 4)
  488. #define GPIO_DSCR_FEC_RMII0_MASK (0xF3)
  489. #define GPIO_DSCR_FEC_RMII0(x) (((x) & 0x03) << 2)
  490. #define GPIO_DSCR_FEC_RMII1_MASK (0xFC)
  491. #define GPIO_DSCR_FEC_RMII1(x) ((x) & 0x03)
  492. #define DSCR_50PF (0x03)
  493. #define DSCR_30PF (0x02)
  494. #define DSCR_20PF (0x01)
  495. #define DSCR_10PF (0x00)
  496. #define GPIO_PCRH_DSPI_PCS0_PULLUP_EN (0x80)
  497. #define GPIO_PCRH_SIM_VEN1_PULLUP_EN (0x40)
  498. #define GPIO_PCRH_SIM_VEN1_PULLUP (0x20)
  499. #define GPIO_PCRH_SIM_DATA1_PULLUP_EN (0x10)
  500. #define GPIO_PCRH_SIM_DATA1_PULLUP (0x08)
  501. #define GPIO_PCRH_SSI_PULLUP_EN (0x02)
  502. #define GPIO_PCRH_SSI_PULLUP (0x01)
  503. #define GPIO_PCRL_SDHC_DATA3_PULLUP_EN (0x80)
  504. #define GPIO_PCRL_SDHC_DATA3_PULLUP (0x40)
  505. #define GPIO_PCRL_SDHC_DATA2_PULLUP_EN (0x20)
  506. #define GPIO_PCRL_SDHC_DATA1_PULLUP_EN (0x10)
  507. #define GPIO_PCRL_SDHC_DATA0_PULLUP_EN (0x08)
  508. #define GPIO_PCRL_SDHC_CMD_PULLUP_EN (0x04)
  509. /* *** Phase Locked Loop (PLL) *** */
  510. #define PLL_PCR_LOC_IRQ (0x00040000)
  511. #define PLL_PCR_LOC_RE (0x00020000)
  512. #define PLL_PCR_LOC_EN (0x00010000)
  513. #define PLL_PCR_LOL_IRQ (0x00004000)
  514. #define PLL_PCR_LOL_RE (0x00002000)
  515. #define PLL_PCR_LOL_EN (0x00001000)
  516. #define PLL_PCR_REFDIV_MASK (0xFFFFF8FF)
  517. #define PLL_PCR_REFDIV(x) (((x) & 0x07) << 8)
  518. #define PLL_PCR_FBDIV_MASK (0xFFFFFFC0)
  519. #define PLL_PCR_FBDIV(x) ((x) & 0x3F)
  520. #define PLL_PDR_OUTDIV4_MASK (0x0FFF)
  521. #define PLL_PDR_OUTDIV4(x) (((x) & 0x0000000F) << 12)
  522. #define PLL_PDR_OUTDIV3_MASK (0xF0FF)
  523. #define PLL_PDR_OUTDIV3(x) (((x) & 0x0000000F) << 8)
  524. #define PLL_PDR_OUTDIV2_MASK (0xFF0F)
  525. #define PLL_PDR_OUTDIV2(x) (((x) & 0x0000000F) << 4)
  526. #define PLL_PDR_OUTDIV1_MASK (0xFFF0)
  527. #define PLL_PDR_OUTDIV1(x) ((x) & 0x0000000F)
  528. #define PLL_PDR_USB(x) PLL_PDR_OUTDIV4(x)
  529. #define PLL_PDR_SDRAM(x) PLL_PDR_OUTDIV3(x)
  530. #define PLL_PDR_FB(x) PLL_PDR_OUTDIV2(x)
  531. #define PLL_PDR_CPU(x) PLL_PDR_OUTDIV1(x)
  532. #define PLL_PSR_LOCF (0x00000200)
  533. #define PLL_PSR_LOC (0x00000100)
  534. #define PLL_PSR_LOLF (0x00000040)
  535. #define PLL_PSR_LOCKS (0x00000020)
  536. #define PLL_PSR_LOCK (0x00000010)
  537. #define PLL_PSR_MODE(x) ((x) & 0x07)
  538. /* *** Real Time Clock *** */
  539. #define RTC_OCEN_OSCBYP (0x00000010)
  540. #define RTC_OCEN_CLKEN (0x00000008)
  541. #endif /* m5301x_h */