imx-regs.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. /*
  2. * Copyright (C) 2009, DENX Software Engineering
  3. * Author: John Rigby <jcrigby@gmail.com
  4. *
  5. * Based on arch-mx31/mx31-regs.h
  6. * Copyright (C) 2009 Ilya Yanok,
  7. * Emcraft Systems <yanok@emcraft.com>
  8. * and arch-mx27/imx-regs.h
  9. * Copyright (C) 2007 Pengutronix,
  10. * Sascha Hauer <s.hauer@pengutronix.de>
  11. * Copyright (C) 2009 Ilya Yanok,
  12. * Emcraft Systems <yanok@emcraft.com>
  13. *
  14. * See file CREDITS for list of people who contributed to this
  15. * project.
  16. *
  17. * This program is free software; you can redistribute it and/or
  18. * modify it under the terms of the GNU General Public License as
  19. * published by the Free Software Foundation; either version 2 of
  20. * the License, or (at your option) any later version.
  21. *
  22. * This program is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. * GNU General Public License for more details.
  26. *
  27. * You should have received a copy of the GNU General Public License
  28. * along with this program; if not, write to the Free Software
  29. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  30. * MA 02111-1307 USA
  31. */
  32. #ifndef _IMX_REGS_H
  33. #define _IMX_REGS_H
  34. #ifndef __ASSEMBLY__
  35. #ifdef CONFIG_FEC_MXC
  36. extern void mx25_fec_init_pins(void);
  37. #endif
  38. /* Clock Control Module (CCM) registers */
  39. struct ccm_regs {
  40. u32 mpctl; /* Core PLL Control */
  41. u32 upctl; /* USB PLL Control */
  42. u32 cctl; /* Clock Control */
  43. u32 cgr0; /* Clock Gating Control 0 */
  44. u32 cgr1; /* Clock Gating Control 1 */
  45. u32 cgr2; /* Clock Gating Control 2 */
  46. u32 pcdr[4]; /* PER Clock Dividers */
  47. u32 rcsr; /* CCM Status */
  48. u32 crdr; /* CCM Reset and Debug */
  49. u32 dcvr0; /* DPTC Comparator Value 0 */
  50. u32 dcvr1; /* DPTC Comparator Value 1 */
  51. u32 dcvr2; /* DPTC Comparator Value 2 */
  52. u32 dcvr3; /* DPTC Comparator Value 3 */
  53. u32 ltr0; /* Load Tracking 0 */
  54. u32 ltr1; /* Load Tracking 1 */
  55. u32 ltr2; /* Load Tracking 2 */
  56. u32 ltr3; /* Load Tracking 3 */
  57. u32 ltbr0; /* Load Tracking Buffer 0 */
  58. u32 ltbr1; /* Load Tracking Buffer 1 */
  59. u32 pcmr0; /* Power Management Control 0 */
  60. u32 pcmr1; /* Power Management Control 1 */
  61. u32 pcmr2; /* Power Management Control 2 */
  62. u32 mcr; /* Miscellaneous Control */
  63. u32 lpimr0; /* Low Power Interrupt Mask 0 */
  64. u32 lpimr1; /* Low Power Interrupt Mask 1 */
  65. };
  66. /* Enhanced SDRAM Controller (ESDRAMC) registers */
  67. struct esdramc_regs {
  68. u32 ctl0; /* control 0 */
  69. u32 cfg0; /* configuration 0 */
  70. u32 ctl1; /* control 1 */
  71. u32 cfg1; /* configuration 1 */
  72. u32 misc; /* miscellaneous */
  73. u32 pad[3];
  74. u32 cdly1; /* Delay Line 1 configuration debug */
  75. u32 cdly2; /* delay line 2 configuration debug */
  76. u32 cdly3; /* delay line 3 configuration debug */
  77. u32 cdly4; /* delay line 4 configuration debug */
  78. u32 cdly5; /* delay line 5 configuration debug */
  79. u32 cdlyl; /* delay line cycle length debug */
  80. };
  81. /* GPIO registers */
  82. struct gpio_regs {
  83. u32 dr; /* data */
  84. u32 dir; /* direction */
  85. u32 psr; /* pad satus */
  86. u32 icr1; /* interrupt config 1 */
  87. u32 icr2; /* interrupt config 2 */
  88. u32 imr; /* interrupt mask */
  89. u32 isr; /* interrupt status */
  90. u32 edge_sel; /* edge select */
  91. };
  92. /* General Purpose Timer (GPT) registers */
  93. struct gpt_regs {
  94. u32 ctrl; /* control */
  95. u32 pre; /* prescaler */
  96. u32 stat; /* status */
  97. u32 intr; /* interrupt */
  98. u32 cmp[3]; /* output compare 1-3 */
  99. u32 capt[2]; /* input capture 1-2 */
  100. u32 counter; /* counter */
  101. };
  102. /* Watchdog Timer (WDOG) registers */
  103. struct wdog_regs {
  104. u32 wcr; /* Control */
  105. u32 wsr; /* Service */
  106. u32 wrsr; /* Reset Status */
  107. u32 wicr; /* Interrupt Control */
  108. u32 wmcr; /* Misc Control */
  109. };
  110. /* IIM control registers */
  111. struct iim_regs {
  112. u32 iim_stat;
  113. u32 iim_statm;
  114. u32 iim_err;
  115. u32 iim_emask;
  116. u32 iim_fctl;
  117. u32 iim_ua;
  118. u32 iim_la;
  119. u32 iim_sdat;
  120. u32 iim_prev;
  121. u32 iim_srev;
  122. u32 iim_prog_p;
  123. u32 res1[0x1f5];
  124. u32 iim_bank_area0[0x20];
  125. u32 res2[0xe0];
  126. u32 iim_bank_area1[0x20];
  127. u32 res3[0xe0];
  128. u32 iim_bank_area2[0x20];
  129. };
  130. #endif
  131. /* AIPS 1 */
  132. #define IMX_AIPS1_BASE (0x43F00000)
  133. #define IMX_MAX_BASE (0x43F04000)
  134. #define IMX_CLKCTL_BASE (0x43F08000)
  135. #define IMX_ETB_SLOT4_BASE (0x43F0C000)
  136. #define IMX_ETB_SLOT5_BASE (0x43F10000)
  137. #define IMX_ECT_CTIO_BASE (0x43F18000)
  138. #define IMX_I2C_BASE (0x43F80000)
  139. #define IMX_I2C3_BASE (0x43F84000)
  140. #define IMX_CAN1_BASE (0x43F88000)
  141. #define IMX_CAN2_BASE (0x43F8C000)
  142. #define IMX_UART1_BASE (0x43F90000)
  143. #define IMX_UART2_BASE (0x43F94000)
  144. #define IMX_I2C2_BASE (0x43F98000)
  145. #define IMX_OWIRE_BASE (0x43F9C000)
  146. #define IMX_CSPI1_BASE (0x43FA4000)
  147. #define IMX_KPP_BASE (0x43FA8000)
  148. #define IMX_IOPADMUX_BASE (0x43FAC000)
  149. #define IMX_IOPADCTL_BASE (0x43FAC22C)
  150. #define IMX_IOPADGRPCTL_BASE (0x43FAC418)
  151. #define IMX_IOPADINPUTSEL_BASE (0x43FAC460)
  152. #define IMX_AUDMUX_BASE (0x43FB0000)
  153. #define IMX_ECT_IP1_BASE (0x43FB8000)
  154. #define IMX_ECT_IP2_BASE (0x43FBC000)
  155. /* SPBA */
  156. #define IMX_SPBA_BASE (0x50000000)
  157. #define IMX_CSPI3_BASE (0x50004000)
  158. #define IMX_UART4_BASE (0x50008000)
  159. #define IMX_UART3_BASE (0x5000C000)
  160. #define IMX_CSPI2_BASE (0x50010000)
  161. #define IMX_SSI2_BASE (0x50014000)
  162. #define IMX_ESAI_BASE (0x50018000)
  163. #define IMX_ATA_DMA_BASE (0x50020000)
  164. #define IMX_SIM1_BASE (0x50024000)
  165. #define IMX_SIM2_BASE (0x50028000)
  166. #define IMX_UART5_BASE (0x5002C000)
  167. #define IMX_TSC_BASE (0x50030000)
  168. #define IMX_SSI1_BASE (0x50034000)
  169. #define IMX_FEC_BASE (0x50038000)
  170. #define IMX_SPBA_CTRL_BASE (0x5003C000)
  171. /* AIPS 2 */
  172. #define IMX_AIPS2_BASE (0x53F00000)
  173. #define IMX_CCM_BASE (0x53F80000)
  174. #define IMX_GPT4_BASE (0x53F84000)
  175. #define IMX_GPT3_BASE (0x53F88000)
  176. #define IMX_GPT2_BASE (0x53F8C000)
  177. #define IMX_GPT1_BASE (0x53F90000)
  178. #define IMX_EPIT1_BASE (0x53F94000)
  179. #define IMX_EPIT2_BASE (0x53F98000)
  180. #define IMX_GPIO4_BASE (0x53F9C000)
  181. #define IMX_PWM2_BASE (0x53FA0000)
  182. #define IMX_GPIO3_BASE (0x53FA4000)
  183. #define IMX_PWM3_BASE (0x53FA8000)
  184. #define IMX_SCC_BASE (0x53FAC000)
  185. #define IMX_SCM_BASE (0x53FAE000)
  186. #define IMX_SMN_BASE (0x53FAF000)
  187. #define IMX_RNGD_BASE (0x53FB0000)
  188. #define IMX_MMC_SDHC1_BASE (0x53FB4000)
  189. #define IMX_MMC_SDHC2_BASE (0x53FB8000)
  190. #define IMX_LCDC_BASE (0x53FBC000)
  191. #define IMX_SLCDC_BASE (0x53FC0000)
  192. #define IMX_PWM4_BASE (0x53FC8000)
  193. #define IMX_GPIO1_BASE (0x53FCC000)
  194. #define IMX_GPIO2_BASE (0x53FD0000)
  195. #define IMX_SDMA_BASE (0x53FD4000)
  196. #define IMX_WDT_BASE (0x53FDC000)
  197. #define IMX_PWM1_BASE (0x53FE0000)
  198. #define IMX_RTIC_BASE (0x53FEC000)
  199. #define IMX_IIM_BASE (0x53FF0000)
  200. #define IMX_USB_BASE (0x53FF4000)
  201. #define IMX_CSI_BASE (0x53FF8000)
  202. #define IMX_DRYICE_BASE (0x53FFC000)
  203. #define IMX_ARM926_ROMPATCH (0x60000000)
  204. #define IMX_ARM926_ASIC (0x68000000)
  205. /* 128K Internal Static RAM */
  206. #define IMX_RAM_BASE (0x78000000)
  207. /* SDRAM BANKS */
  208. #define IMX_SDRAM_BANK0_BASE (0x80000000)
  209. #define IMX_SDRAM_BANK1_BASE (0x90000000)
  210. #define IMX_WEIM_CS0 (0xA0000000)
  211. #define IMX_WEIM_CS1 (0xA8000000)
  212. #define IMX_WEIM_CS2 (0xB0000000)
  213. #define IMX_WEIM_CS3 (0xB2000000)
  214. #define IMX_WEIM_CS4 (0xB4000000)
  215. #define IMX_ESDRAMC_BASE (0xB8001000)
  216. #define IMX_WEIM_CTRL_BASE (0xB8002000)
  217. #define IMX_M3IF_CTRL_BASE (0xB8003000)
  218. #define IMX_EMI_CTRL_BASE (0xB8004000)
  219. /* NAND Flash Controller */
  220. #define IMX_NFC_BASE (0xBB000000)
  221. #define NFC_BASE_ADDR IMX_NFC_BASE
  222. /* CCM bitfields */
  223. #define CCM_PLL_MFI_SHIFT 10
  224. #define CCM_PLL_MFI_MASK 0xf
  225. #define CCM_PLL_MFN_SHIFT 0
  226. #define CCM_PLL_MFN_MASK 0x3ff
  227. #define CCM_PLL_MFD_SHIFT 16
  228. #define CCM_PLL_MFD_MASK 0x3ff
  229. #define CCM_PLL_PD_SHIFT 26
  230. #define CCM_PLL_PD_MASK 0xf
  231. #define CCM_CCTL_ARM_DIV_SHIFT 30
  232. #define CCM_CCTL_ARM_DIV_MASK 3
  233. #define CCM_CCTL_AHB_DIV_SHIFT 28
  234. #define CCM_CCTL_AHB_DIV_MASK 3
  235. #define CCM_CCTL_ARM_SRC (1 << 14)
  236. #define CCM_CGR1_GPT1 (1 << 19)
  237. #define CCM_PERCLK_REG(clk) (clk / 4)
  238. #define CCM_PERCLK_SHIFT(clk) (8 * (clk % 4))
  239. #define CCM_PERCLK_MASK 0x3f
  240. #define CCM_RCSR_NF_16BIT_SEL (1 << 14)
  241. #define CCM_RCSR_NF_PS(v) ((v >> 26) & 3)
  242. /* ESDRAM Controller register bitfields */
  243. #define ESDCTL_PRCT(x) (((x) & 0x3f) << 0)
  244. #define ESDCTL_BL (1 << 7)
  245. #define ESDCTL_FP (1 << 8)
  246. #define ESDCTL_PWDT(x) (((x) & 3) << 10)
  247. #define ESDCTL_SREFR(x) (((x) & 7) << 13)
  248. #define ESDCTL_DSIZ_16_UPPER (0 << 16)
  249. #define ESDCTL_DSIZ_16_LOWER (1 << 16)
  250. #define ESDCTL_DSIZ_32 (2 << 16)
  251. #define ESDCTL_COL8 (0 << 20)
  252. #define ESDCTL_COL9 (1 << 20)
  253. #define ESDCTL_COL10 (2 << 20)
  254. #define ESDCTL_ROW11 (0 << 24)
  255. #define ESDCTL_ROW12 (1 << 24)
  256. #define ESDCTL_ROW13 (2 << 24)
  257. #define ESDCTL_ROW14 (3 << 24)
  258. #define ESDCTL_ROW15 (4 << 24)
  259. #define ESDCTL_SP (1 << 27)
  260. #define ESDCTL_SMODE_NORMAL (0 << 28)
  261. #define ESDCTL_SMODE_PRECHARGE (1 << 28)
  262. #define ESDCTL_SMODE_AUTO_REF (2 << 28)
  263. #define ESDCTL_SMODE_LOAD_MODE (3 << 28)
  264. #define ESDCTL_SMODE_MAN_REF (4 << 28)
  265. #define ESDCTL_SDE (1 << 31)
  266. #define ESDCFG_TRC(x) (((x) & 0xf) << 0)
  267. #define ESDCFG_TRCD(x) (((x) & 0x7) << 4)
  268. #define ESDCFG_TCAS(x) (((x) & 0x3) << 8)
  269. #define ESDCFG_TRRD(x) (((x) & 0x3) << 10)
  270. #define ESDCFG_TRAS(x) (((x) & 0x7) << 12)
  271. #define ESDCFG_TWR (1 << 15)
  272. #define ESDCFG_TMRD(x) (((x) & 0x3) << 16)
  273. #define ESDCFG_TRP(x) (((x) & 0x3) << 18)
  274. #define ESDCFG_TWTR (1 << 20)
  275. #define ESDCFG_TXP(x) (((x) & 0x3) << 21)
  276. #define ESDMISC_RST (1 << 1)
  277. #define ESDMISC_MDDREN (1 << 2)
  278. #define ESDMISC_MDDR_DL_RST (1 << 3)
  279. #define ESDMISC_MDDR_MDIS (1 << 4)
  280. #define ESDMISC_LHD (1 << 5)
  281. #define ESDMISC_MA10_SHARE (1 << 6)
  282. #define ESDMISC_SDRAM_RDY (1 << 31)
  283. /* GPT bits */
  284. #define GPT_CTRL_SWR (1 << 15) /* Software reset */
  285. #define GPT_CTRL_FRR (1 << 9) /* Freerun / restart */
  286. #define GPT_CTRL_CLKSOURCE_32 (4 << 6) /* Clock source */
  287. #define GPT_CTRL_TEN 1 /* Timer enable */
  288. /* WDOG enable */
  289. #define WCR_WDE 0x04
  290. /* FUSE bank offsets */
  291. #define IIM0_MAC 0x1a
  292. #endif /* _IMX_REGS_H */