imx-regs.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. /*
  2. * (C) Copyright 2009 Freescale Semiconductor, Inc.
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #ifndef __ASM_ARCH_MX5_IMX_REGS_H__
  23. #define __ASM_ARCH_MX5_IMX_REGS_H__
  24. #if defined(CONFIG_MX51)
  25. #define IRAM_BASE_ADDR 0x1FFE0000 /* internal ram */
  26. #define IPU_CTRL_BASE_ADDR 0x40000000
  27. #define SPBA0_BASE_ADDR 0x70000000
  28. #define AIPS1_BASE_ADDR 0x73F00000
  29. #define AIPS2_BASE_ADDR 0x83F00000
  30. #define CSD0_BASE_ADDR 0x90000000
  31. #define CSD1_BASE_ADDR 0xA0000000
  32. #define NFC_BASE_ADDR_AXI 0xCFFF0000
  33. #define CS1_BASE_ADDR 0xB8000000
  34. #elif defined(CONFIG_MX53)
  35. #define IPU_CTRL_BASE_ADDR 0x18000000
  36. #define SPBA0_BASE_ADDR 0x50000000
  37. #define AIPS1_BASE_ADDR 0x53F00000
  38. #define AIPS2_BASE_ADDR 0x63F00000
  39. #define CSD0_BASE_ADDR 0x70000000
  40. #define CSD1_BASE_ADDR 0xB0000000
  41. #define NFC_BASE_ADDR_AXI 0xF7FF0000
  42. #define IRAM_BASE_ADDR 0xF8000000
  43. #define CS1_BASE_ADDR 0xF4000000
  44. #else
  45. #error "CPU_TYPE not defined"
  46. #endif
  47. #define IRAM_SIZE 0x00020000 /* 128 KB */
  48. /*
  49. * SPBA global module enabled #0
  50. */
  51. #define MMC_SDHC1_BASE_ADDR (SPBA0_BASE_ADDR + 0x00004000)
  52. #define MMC_SDHC2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00008000)
  53. #define UART3_BASE_ADDR (SPBA0_BASE_ADDR + 0x0000C000)
  54. #define CSPI1_BASE_ADDR (SPBA0_BASE_ADDR + 0x00010000)
  55. #define SSI2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00014000)
  56. #define MMC_SDHC3_BASE_ADDR (SPBA0_BASE_ADDR + 0x00020000)
  57. #define MMC_SDHC4_BASE_ADDR (SPBA0_BASE_ADDR + 0x00024000)
  58. #define SPDIF_BASE_ADDR (SPBA0_BASE_ADDR + 0x00028000)
  59. #define ATA_DMA_BASE_ADDR (SPBA0_BASE_ADDR + 0x00030000)
  60. #define SLIM_DMA_BASE_ADDR (SPBA0_BASE_ADDR + 0x00034000)
  61. #define HSI2C_DMA_BASE_ADDR (SPBA0_BASE_ADDR + 0x00038000)
  62. #define SPBA_CTRL_BASE_ADDR (SPBA0_BASE_ADDR + 0x0003C000)
  63. /*
  64. * AIPS 1
  65. */
  66. #define OTG_BASE_ADDR (AIPS1_BASE_ADDR + 0x00080000)
  67. #define GPIO1_BASE_ADDR (AIPS1_BASE_ADDR + 0x00084000)
  68. #define GPIO2_BASE_ADDR (AIPS1_BASE_ADDR + 0x00088000)
  69. #define GPIO3_BASE_ADDR (AIPS1_BASE_ADDR + 0x0008C000)
  70. #define GPIO4_BASE_ADDR (AIPS1_BASE_ADDR + 0x00090000)
  71. #define KPP_BASE_ADDR (AIPS1_BASE_ADDR + 0x00094000)
  72. #define WDOG1_BASE_ADDR (AIPS1_BASE_ADDR + 0x00098000)
  73. #define WDOG2_BASE_ADDR (AIPS1_BASE_ADDR + 0x0009C000)
  74. #define GPT1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A0000)
  75. #define SRTC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A4000)
  76. #define IOMUXC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A8000)
  77. #define EPIT1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000AC000)
  78. #define EPIT2_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B0000)
  79. #define PWM1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B4000)
  80. #define PWM2_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B8000)
  81. #define UART1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000BC000)
  82. #define UART2_BASE_ADDR (AIPS1_BASE_ADDR + 0x000C0000)
  83. #define SRC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000D0000)
  84. #define CCM_BASE_ADDR (AIPS1_BASE_ADDR + 0x000D4000)
  85. #define GPC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000D8000)
  86. #if defined(CONFIG_MX53)
  87. #define GPIO5_BASE_ADDR (AIPS1_BASE_ADDR + 0x000DC000)
  88. #define GPIO6_BASE_ADDR (AIPS1_BASE_ADDR + 0x000E0000)
  89. #define GPIO7_BASE_ADDR (AIPS1_BASE_ADDR + 0x000E4000)
  90. #endif
  91. /*
  92. * AIPS 2
  93. */
  94. #define PLL1_BASE_ADDR (AIPS2_BASE_ADDR + 0x00080000)
  95. #define PLL2_BASE_ADDR (AIPS2_BASE_ADDR + 0x00084000)
  96. #define PLL3_BASE_ADDR (AIPS2_BASE_ADDR + 0x00088000)
  97. #define AHBMAX_BASE_ADDR (AIPS2_BASE_ADDR + 0x00094000)
  98. #define IIM_BASE_ADDR (AIPS2_BASE_ADDR + 0x00098000)
  99. #define CSU_BASE_ADDR (AIPS2_BASE_ADDR + 0x0009C000)
  100. #define ARM_BASE_ADDR (AIPS2_BASE_ADDR + 0x000A0000)
  101. #define OWIRE_BASE_ADDR (AIPS2_BASE_ADDR + 0x000A4000)
  102. #define FIRI_BASE_ADDR (AIPS2_BASE_ADDR + 0x000A8000)
  103. #define CSPI2_BASE_ADDR (AIPS2_BASE_ADDR + 0x000AC000)
  104. #define SDMA_BASE_ADDR (AIPS2_BASE_ADDR + 0x000B0000)
  105. #define SCC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000B4000)
  106. #define ROMCP_BASE_ADDR (AIPS2_BASE_ADDR + 0x000B8000)
  107. #define RTIC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000BC000)
  108. #define CSPI3_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C0000)
  109. #define I2C2_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C4000)
  110. #define I2C1_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C8000)
  111. #define SSI1_BASE_ADDR (AIPS2_BASE_ADDR + 0x000CC000)
  112. #define AUDMUX_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D0000)
  113. #define M4IF_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D8000)
  114. #define ESDCTL_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D9000)
  115. #define WEIM_BASE_ADDR (AIPS2_BASE_ADDR + 0x000DA000)
  116. #define NFC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000DB000)
  117. #define EMI_BASE_ADDR (AIPS2_BASE_ADDR + 0x000DBF00)
  118. #define MIPI_HSC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000DC000)
  119. #define ATA_BASE_ADDR (AIPS2_BASE_ADDR + 0x000E0000)
  120. #define SIM_BASE_ADDR (AIPS2_BASE_ADDR + 0x000E4000)
  121. #define SSI3BASE_ADDR (AIPS2_BASE_ADDR + 0x000E8000)
  122. #define FEC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000EC000)
  123. #define TVE_BASE_ADDR (AIPS2_BASE_ADDR + 0x000F0000)
  124. #define VPU_BASE_ADDR (AIPS2_BASE_ADDR + 0x000F4000)
  125. #define SAHARA_BASE_ADDR (AIPS2_BASE_ADDR + 0x000F8000)
  126. /*
  127. * WEIM CSnGCR1
  128. */
  129. #define CSEN 1
  130. #define SWR (1 << 1)
  131. #define SRD (1 << 2)
  132. #define MUM (1 << 3)
  133. #define WFL (1 << 4)
  134. #define RFL (1 << 5)
  135. #define CRE (1 << 6)
  136. #define CREP (1 << 7)
  137. #define BL(x) (((x) & 0x7) << 8)
  138. #define WC (1 << 11)
  139. #define BCD(x) (((x) & 0x3) << 12)
  140. #define BCS(x) (((x) & 0x3) << 14)
  141. #define DSZ(x) (((x) & 0x7) << 16)
  142. #define SP (1 << 19)
  143. #define CSREC(x) (((x) & 0x7) << 20)
  144. #define AUS (1 << 23)
  145. #define GBC(x) (((x) & 0x7) << 24)
  146. #define WP (1 << 27)
  147. #define PSZ(x) (((x) & 0x0f << 28)
  148. /*
  149. * WEIM CSnGCR2
  150. */
  151. #define ADH(x) (((x) & 0x3))
  152. #define DAPS(x) (((x) & 0x0f << 4)
  153. #define DAE (1 << 8)
  154. #define DAP (1 << 9)
  155. #define MUX16_BYP (1 << 12)
  156. /*
  157. * WEIM CSnRCR1
  158. */
  159. #define RCSN(x) (((x) & 0x7))
  160. #define RCSA(x) (((x) & 0x7) << 4)
  161. #define OEN(x) (((x) & 0x7) << 8)
  162. #define OEA(x) (((x) & 0x7) << 12)
  163. #define RADVN(x) (((x) & 0x7) << 16)
  164. #define RAL (1 << 19)
  165. #define RADVA(x) (((x) & 0x7) << 20)
  166. #define RWSC(x) (((x) & 0x3f) << 24)
  167. /*
  168. * WEIM CSnRCR2
  169. */
  170. #define RBEN(x) (((x) & 0x7))
  171. #define RBE (1 << 3)
  172. #define RBEA(x) (((x) & 0x7) << 4)
  173. #define RL(x) (((x) & 0x3) << 8)
  174. #define PAT(x) (((x) & 0x7) << 12)
  175. #define APR (1 << 15)
  176. /*
  177. * WEIM CSnWCR1
  178. */
  179. #define WCSN(x) (((x) & 0x7))
  180. #define WCSA(x) (((x) & 0x7) << 3)
  181. #define WEN(x) (((x) & 0x7) << 6)
  182. #define WEA(x) (((x) & 0x7) << 9)
  183. #define WBEN(x) (((x) & 0x7) << 12)
  184. #define WBEA(x) (((x) & 0x7) << 15)
  185. #define WADVN(x) (((x) & 0x7) << 18)
  186. #define WADVA(x) (((x) & 0x7) << 21)
  187. #define WWSC(x) (((x) & 0x3f) << 24)
  188. #define WBED1 (1 << 30)
  189. #define WAL (1 << 31)
  190. /*
  191. * WEIM CSnWCR2
  192. */
  193. #define WBED 1
  194. /*
  195. * WEIM WCR
  196. */
  197. #define BCM 1
  198. #define GBCD(x) (((x) & 0x3) << 1)
  199. #define INTEN (1 << 4)
  200. #define INTPOL (1 << 5)
  201. #define WDOG_EN (1 << 8)
  202. #define WDOG_LIMIT(x) (((x) & 0x3) << 9)
  203. /*
  204. * Number of GPIO pins per port
  205. */
  206. #define GPIO_NUM_PIN 32
  207. #define IIM_SREV 0x24
  208. #define ROM_SI_REV 0x48
  209. #define NFC_BUF_SIZE 0x1000
  210. /* M4IF */
  211. #define M4IF_FBPM0 0x40
  212. #define M4IF_FIDBP 0x48
  213. /* Assuming 24MHz input clock with doubler ON */
  214. /* MFI PDF */
  215. #define DP_OP_850 ((8 << 4) + ((1 - 1) << 0))
  216. #define DP_MFD_850 (48 - 1)
  217. #define DP_MFN_850 41
  218. #define DP_OP_800 ((8 << 4) + ((1 - 1) << 0))
  219. #define DP_MFD_800 (3 - 1)
  220. #define DP_MFN_800 1
  221. #define DP_OP_700 ((7 << 4) + ((1 - 1) << 0))
  222. #define DP_MFD_700 (24 - 1)
  223. #define DP_MFN_700 7
  224. #define DP_OP_665 ((6 << 4) + ((1 - 1) << 0))
  225. #define DP_MFD_665 (96 - 1)
  226. #define DP_MFN_665 89
  227. #define DP_OP_532 ((5 << 4) + ((1 - 1) << 0))
  228. #define DP_MFD_532 (24 - 1)
  229. #define DP_MFN_532 13
  230. #define DP_OP_400 ((8 << 4) + ((2 - 1) << 0))
  231. #define DP_MFD_400 (3 - 1)
  232. #define DP_MFN_400 1
  233. #define DP_OP_216 ((6 << 4) + ((3 - 1) << 0))
  234. #define DP_MFD_216 (4 - 1)
  235. #define DP_MFN_216 3
  236. #define CHIP_REV_1_0 0x10
  237. #define CHIP_REV_1_1 0x11
  238. #define CHIP_REV_2_0 0x20
  239. #define CHIP_REV_2_5 0x25
  240. #define CHIP_REV_3_0 0x30
  241. #define BOARD_REV_1_0 0x0
  242. #define BOARD_REV_2_0 0x1
  243. #define IMX_IIM_BASE (IIM_BASE_ADDR)
  244. #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
  245. #include <asm/types.h>
  246. extern void imx_get_mac_from_fuse(unsigned char *mac);
  247. #define __REG(x) (*((volatile u32 *)(x)))
  248. #define __REG16(x) (*((volatile u16 *)(x)))
  249. #define __REG8(x) (*((volatile u8 *)(x)))
  250. struct clkctl {
  251. u32 ccr;
  252. u32 ccdr;
  253. u32 csr;
  254. u32 ccsr;
  255. u32 cacrr;
  256. u32 cbcdr;
  257. u32 cbcmr;
  258. u32 cscmr1;
  259. u32 cscmr2;
  260. u32 cscdr1;
  261. u32 cs1cdr;
  262. u32 cs2cdr;
  263. u32 cdcdr;
  264. u32 chsccdr;
  265. u32 cscdr2;
  266. u32 cscdr3;
  267. u32 cscdr4;
  268. u32 cwdr;
  269. u32 cdhipr;
  270. u32 cdcr;
  271. u32 ctor;
  272. u32 clpcr;
  273. u32 cisr;
  274. u32 cimr;
  275. u32 ccosr;
  276. u32 cgpr;
  277. u32 ccgr0;
  278. u32 ccgr1;
  279. u32 ccgr2;
  280. u32 ccgr3;
  281. u32 ccgr4;
  282. u32 ccgr5;
  283. u32 ccgr6;
  284. u32 cmeor;
  285. };
  286. /* WEIM registers */
  287. struct weim {
  288. u32 cs0gcr1;
  289. u32 cs0gcr2;
  290. u32 cs0rcr1;
  291. u32 cs0rcr2;
  292. u32 cs0wcr1;
  293. u32 cs0wcr2;
  294. u32 cs1gcr1;
  295. u32 cs1gcr2;
  296. u32 cs1rcr1;
  297. u32 cs1rcr2;
  298. u32 cs1wcr1;
  299. u32 cs1wcr2;
  300. u32 cs2gcr1;
  301. u32 cs2gcr2;
  302. u32 cs2rcr1;
  303. u32 cs2rcr2;
  304. u32 cs2wcr1;
  305. u32 cs2wcr2;
  306. u32 cs3gcr1;
  307. u32 cs3gcr2;
  308. u32 cs3rcr1;
  309. u32 cs3rcr2;
  310. u32 cs3wcr1;
  311. u32 cs3wcr2;
  312. u32 cs4gcr1;
  313. u32 cs4gcr2;
  314. u32 cs4rcr1;
  315. u32 cs4rcr2;
  316. u32 cs4wcr1;
  317. u32 cs4wcr2;
  318. u32 cs5gcr1;
  319. u32 cs5gcr2;
  320. u32 cs5rcr1;
  321. u32 cs5rcr2;
  322. u32 cs5wcr1;
  323. u32 cs5wcr2;
  324. u32 wcr;
  325. u32 wiar;
  326. u32 ear;
  327. };
  328. /* GPIO Registers */
  329. struct gpio_regs {
  330. u32 gpio_dr;
  331. u32 gpio_dir;
  332. u32 gpio_psr;
  333. };
  334. /* System Reset Controller (SRC) */
  335. struct src {
  336. u32 scr;
  337. u32 sbmr;
  338. u32 srsr;
  339. u32 reserved1[2];
  340. u32 sisr;
  341. u32 simr;
  342. };
  343. /* CSPI registers */
  344. struct cspi_regs {
  345. u32 rxdata;
  346. u32 txdata;
  347. u32 ctrl;
  348. u32 cfg;
  349. u32 intr;
  350. u32 dma;
  351. u32 stat;
  352. u32 period;
  353. };
  354. struct iim_regs {
  355. u32 stat;
  356. u32 statm;
  357. u32 err;
  358. u32 emask;
  359. u32 fctl;
  360. u32 ua;
  361. u32 la;
  362. u32 sdat;
  363. u32 prev;
  364. u32 srev;
  365. u32 preg_p;
  366. u32 scs0;
  367. u32 scs1;
  368. u32 scs2;
  369. u32 scs3;
  370. u32 res0[0x1f1];
  371. struct fuse_bank {
  372. u32 fuse_regs[0x20];
  373. u32 fuse_rsvd[0xe0];
  374. } bank[4];
  375. };
  376. struct fuse_bank1_regs {
  377. u32 fuse0_8[9];
  378. u32 mac_addr[6];
  379. u32 fuse15_31[0x11];
  380. };
  381. #endif /* __ASSEMBLER__*/
  382. #endif /* __ASM_ARCH_MX5_IMX_REGS_H__ */