sama5d4.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Chip-specific header file for the SAMA5D4 SoC
  4. *
  5. * Copyright (C) 2014 Atmel
  6. * Bo Shen <voice.shen@atmel.com>
  7. */
  8. #ifndef __SAMA5D4_H
  9. #define __SAMA5D4_H
  10. /*
  11. * Peripheral identifiers/interrupts.
  12. */
  13. #define ATMEL_ID_FIQ 0 /* FIQ Interrupt */
  14. #define ATMEL_ID_SYS 1 /* System Controller */
  15. #define ATMEL_ID_ARM 2 /* Performance Monitor Unit */
  16. #define ATMEL_ID_PIT 3 /* Periodic Interval Timer */
  17. #define ATMEL_ID_WDT 4 /* Watchdog timer */
  18. #define ATMEL_ID_PIOD 5 /* Parallel I/O Controller D */
  19. #define ATMEL_ID_USART0 6 /* USART 0 */
  20. #define ATMEL_ID_USART1 7 /* USART 1 */
  21. #define ATMEL_ID_DMA0 8 /* DMA Controller 0 */
  22. #define ATMEL_ID_ICM 9 /* Integrity Check Monitor */
  23. #define ATMEL_ID_PKCC 10 /* Public Key Crypto Controller */
  24. #define ATMEL_ID_AES 12 /* Advanced Encryption Standard */
  25. #define ATMEL_ID_AESB 13 /* AES Bridge*/
  26. #define ATMEL_ID_TDES 14 /* Triple Data Encryption Standard */
  27. #define ATMEL_ID_SHA 15 /* SHA Signature */
  28. #define ATMEL_ID_MPDDRC 16 /* MPDDR controller */
  29. #define ATMEL_ID_MATRIX1 17 /* H32MX, 32-bit AHB Matrix */
  30. #define ATMEL_ID_MATRIX0 18 /* H64MX, 64-bit AHB Matrix */
  31. #define ATMEL_ID_VDEC 19 /* Video Decoder */
  32. #define ATMEL_ID_SBM 20 /* Secure Box Module */
  33. #define ATMEL_ID_SMC 22 /* Multi-bit ECC interrupt */
  34. #define ATMEL_ID_PIOA 23 /* Parallel I/O Controller A */
  35. #define ATMEL_ID_PIOB 24 /* Parallel I/O Controller B */
  36. #define ATMEL_ID_PIOC 25 /* Parallel I/O Controller C */
  37. #define ATMEL_ID_PIOE 26 /* Parallel I/O Controller E */
  38. #define ATMEL_ID_UART0 27 /* UART 0 */
  39. #define ATMEL_ID_UART1 28 /* UART 1 */
  40. #define ATMEL_ID_USART2 29 /* USART 2 */
  41. #define ATMEL_ID_USART3 30 /* USART 3 */
  42. #define ATMEL_ID_USART4 31 /* USART 4 */
  43. #define ATMEL_ID_TWI0 32 /* Two-Wire Interface 0 */
  44. #define ATMEL_ID_TWI1 33 /* Two-Wire Interface 1 */
  45. #define ATMEL_ID_TWI2 34 /* Two-Wire Interface 2 */
  46. #define ATMEL_ID_MCI0 35 /* High Speed Multimedia Card Interface 0 */
  47. #define ATMEL_ID_MCI1 36 /* High Speed Multimedia Card Interface 1 */
  48. #define ATMEL_ID_SPI0 37 /* Serial Peripheral Interface 0 */
  49. #define ATMEL_ID_SPI1 38 /* Serial Peripheral Interface 1 */
  50. #define ATMEL_ID_SPI2 39 /* Serial Peripheral Interface 2 */
  51. #define ATMEL_ID_TC0 40 /* Timer Counter 0 (ch. 0, 1, 2) */
  52. #define ATMEL_ID_TC1 41 /* Timer Counter 1 (ch. 3, 4, 5) */
  53. #define ATMEL_ID_TC2 42 /* Timer Counter 2 (ch. 6, 7, 8) */
  54. #define ATMEL_ID_PWMC 43 /* Pulse Width Modulation Controller */
  55. #define ATMEL_ID_ADC 44 /* Touch Screen ADC Controller */
  56. #define ATMEL_ID_DBGU 45 /* Debug Unit Interrupt */
  57. #define ATMEL_ID_UHPHS 46 /* USB Host High Speed */
  58. #define ATMEL_ID_UDPHS 47 /* USB Device High Speed */
  59. #define ATMEL_ID_SSC0 48 /* Synchronous Serial Controller 0 */
  60. #define ATMEL_ID_SSC1 49 /* Synchronous Serial Controller 1 */
  61. #define ATMEL_ID_XDMAC1 50 /* DMA Controller 1 */
  62. #define ATMEL_ID_LCDC 51 /* LCD Controller */
  63. #define ATMEL_ID_ISI 52 /* Image Sensor Interface */
  64. #define ATMEL_ID_TRNG 53 /* True Random Number Generator */
  65. #define ATMEL_ID_GMAC0 54 /* Ethernet MAC 0 */
  66. #define ATMEL_ID_GMAC1 55 /* Ethernet MAC 1 */
  67. #define ATMEL_ID_IRQ 56 /* IRQ Interrupt ID */
  68. #define ATMEL_ID_SFC 57 /* Fuse Controller */
  69. #define ATMEL_ID_SECURAM 59 /* Secured RAM */
  70. #define ATMEL_ID_SMD 61 /* SMD Soft Modem */
  71. #define ATMEL_ID_TWI3 62 /* Two-Wire Interface 3 */
  72. #define ATMEL_ID_CATB 63 /* Capacitive Touch Controller */
  73. #define ATMEL_ID_SFR 64 /* Special Funcion Register */
  74. #define ATMEL_ID_AIC 65 /* Advanced Interrupt Controller */
  75. #define ATMEL_ID_SAIC 66 /* Secured Advanced Interrupt Controller */
  76. #define ATMEL_ID_L2CC 67 /* L2 Cache Controller */
  77. /*
  78. * User Peripherals physical base addresses.
  79. */
  80. #define ATMEL_BASE_LCDC 0xf0000000
  81. #define ATMEL_BASE_DMAC1 0xf0004000
  82. #define ATMEL_BASE_ISI 0xf0008000
  83. #define ATMEL_BASE_PKCC 0xf000C000
  84. #define ATMEL_BASE_MPDDRC 0xf0010000
  85. #define ATMEL_BASE_DMAC0 0xf0014000
  86. #define ATMEL_BASE_PMC 0xf0018000
  87. #define ATMEL_BASE_MATRIX0 0xf001c000
  88. #define ATMEL_BASE_AESB 0xf0020000
  89. /* Reserved: 0xf0024000 - 0xf8000000 */
  90. #define ATMEL_BASE_MCI0 0xf8000000
  91. #define ATMEL_BASE_UART0 0xf8004000
  92. #define ATMEL_BASE_SSC0 0xf8008000
  93. #define ATMEL_BASE_PWMC 0xf800c000
  94. #define ATMEL_BASE_SPI0 0xf8010000
  95. #define ATMEL_BASE_TWI0 0xf8014000
  96. #define ATMEL_BASE_TWI1 0xf8018000
  97. #define ATMEL_BASE_TC0 0xf801c000
  98. #define ATMEL_BASE_GMAC0 0xf8020000
  99. #define ATMEL_BASE_TWI2 0xf8024000
  100. #define ATMEL_BASE_SFR 0xf8028000
  101. #define ATMEL_BASE_USART0 0xf802c000
  102. #define ATMEL_BASE_USART1 0xf8030000
  103. /* Reserved: 0xf8034000 - 0xfc000000 */
  104. #define ATMEL_BASE_MCI1 0xfc000000
  105. #define ATMEL_BASE_UART1 0xfc004000
  106. #define ATMEL_BASE_USART2 0xfc008000
  107. #define ATMEL_BASE_USART3 0xfc00c000
  108. #define ATMEL_BASE_USART4 0xfc010000
  109. #define ATMEL_BASE_SSC1 0xfc014000
  110. #define ATMEL_BASE_SPI1 0xfc018000
  111. #define ATMEL_BASE_SPI2 0xfc01c000
  112. #define ATMEL_BASE_TC1 0xfc020000
  113. #define ATMEL_BASE_TC2 0xfc024000
  114. #define ATMEL_BASE_GMAC1 0xfc028000
  115. #define ATMEL_BASE_UDPHS 0xfc02c000
  116. #define ATMEL_BASE_TRNG 0xfc030000
  117. #define ATMEL_BASE_ADC 0xfc034000
  118. #define ATMEL_BASE_TWI3 0xfc038000
  119. #define ATMEL_BASE_MATRIX1 0xfc054000
  120. #define ATMEL_BASE_SMC 0xfc05c000
  121. #define ATMEL_BASE_PMECC (ATMEL_BASE_SMC + 0x070)
  122. #define ATMEL_BASE_PMERRLOC (ATMEL_BASE_SMC + 0x500)
  123. #define ATMEL_BASE_PIOD 0xfc068000
  124. #define ATMEL_BASE_RSTC 0xfc068600
  125. #define ATMEL_BASE_PIT 0xfc068630
  126. #define ATMEL_BASE_WDT 0xfc068640
  127. #define ATMEL_BASE_DBGU 0xfc069000
  128. #define ATMEL_BASE_PIOA 0xfc06a000
  129. #define ATMEL_BASE_PIOB 0xfc06b000
  130. #define ATMEL_BASE_PIOC 0xfc06c000
  131. #define ATMEL_BASE_PIOE 0xfc06d000
  132. #define ATMEL_BASE_AIC 0xfc06e000
  133. #define ATMEL_CHIPID_CIDR 0xfc069040
  134. #define ATMEL_CHIPID_EXID 0xfc069044
  135. /*
  136. * Internal Memory.
  137. */
  138. #define ATMEL_BASE_ROM 0x00000000 /* Internal ROM base address */
  139. #define ATMEL_BASE_NFC 0x00100000 /* NFC SRAM */
  140. #define ATMEL_BASE_SRAM 0x00200000 /* Internal ROM base address */
  141. #define ATMEL_BASE_VDEC 0x00300000 /* Video Decoder Controller */
  142. #define ATMEL_BASE_UDPHS_FIFO 0x00400000 /* USB Device HS controller */
  143. #define ATMEL_BASE_OHCI 0x00500000 /* USB Host controller (OHCI) */
  144. #define ATMEL_BASE_EHCI 0x00600000 /* USB Host controller (EHCI) */
  145. #define ATMEL_BASE_AXI 0x00700000
  146. #define ATMEL_BASE_DAP 0x00800000
  147. #define ATMEL_BASE_SMD 0x00900000
  148. /*
  149. * External memory
  150. */
  151. #define ATMEL_BASE_CS0 0x10000000
  152. #define ATMEL_BASE_DDRCS 0x20000000
  153. #define ATMEL_BASE_CS1 0x60000000
  154. #define ATMEL_BASE_CS2 0x70000000
  155. #define ATMEL_BASE_CS3 0x80000000
  156. /*
  157. * Other misc defines
  158. */
  159. #define ATMEL_PIO_PORTS 5
  160. #define CPU_HAS_PCR
  161. #define CPU_HAS_H32MXDIV
  162. /* MATRIX0(H64MX) slave id definitions */
  163. #define H64MX_SLAVE_AXIMX_BRIDGE 0 /* Bridge from H64MX to AXIMX */
  164. #define H64MX_SLAVE_PERIPH_BRIDGE 1 /* H64MX Peripheral Bridge */
  165. #define H64MX_SLAVE_VDEC 2 /* Video Decoder */
  166. #define H64MX_SLAVE_DDRC_PORT0 3 /* DDR2 Port0-AESOTF */
  167. #define H64MX_SLAVE_DDRC_PORT1 4 /* DDR2 Port1 */
  168. #define H64MX_SLAVE_DDRC_PORT2 5 /* DDR2 Port2 */
  169. #define H64MX_SLAVE_DDRC_PORT3 6 /* DDR2 Port3 */
  170. #define H64MX_SLAVE_DDRC_PORT4 7 /* DDR2 Port4 */
  171. #define H64MX_SLAVE_DDRC_PORT5 8 /* DDR2 Port5 */
  172. #define H64MX_SLAVE_DDRC_PORT6 9 /* DDR2 Port6 */
  173. #define H64MX_SLAVE_DDRC_PORT7 10 /* DDR2 Port7 */
  174. #define H64MX_SLAVE_SRAM 11 /* Internal SRAM 128K */
  175. #define H64MX_SLAVE_H32MX_BRIDGE 12 /* Bridge from H64MX to H32MX */
  176. /* MATRIX1(H32MX) slave id definitions */
  177. #define H32MX_SLAVE_H64MX_BRIDGE 0 /* Bridge from H32MX to H64MX */
  178. #define H32MX_SLAVE_PERIPH_BRIDGE0 1 /* H32MX Peripheral Bridge 0 */
  179. #define H32MX_SLAVE_PERIPH_BRIDGE1 2 /* H32MX Peripheral Bridge 1 */
  180. #define H32MX_SLAVE_EBI 3 /* External Bus Interface */
  181. #define H32MX_SLAVE_NFC_CMD 3 /* NFC command Register */
  182. #define H32MX_SLAVE_NFC_SRAM 4 /* NFC SRAM */
  183. #define H32MX_SLAVE_USB 5 /* USB Device & Host */
  184. #define H32MX_SLAVE_SMD 6 /* Soft Modem (SMD) */
  185. /* AICREDIR Unlock Key */
  186. #define ATMEL_SFR_AICREDIR_KEY 0x5F67B102
  187. /* sama5d4 series chip id definitions */
  188. #define ARCH_ID_SAMA5D4 0x8a5c07c0
  189. #define ARCH_EXID_SAMA5D41 0x00000001
  190. #define ARCH_EXID_SAMA5D42 0x00000002
  191. #define ARCH_EXID_SAMA5D43 0x00000003
  192. #define ARCH_EXID_SAMA5D44 0x00000004
  193. #define cpu_is_sama5d4() (get_chip_id() == ARCH_ID_SAMA5D4)
  194. #define cpu_is_sama5d41() (cpu_is_sama5d4() && \
  195. (get_extension_chip_id() == ARCH_EXID_SAMA5D41))
  196. #define cpu_is_sama5d42() (cpu_is_sama5d4() && \
  197. (get_extension_chip_id() == ARCH_EXID_SAMA5D42))
  198. #define cpu_is_sama5d43() (cpu_is_sama5d4() && \
  199. (get_extension_chip_id() == ARCH_EXID_SAMA5D43))
  200. #define cpu_is_sama5d44() (cpu_is_sama5d4() && \
  201. (get_extension_chip_id() == ARCH_EXID_SAMA5D44))
  202. /* Timer */
  203. #define CONFIG_SYS_TIMER_COUNTER 0xfc06863c
  204. /*
  205. * No PMECC Galois table in ROM
  206. */
  207. #define NO_GALOIS_TABLE_IN_ROM
  208. #ifndef __ASSEMBLY__
  209. unsigned int get_chip_id(void);
  210. unsigned int get_extension_chip_id(void);
  211. unsigned int has_lcdc(void);
  212. char *get_cpu_name(void);
  213. #endif
  214. #endif