fsl-imx25.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. /*
  2. * Freescale i.MX25 SoC emulation
  3. *
  4. * Copyright (C) 2015 Jean-Christophe Dubois <jcd@tribudubois.net>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful, but WITHOUT
  12. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  14. * for more details.
  15. */
  16. #ifndef FSL_IMX25_H
  17. #define FSL_IMX25_H
  18. #include "hw/arm/boot.h"
  19. #include "hw/intc/imx_avic.h"
  20. #include "hw/misc/imx25_ccm.h"
  21. #include "hw/char/imx_serial.h"
  22. #include "hw/timer/imx_gpt.h"
  23. #include "hw/timer/imx_epit.h"
  24. #include "hw/net/imx_fec.h"
  25. #include "hw/misc/imx_rngc.h"
  26. #include "hw/i2c/imx_i2c.h"
  27. #include "hw/gpio/imx_gpio.h"
  28. #include "hw/sd/sdhci.h"
  29. #include "hw/usb/chipidea.h"
  30. #include "hw/watchdog/wdt_imx2.h"
  31. #include "exec/memory.h"
  32. #include "target/arm/cpu.h"
  33. #include "qom/object.h"
  34. #define TYPE_FSL_IMX25 "fsl-imx25"
  35. OBJECT_DECLARE_SIMPLE_TYPE(FslIMX25State, FSL_IMX25)
  36. #define FSL_IMX25_NUM_UARTS 5
  37. #define FSL_IMX25_NUM_GPTS 4
  38. #define FSL_IMX25_NUM_EPITS 2
  39. #define FSL_IMX25_NUM_I2CS 3
  40. #define FSL_IMX25_NUM_GPIOS 4
  41. #define FSL_IMX25_NUM_ESDHCS 2
  42. #define FSL_IMX25_NUM_USBS 2
  43. struct FslIMX25State {
  44. /*< private >*/
  45. DeviceState parent_obj;
  46. /*< public >*/
  47. ARMCPU cpu;
  48. IMXAVICState avic;
  49. IMX25CCMState ccm;
  50. IMXSerialState uart[FSL_IMX25_NUM_UARTS];
  51. IMXGPTState gpt[FSL_IMX25_NUM_GPTS];
  52. IMXEPITState epit[FSL_IMX25_NUM_EPITS];
  53. IMXFECState fec;
  54. IMXRNGCState rngc;
  55. IMXI2CState i2c[FSL_IMX25_NUM_I2CS];
  56. IMXGPIOState gpio[FSL_IMX25_NUM_GPIOS];
  57. SDHCIState esdhc[FSL_IMX25_NUM_ESDHCS];
  58. ChipideaState usb[FSL_IMX25_NUM_USBS];
  59. IMX2WdtState wdt;
  60. MemoryRegion rom[2];
  61. MemoryRegion iram;
  62. MemoryRegion iram_alias;
  63. uint32_t phy_num;
  64. };
  65. /**
  66. * i.MX25 memory map
  67. ****************************************************************
  68. * 0x0000_0000 0x0000_3FFF 16 Kbytes ROM (36 Kbytes)
  69. * 0x0000_4000 0x0040_3FFF 4 Mbytes Reserved
  70. * 0x0040_4000 0x0040_8FFF 20 Kbytes ROM (36 Kbytes)
  71. * 0x0040_9000 0x0FFF_FFFF 252 Mbytes (minus 36 Kbytes) Reserved
  72. * 0x1000_0000 0x1FFF_FFFF 256 Mbytes Reserved
  73. * 0x2000_0000 0x2FFF_FFFF 256 Mbytes Reserved
  74. * 0x3000_0000 0x3FFF_FFFF 256 Mbytes Reserved
  75. * 0x4000_0000 0x43EF_FFFF 63 Mbytes Reserved
  76. * 0x43F0_0000 0x43F0_3FFF 16 Kbytes AIPS A control registers
  77. * 0x43F0_4000 0x43F0_7FFF 16 Kbytes ARM926 platform MAX
  78. * 0x43F0_8000 0x43F0_BFFF 16 Kbytes ARM926 platform CLKCTL
  79. * 0x43F0_C000 0x43F0_FFFF 16 Kbytes ARM926 platform ETB registers
  80. * 0x43F1_0000 0x43F1_3FFF 16 Kbytes ARM926 platform ETB memory
  81. * 0x43F1_4000 0x43F1_7FFF 16 Kbytes ARM926 platform AAPE registers
  82. * 0x43F1_8000 0x43F7_FFFF 416 Kbytes Reserved
  83. * 0x43F8_0000 0x43F8_3FFF 16 Kbytes I2C-1
  84. * 0x43F8_4000 0x43F8_7FFF 16 Kbytes I2C-3
  85. * 0x43F8_8000 0x43F8_BFFF 16 Kbytes CAN-1
  86. * 0x43F8_C000 0x43F8_FFFF 16 Kbytes CAN-2
  87. * 0x43F9_0000 0x43F9_3FFF 16 Kbytes UART-1
  88. * 0x43F9_4000 0x43F9_7FFF 16 Kbytes UART-2
  89. * 0x43F9_8000 0x43F9_BFFF 16 Kbytes I2C-2
  90. * 0x43F9_C000 0x43F9_FFFF 16 Kbytes 1-Wire
  91. * 0x43FA_0000 0x43FA_3FFF 16 Kbytes ATA (CPU side)
  92. * 0x43FA_4000 0x43FA_7FFF 16 Kbytes CSPI-1
  93. * 0x43FA_8000 0x43FA_BFFF 16 Kbytes KPP
  94. * 0x43FA_C000 0x43FA_FFFF 16 Kbytes IOMUXC
  95. * 0x43FB_0000 0x43FB_3FFF 16 Kbytes AUDMUX
  96. * 0x43FB_4000 0x43FB_7FFF 16 Kbytes Reserved
  97. * 0x43FB_8000 0x43FB_BFFF 16 Kbytes ECT (IP BUS A)
  98. * 0x43FB_C000 0x43FB_FFFF 16 Kbytes ECT (IP BUS B)
  99. * 0x43FC_0000 0x43FF_FFFF 256 Kbytes Reserved AIPS A off-platform slots
  100. * 0x4400_0000 0x4FFF_FFFF 192 Mbytes Reserved
  101. * 0x5000_0000 0x5000_3FFF 16 Kbytes SPBA base address
  102. * 0x5000_4000 0x5000_7FFF 16 Kbytes CSPI-3
  103. * 0x5000_8000 0x5000_BFFF 16 Kbytes UART-4
  104. * 0x5000_C000 0x5000_FFFF 16 Kbytes UART-3
  105. * 0x5001_0000 0x5001_3FFF 16 Kbytes CSPI-2
  106. * 0x5001_4000 0x5001_7FFF 16 Kbytes SSI-2
  107. * 0x5001_C000 0x5001_FFFF 16 Kbytes Reserved
  108. * 0x5002_0000 0x5002_3FFF 16 Kbytes ATA
  109. * 0x5002_4000 0x5002_7FFF 16 Kbytes SIM-1
  110. * 0x5002_8000 0x5002_BFFF 16 Kbytes SIM-2
  111. * 0x5002_C000 0x5002_FFFF 16 Kbytes UART-5
  112. * 0x5003_0000 0x5003_3FFF 16 Kbytes TSC
  113. * 0x5003_4000 0x5003_7FFF 16 Kbytes SSI-1
  114. * 0x5003_8000 0x5003_BFFF 16 Kbytes FEC
  115. * 0x5003_C000 0x5003_FFFF 16 Kbytes SPBA registers
  116. * 0x5004_0000 0x51FF_FFFF 32 Mbytes (minus 256 Kbytes)
  117. * 0x5200_0000 0x53EF_FFFF 31 Mbytes Reserved
  118. * 0x53F0_0000 0x53F0_3FFF 16 Kbytes AIPS B control registers
  119. * 0x53F0_4000 0x53F7_FFFF 496 Kbytes Reserved
  120. * 0x53F8_0000 0x53F8_3FFF 16 Kbytes CCM
  121. * 0x53F8_4000 0x53F8_7FFF 16 Kbytes GPT-4
  122. * 0x53F8_8000 0x53F8_BFFF 16 Kbytes GPT-3
  123. * 0x53F8_C000 0x53F8_FFFF 16 Kbytes GPT-2
  124. * 0x53F9_0000 0x53F9_3FFF 16 Kbytes GPT-1
  125. * 0x53F9_4000 0x53F9_7FFF 16 Kbytes EPIT-1
  126. * 0x53F9_8000 0x53F9_BFFF 16 Kbytes EPIT-2
  127. * 0x53F9_C000 0x53F9_FFFF 16 Kbytes GPIO-4
  128. * 0x53FA_0000 0x53FA_3FFF 16 Kbytes PWM-2
  129. * 0x53FA_4000 0x53FA_7FFF 16 Kbytes GPIO-3
  130. * 0x53FA_8000 0x53FA_BFFF 16 Kbytes PWM-3
  131. * 0x53FA_C000 0x53FA_FFFF 16 Kbytes SCC
  132. * 0x53FB_0000 0x53FB_3FFF 16 Kbytes RNGB
  133. * 0x53FB_4000 0x53FB_7FFF 16 Kbytes eSDHC-1
  134. * 0x53FB_8000 0x53FB_BFFF 16 Kbytes eSDHC-2
  135. * 0x53FB_C000 0x53FB_FFFF 16 Kbytes LCDC
  136. * 0x53FC_0000 0x53FC_3FFF 16 Kbytes SLCDC
  137. * 0x53FC_4000 0x53FC_7FFF 16 Kbytes Reserved
  138. * 0x53FC_8000 0x53FC_BFFF 16 Kbytes PWM-4
  139. * 0x53FC_C000 0x53FC_FFFF 16 Kbytes GPIO-1
  140. * 0x53FD_0000 0x53FD_3FFF 16 Kbytes GPIO-2
  141. * 0x53FD_4000 0x53FD_7FFF 16 Kbytes SDMA
  142. * 0x53FD_8000 0x53FD_BFFF 16 Kbytes Reserved
  143. * 0x53FD_C000 0x53FD_FFFF 16 Kbytes WDOG
  144. * 0x53FE_0000 0x53FE_3FFF 16 Kbytes PWM-1
  145. * 0x53FE_4000 0x53FE_7FFF 16 Kbytes Reserved
  146. * 0x53FE_8000 0x53FE_BFFF 16 Kbytes Reserved
  147. * 0x53FE_C000 0x53FE_FFFF 16 Kbytes RTICv3
  148. * 0x53FF_0000 0x53FF_3FFF 16 Kbytes IIM
  149. * 0x53FF_4000 0x53FF_7FFF 16 Kbytes USB
  150. * 0x53FF_8000 0x53FF_BFFF 16 Kbytes CSI
  151. * 0x53FF_C000 0x53FF_FFFF 16 Kbytes DryIce
  152. * 0x5400_0000 0x5FFF_FFFF 192 Mbytes Reserved (aliased AIPS B slots)
  153. * 0x6000_0000 0x67FF_FFFF 128 Mbytes ARM926 platform ROMPATCH
  154. * 0x6800_0000 0x6FFF_FFFF 128 Mbytes ARM926 platform ASIC
  155. * 0x7000_0000 0x77FF_FFFF 128 Mbytes Reserved
  156. * 0x7800_0000 0x7801_FFFF 128 Kbytes RAM
  157. * 0x7802_0000 0x7FFF_FFFF 128 Mbytes (minus 128 Kbytes)
  158. * 0x8000_0000 0x8FFF_FFFF 256 Mbytes SDRAM bank 0
  159. * 0x9000_0000 0x9FFF_FFFF 256 Mbytes SDRAM bank 1
  160. * 0xA000_0000 0xA7FF_FFFF 128 Mbytes WEIM CS0 (flash 128) 1
  161. * 0xA800_0000 0xAFFF_FFFF 128 Mbytes WEIM CS1 (flash 64) 1
  162. * 0xB000_0000 0xB1FF_FFFF 32 Mbytes WEIM CS2 (SRAM)
  163. * 0xB200_0000 0xB3FF_FFFF 32 Mbytes WEIM CS3 (SRAM)
  164. * 0xB400_0000 0xB5FF_FFFF 32 Mbytes WEIM CS4
  165. * 0xB600_0000 0xB7FF_FFFF 32 Mbytes Reserved
  166. * 0xB800_0000 0xB800_0FFF 4 Kbytes Reserved
  167. * 0xB800_1000 0xB800_1FFF 4 Kbytes SDRAM control registers
  168. * 0xB800_2000 0xB800_2FFF 4 Kbytes WEIM control registers
  169. * 0xB800_3000 0xB800_3FFF 4 Kbytes M3IF control registers
  170. * 0xB800_4000 0xB800_4FFF 4 Kbytes EMI control registers
  171. * 0xB800_5000 0xBAFF_FFFF 32 Mbytes (minus 20 Kbytes)
  172. * 0xBB00_0000 0xBB00_0FFF 4 Kbytes NAND flash main area buffer
  173. * 0xBB00_1000 0xBB00_11FF 512 B NAND flash spare area buffer
  174. * 0xBB00_1200 0xBB00_1DFF 3 Kbytes Reserved
  175. * 0xBB00_1E00 0xBB00_1FFF 512 B NAND flash control registers
  176. * 0xBB01_2000 0xBFFF_FFFF 96 Mbytes (minus 8 Kbytes) Reserved
  177. * 0xC000_0000 0xFFFF_FFFF 1024 Mbytes Reserved
  178. */
  179. #define FSL_IMX25_ROM0_ADDR 0x00000000
  180. #define FSL_IMX25_ROM0_SIZE 0x4000
  181. #define FSL_IMX25_ROM1_ADDR 0x00404000
  182. #define FSL_IMX25_ROM1_SIZE 0x4000
  183. #define FSL_IMX25_I2C1_ADDR 0x43F80000
  184. #define FSL_IMX25_I2C1_SIZE 0x4000
  185. #define FSL_IMX25_I2C3_ADDR 0x43F84000
  186. #define FSL_IMX25_I2C3_SIZE 0x4000
  187. #define FSL_IMX25_UART1_ADDR 0x43F90000
  188. #define FSL_IMX25_UART1_SIZE 0x4000
  189. #define FSL_IMX25_UART2_ADDR 0x43F94000
  190. #define FSL_IMX25_UART2_SIZE 0x4000
  191. #define FSL_IMX25_I2C2_ADDR 0x43F98000
  192. #define FSL_IMX25_I2C2_SIZE 0x4000
  193. #define FSL_IMX25_UART4_ADDR 0x50008000
  194. #define FSL_IMX25_UART4_SIZE 0x4000
  195. #define FSL_IMX25_UART3_ADDR 0x5000C000
  196. #define FSL_IMX25_UART3_SIZE 0x4000
  197. #define FSL_IMX25_UART5_ADDR 0x5002C000
  198. #define FSL_IMX25_UART5_SIZE 0x4000
  199. #define FSL_IMX25_FEC_ADDR 0x50038000
  200. #define FSL_IMX25_CCM_ADDR 0x53F80000
  201. #define FSL_IMX25_CCM_SIZE 0x4000
  202. #define FSL_IMX25_GPT4_ADDR 0x53F84000
  203. #define FSL_IMX25_GPT4_SIZE 0x4000
  204. #define FSL_IMX25_GPT3_ADDR 0x53F88000
  205. #define FSL_IMX25_GPT3_SIZE 0x4000
  206. #define FSL_IMX25_GPT2_ADDR 0x53F8C000
  207. #define FSL_IMX25_GPT2_SIZE 0x4000
  208. #define FSL_IMX25_GPT1_ADDR 0x53F90000
  209. #define FSL_IMX25_GPT1_SIZE 0x4000
  210. #define FSL_IMX25_EPIT1_ADDR 0x53F94000
  211. #define FSL_IMX25_EPIT1_SIZE 0x4000
  212. #define FSL_IMX25_EPIT2_ADDR 0x53F98000
  213. #define FSL_IMX25_EPIT2_SIZE 0x4000
  214. #define FSL_IMX25_GPIO4_ADDR 0x53F9C000
  215. #define FSL_IMX25_GPIO4_SIZE 0x4000
  216. #define FSL_IMX25_GPIO3_ADDR 0x53FA4000
  217. #define FSL_IMX25_GPIO3_SIZE 0x4000
  218. #define FSL_IMX25_RNGC_ADDR 0x53FB0000
  219. #define FSL_IMX25_RNGC_SIZE 0x4000
  220. #define FSL_IMX25_ESDHC1_ADDR 0x53FB4000
  221. #define FSL_IMX25_ESDHC1_SIZE 0x4000
  222. #define FSL_IMX25_ESDHC2_ADDR 0x53FB8000
  223. #define FSL_IMX25_ESDHC2_SIZE 0x4000
  224. #define FSL_IMX25_GPIO1_ADDR 0x53FCC000
  225. #define FSL_IMX25_GPIO1_SIZE 0x4000
  226. #define FSL_IMX25_GPIO2_ADDR 0x53FD0000
  227. #define FSL_IMX25_GPIO2_SIZE 0x4000
  228. #define FSL_IMX25_WDT_ADDR 0x53FDC000
  229. #define FSL_IMX25_WDT_SIZE 0x4000
  230. #define FSL_IMX25_USB1_ADDR 0x53FF4000
  231. #define FSL_IMX25_USB1_SIZE 0x0200
  232. #define FSL_IMX25_USB2_ADDR 0x53FF4400
  233. #define FSL_IMX25_USB2_SIZE 0x0200
  234. #define FSL_IMX25_AVIC_ADDR 0x68000000
  235. #define FSL_IMX25_AVIC_SIZE 0x4000
  236. #define FSL_IMX25_IRAM_ADDR 0x78000000
  237. #define FSL_IMX25_IRAM_SIZE 0x20000
  238. #define FSL_IMX25_IRAM_ALIAS_ADDR 0x78020000
  239. #define FSL_IMX25_IRAM_ALIAS_SIZE 0x7FE0000
  240. #define FSL_IMX25_SDRAM0_ADDR 0x80000000
  241. #define FSL_IMX25_SDRAM0_SIZE 0x10000000
  242. #define FSL_IMX25_SDRAM1_ADDR 0x90000000
  243. #define FSL_IMX25_SDRAM1_SIZE 0x10000000
  244. #define FSL_IMX25_UART1_IRQ 45
  245. #define FSL_IMX25_UART2_IRQ 32
  246. #define FSL_IMX25_UART3_IRQ 18
  247. #define FSL_IMX25_UART4_IRQ 5
  248. #define FSL_IMX25_UART5_IRQ 40
  249. #define FSL_IMX25_GPT1_IRQ 54
  250. #define FSL_IMX25_GPT2_IRQ 53
  251. #define FSL_IMX25_GPT3_IRQ 29
  252. #define FSL_IMX25_GPT4_IRQ 1
  253. #define FSL_IMX25_EPIT1_IRQ 28
  254. #define FSL_IMX25_EPIT2_IRQ 27
  255. #define FSL_IMX25_FEC_IRQ 57
  256. #define FSL_IMX25_RNGC_IRQ 22
  257. #define FSL_IMX25_I2C1_IRQ 3
  258. #define FSL_IMX25_I2C2_IRQ 4
  259. #define FSL_IMX25_I2C3_IRQ 10
  260. #define FSL_IMX25_GPIO1_IRQ 52
  261. #define FSL_IMX25_GPIO2_IRQ 51
  262. #define FSL_IMX25_GPIO3_IRQ 16
  263. #define FSL_IMX25_GPIO4_IRQ 23
  264. #define FSL_IMX25_ESDHC1_IRQ 9
  265. #define FSL_IMX25_ESDHC2_IRQ 8
  266. #define FSL_IMX25_USB1_IRQ 37
  267. #define FSL_IMX25_USB2_IRQ 35
  268. #define FSL_IMX25_WDT_IRQ 55
  269. #endif /* FSL_IMX25_H */