imx-regs.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (c) 2007 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
  4. *
  5. * (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
  6. */
  7. #ifndef __ASM_ARCH_MX35_H
  8. #define __ASM_ARCH_MX35_H
  9. #define ARCH_MXC
  10. /*
  11. * IRAM
  12. */
  13. #define IRAM_BASE_ADDR 0x10000000 /* internal ram */
  14. #define IRAM_SIZE 0x00020000 /* 128 KB */
  15. #define LOW_LEVEL_SRAM_STACK 0x1001E000
  16. /*
  17. * AIPS 1
  18. */
  19. #define AIPS1_BASE_ADDR 0x43F00000
  20. #define AIPS1_CTRL_BASE_ADDR AIPS1_BASE_ADDR
  21. #define MAX_BASE_ADDR 0x43F04000
  22. #define EVTMON_BASE_ADDR 0x43F08000
  23. #define CLKCTL_BASE_ADDR 0x43F0C000
  24. #define I2C1_BASE_ADDR 0x43F80000
  25. #define I2C3_BASE_ADDR 0x43F84000
  26. #define ATA_BASE_ADDR 0x43F8C000
  27. #define UART1_BASE 0x43F90000
  28. #define UART2_BASE 0x43F94000
  29. #define I2C2_BASE_ADDR 0x43F98000
  30. #define CSPI1_BASE_ADDR 0x43FA4000
  31. #define IOMUXC_BASE_ADDR 0x43FAC000
  32. /*
  33. * SPBA
  34. */
  35. #define SPBA_BASE_ADDR 0x50000000
  36. #define UART3_BASE 0x5000C000
  37. #define CSPI2_BASE_ADDR 0x50010000
  38. #define ATA_DMA_BASE_ADDR 0x50020000
  39. #define FEC_BASE_ADDR 0x50038000
  40. #define SPBA_CTRL_BASE_ADDR 0x5003C000
  41. /*
  42. * AIPS 2
  43. */
  44. #define AIPS2_BASE_ADDR 0x53F00000
  45. #define AIPS2_CTRL_BASE_ADDR AIPS2_BASE_ADDR
  46. #define CCM_BASE_ADDR 0x53F80000
  47. #define GPT1_BASE_ADDR 0x53F90000
  48. #define EPIT1_BASE_ADDR 0x53F94000
  49. #define EPIT2_BASE_ADDR 0x53F98000
  50. #define GPIO3_BASE_ADDR 0x53FA4000
  51. #define MMC_SDHC1_BASE_ADDR 0x53FB4000
  52. #define MMC_SDHC2_BASE_ADDR 0x53FB8000
  53. #define MMC_SDHC3_BASE_ADDR 0x53FBC000
  54. #define IPU_CTRL_BASE_ADDR 0x53FC0000
  55. #define GPIO1_BASE_ADDR 0x53FCC000
  56. #define GPIO2_BASE_ADDR 0x53FD0000
  57. #define SDMA_BASE_ADDR 0x53FD4000
  58. #define RTC_BASE_ADDR 0x53FD8000
  59. #define WDOG1_BASE_ADDR 0x53FDC000
  60. #define PWM_BASE_ADDR 0x53FE0000
  61. #define RTIC_BASE_ADDR 0x53FEC000
  62. #define IIM_BASE_ADDR 0x53FF0000
  63. #define IMX_USB_BASE 0x53FF4000
  64. #define IMX_USB_PORT_OFFSET 0x400
  65. #define IMX_CCM_BASE CCM_BASE_ADDR
  66. /*
  67. * ROMPATCH and AVIC
  68. */
  69. #define ROMPATCH_BASE_ADDR 0x60000000
  70. #define AVIC_BASE_ADDR 0x68000000
  71. /*
  72. * NAND, SDRAM, WEIM, M3IF, EMI controllers
  73. */
  74. #define EXT_MEM_CTRL_BASE 0xB8000000
  75. #define ESDCTL_BASE_ADDR 0xB8001000
  76. #define WEIM_BASE_ADDR 0xB8002000
  77. #define WEIM_CTRL_CS0 WEIM_BASE_ADDR
  78. #define WEIM_CTRL_CS1 (WEIM_BASE_ADDR + 0x10)
  79. #define WEIM_CTRL_CS2 (WEIM_BASE_ADDR + 0x20)
  80. #define WEIM_CTRL_CS3 (WEIM_BASE_ADDR + 0x30)
  81. #define WEIM_CTRL_CS4 (WEIM_BASE_ADDR + 0x40)
  82. #define WEIM_CTRL_CS5 (WEIM_BASE_ADDR + 0x50)
  83. #define M3IF_BASE_ADDR 0xB8003000
  84. #define EMI_BASE_ADDR 0xB8004000
  85. #define NFC_BASE_ADDR 0xBB000000
  86. /*
  87. * Memory regions and CS
  88. */
  89. #define IPU_MEM_BASE_ADDR 0x70000000
  90. #define CSD0_BASE_ADDR 0x80000000
  91. #define CSD1_BASE_ADDR 0x90000000
  92. #define CS0_BASE_ADDR 0xA0000000
  93. #define CS1_BASE_ADDR 0xA8000000
  94. #define CS2_BASE_ADDR 0xB0000000
  95. #define CS3_BASE_ADDR 0xB2000000
  96. #define CS4_BASE_ADDR 0xB4000000
  97. #define CS5_BASE_ADDR 0xB6000000
  98. /*
  99. * IRQ Controller Register Definitions.
  100. */
  101. #define AVIC_NIMASK 0x04
  102. #define AVIC_INTTYPEH 0x18
  103. #define AVIC_INTTYPEL 0x1C
  104. /* L210 */
  105. #define L2CC_BASE_ADDR 0x30000000
  106. #define L2_CACHE_LINE_SIZE 32
  107. #define L2_CACHE_CTL_REG 0x100
  108. #define L2_CACHE_AUX_CTL_REG 0x104
  109. #define L2_CACHE_SYNC_REG 0x730
  110. #define L2_CACHE_INV_LINE_REG 0x770
  111. #define L2_CACHE_INV_WAY_REG 0x77C
  112. #define L2_CACHE_CLEAN_LINE_REG 0x7B0
  113. #define L2_CACHE_CLEAN_INV_LINE_REG 0x7F0
  114. #define L2_CACHE_DBG_CTL_REG 0xF40
  115. #define CLKMODE_AUTO 0
  116. #define CLKMODE_CONSUMER 1
  117. #define PLL_PD(x) (((x) & 0xf) << 26)
  118. #define PLL_MFD(x) (((x) & 0x3ff) << 16)
  119. #define PLL_MFI(x) (((x) & 0xf) << 10)
  120. #define PLL_MFN(x) (((x) & 0x3ff) << 0)
  121. #define _PLL_BRM(x) ((x) << 31)
  122. #define _PLL_PD(x) (((x) - 1) << 26)
  123. #define _PLL_MFD(x) (((x) - 1) << 16)
  124. #define _PLL_MFI(x) ((x) << 10)
  125. #define _PLL_MFN(x) (x)
  126. #define _PLL_SETTING(brm, pd, mfd, mfi, mfn) \
  127. (_PLL_BRM(brm) | _PLL_PD(pd) | _PLL_MFD(mfd) | _PLL_MFI(mfi) |\
  128. _PLL_MFN(mfn))
  129. #define CCM_MPLL_532_HZ _PLL_SETTING(1, 1, 12, 11, 1)
  130. #define CCM_MPLL_399_HZ _PLL_SETTING(0, 1, 16, 8, 5)
  131. #define CCM_PPLL_300_HZ _PLL_SETTING(0, 1, 4, 6, 1)
  132. #define CSCR_U(x) (WEIM_CTRL_CS#x + 0)
  133. #define CSCR_L(x) (WEIM_CTRL_CS#x + 4)
  134. #define CSCR_A(x) (WEIM_CTRL_CS#x + 8)
  135. #define IIM_SREV 0x24
  136. #define ROMPATCH_REV 0x40
  137. #define IPU_CONF IPU_CTRL_BASE_ADDR
  138. #define IPU_CONF_PXL_ENDIAN (1<<8)
  139. #define IPU_CONF_DU_EN (1<<7)
  140. #define IPU_CONF_DI_EN (1<<6)
  141. #define IPU_CONF_ADC_EN (1<<5)
  142. #define IPU_CONF_SDC_EN (1<<4)
  143. #define IPU_CONF_PF_EN (1<<3)
  144. #define IPU_CONF_ROT_EN (1<<2)
  145. #define IPU_CONF_IC_EN (1<<1)
  146. #define IPU_CONF_CSI_EN (1<<0)
  147. /*
  148. * CSPI register definitions
  149. */
  150. #define MXC_CSPI
  151. #define MXC_CSPICTRL_EN (1 << 0)
  152. #define MXC_CSPICTRL_MODE (1 << 1)
  153. #define MXC_CSPICTRL_XCH (1 << 2)
  154. #define MXC_CSPICTRL_SMC (1 << 3)
  155. #define MXC_CSPICTRL_POL (1 << 4)
  156. #define MXC_CSPICTRL_PHA (1 << 5)
  157. #define MXC_CSPICTRL_SSCTL (1 << 6)
  158. #define MXC_CSPICTRL_SSPOL (1 << 7)
  159. #define MXC_CSPICTRL_CHIPSELECT(x) (((x) & 0x3) << 12)
  160. #define MXC_CSPICTRL_BITCOUNT(x) (((x) & 0xfff) << 20)
  161. #define MXC_CSPICTRL_DATARATE(x) (((x) & 0x7) << 16)
  162. #define MXC_CSPICTRL_TC (1 << 7)
  163. #define MXC_CSPICTRL_RXOVF (1 << 6)
  164. #define MXC_CSPICTRL_MAXBITS 0xfff
  165. #define MXC_CSPIPERIOD_32KHZ (1 << 15)
  166. #define MAX_SPI_BYTES 4
  167. #define MXC_SPI_BASE_ADDRESSES \
  168. 0x43fa4000, \
  169. 0x50010000,
  170. #define GPIO_PORT_NUM 3
  171. #define GPIO_NUM_PIN 32
  172. #define CHIP_REV_1_0 0x10
  173. #define CHIP_REV_2_0 0x20
  174. #define BOARD_REV_1_0 0x0
  175. #define BOARD_REV_2_0 0x1
  176. #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
  177. #include <asm/types.h>
  178. /* Clock Control Module (CCM) registers */
  179. struct ccm_regs {
  180. u32 ccmr; /* Control */
  181. u32 pdr0; /* Post divider 0 */
  182. u32 pdr1; /* Post divider 1 */
  183. u32 pdr2; /* Post divider 2 */
  184. u32 pdr3; /* Post divider 3 */
  185. u32 pdr4; /* Post divider 4 */
  186. u32 rcsr; /* CCM Status */
  187. u32 mpctl; /* Core PLL Control */
  188. u32 ppctl; /* Peripheral PLL Control */
  189. u32 acmr; /* Audio clock mux */
  190. u32 cosr; /* Clock out source */
  191. u32 cgr0; /* Clock Gating Control 0 */
  192. u32 cgr1; /* Clock Gating Control 1 */
  193. u32 cgr2; /* Clock Gating Control 2 */
  194. u32 cgr3; /* Clock Gating Control 3 */
  195. u32 reserved;
  196. u32 dcvr0; /* DPTC Comparator 0 */
  197. u32 dcvr1; /* DPTC Comparator 0 */
  198. u32 dcvr2; /* DPTC Comparator 0 */
  199. u32 dcvr3; /* DPTC Comparator 0 */
  200. u32 ltr0; /* Load Tracking 0 */
  201. u32 ltr1; /* Load Tracking 1 */
  202. u32 ltr2; /* Load Tracking 2 */
  203. u32 ltr3; /* Load Tracking 3 */
  204. u32 ltbr0; /* Load Tracking Buffer 0 */
  205. };
  206. /* IIM control registers */
  207. struct iim_regs {
  208. u32 iim_stat;
  209. u32 iim_statm;
  210. u32 iim_err;
  211. u32 iim_emask;
  212. u32 iim_fctl;
  213. u32 iim_ua;
  214. u32 iim_la;
  215. u32 iim_sdat;
  216. u32 iim_prev;
  217. u32 iim_srev;
  218. u32 iim_prg_p;
  219. u32 iim_scs0;
  220. u32 iim_scs1;
  221. u32 iim_scs2;
  222. u32 iim_scs3;
  223. u32 res1[0x1f1];
  224. struct fuse_bank {
  225. u32 fuse_regs[0x20];
  226. u32 fuse_rsvd[0xe0];
  227. } bank[3];
  228. };
  229. struct fuse_bank0_regs {
  230. u32 fuse0_7[8];
  231. u32 uid[8];
  232. u32 fuse16_31[0x10];
  233. };
  234. struct fuse_bank1_regs {
  235. u32 fuse0_21[0x16];
  236. u32 usr;
  237. u32 fuse23_31[9];
  238. };
  239. /* General Purpose Timer (GPT) registers */
  240. struct gpt_regs {
  241. u32 ctrl; /* control */
  242. u32 pre; /* prescaler */
  243. u32 stat; /* status */
  244. u32 intr; /* interrupt */
  245. u32 cmp[3]; /* output compare 1-3 */
  246. u32 capt[2]; /* input capture 1-2 */
  247. u32 counter; /* counter */
  248. };
  249. /* CSPI registers */
  250. struct cspi_regs {
  251. u32 rxdata;
  252. u32 txdata;
  253. u32 ctrl;
  254. u32 intr;
  255. u32 dma;
  256. u32 stat;
  257. u32 period;
  258. u32 test;
  259. };
  260. struct esdc_regs {
  261. u32 esdctl0;
  262. u32 esdcfg0;
  263. u32 esdctl1;
  264. u32 esdcfg1;
  265. u32 esdmisc;
  266. u32 reserved[4];
  267. u32 esdcdly[5];
  268. u32 esdcdlyl;
  269. };
  270. #define ESDC_MISC_RST (1 << 1)
  271. #define ESDC_MISC_MDDR_EN (1 << 2)
  272. #define ESDC_MISC_MDDR_DL_RST (1 << 3)
  273. #define ESDC_MISC_DDR_EN (1 << 8)
  274. #define ESDC_MISC_DDR2_EN (1 << 9)
  275. /* Multi-Layer AHB Crossbar Switch (MAX) registers */
  276. struct max_regs {
  277. u32 mpr0;
  278. u32 pad00[3];
  279. u32 sgpcr0;
  280. u32 pad01[59];
  281. u32 mpr1;
  282. u32 pad02[3];
  283. u32 sgpcr1;
  284. u32 pad03[59];
  285. u32 mpr2;
  286. u32 pad04[3];
  287. u32 sgpcr2;
  288. u32 pad05[59];
  289. u32 mpr3;
  290. u32 pad06[3];
  291. u32 sgpcr3;
  292. u32 pad07[59];
  293. u32 mpr4;
  294. u32 pad08[3];
  295. u32 sgpcr4;
  296. u32 pad09[251];
  297. u32 mgpcr0;
  298. u32 pad10[63];
  299. u32 mgpcr1;
  300. u32 pad11[63];
  301. u32 mgpcr2;
  302. u32 pad12[63];
  303. u32 mgpcr3;
  304. u32 pad13[63];
  305. u32 mgpcr4;
  306. u32 pad14[63];
  307. u32 mgpcr5;
  308. };
  309. /* AHB <-> IP-Bus Interface (AIPS) */
  310. struct aips_regs {
  311. u32 mpr_0_7;
  312. u32 mpr_8_15;
  313. u32 pad0[6];
  314. u32 pacr_0_7;
  315. u32 pacr_8_15;
  316. u32 pacr_16_23;
  317. u32 pacr_24_31;
  318. u32 pad1[4];
  319. u32 opacr_0_7;
  320. u32 opacr_8_15;
  321. u32 opacr_16_23;
  322. u32 opacr_24_31;
  323. u32 opacr_32_39;
  324. };
  325. /*
  326. * NFMS bit in RCSR register for pagesize of nandflash
  327. */
  328. #define NFMS_BIT 8
  329. #define NFMS_NF_DWIDTH 14
  330. #define NFMS_NF_PG_SZ 8
  331. #define CCM_RCSR_NF_16BIT_SEL (1 << 14)
  332. #endif
  333. /*
  334. * Generic timer support
  335. */
  336. #ifdef CONFIG_MX35_CLK32
  337. #define CONFIG_SYS_TIMER_RATE CONFIG_MX35_CLK32
  338. #else
  339. #define CONFIG_SYS_TIMER_RATE 32768
  340. #endif
  341. #define CONFIG_SYS_TIMER_COUNTER (GPT1_BASE_ADDR+36)
  342. #endif /* __ASM_ARCH_MX35_H */