cns3xxx.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. /*
  2. * Copyright 2008 Cavium Networks
  3. *
  4. * This file is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License, Version 2, as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef __MACH_BOARD_CNS3XXXH
  9. #define __MACH_BOARD_CNS3XXXH
  10. /*
  11. * Memory map
  12. */
  13. #define CNS3XXX_FLASH_BASE 0x10000000 /* Flash/SRAM Memory Bank 0 */
  14. #define CNS3XXX_FLASH_SIZE SZ_256M
  15. #define CNS3XXX_DDR2SDRAM_BASE 0x20000000 /* DDR2 SDRAM Memory */
  16. #define CNS3XXX_SPI_FLASH_BASE 0x60000000 /* SPI Serial Flash Memory */
  17. #define CNS3XXX_SWITCH_BASE 0x70000000 /* Switch and HNAT Control */
  18. #define CNS3XXX_PPE_BASE 0x70001000 /* HANT */
  19. #define CNS3XXX_EMBEDDED_SRAM_BASE 0x70002000 /* HANT Embedded SRAM */
  20. #define CNS3XXX_SSP_BASE 0x71000000 /* Synchronous Serial Port - SPI/PCM/I2C */
  21. #define CNS3XXX_DMC_BASE 0x72000000 /* DMC Control (DDR2 SDRAM) */
  22. #define CNS3XXX_SMC_BASE 0x73000000 /* SMC Control */
  23. #define SMC_MEMC_STATUS_OFFSET 0x000
  24. #define SMC_MEMIF_CFG_OFFSET 0x004
  25. #define SMC_MEMC_CFG_SET_OFFSET 0x008
  26. #define SMC_MEMC_CFG_CLR_OFFSET 0x00C
  27. #define SMC_DIRECT_CMD_OFFSET 0x010
  28. #define SMC_SET_CYCLES_OFFSET 0x014
  29. #define SMC_SET_OPMODE_OFFSET 0x018
  30. #define SMC_REFRESH_PERIOD_0_OFFSET 0x020
  31. #define SMC_REFRESH_PERIOD_1_OFFSET 0x024
  32. #define SMC_SRAM_CYCLES0_0_OFFSET 0x100
  33. #define SMC_NAND_CYCLES0_0_OFFSET 0x100
  34. #define SMC_OPMODE0_0_OFFSET 0x104
  35. #define SMC_SRAM_CYCLES0_1_OFFSET 0x120
  36. #define SMC_NAND_CYCLES0_1_OFFSET 0x120
  37. #define SMC_OPMODE0_1_OFFSET 0x124
  38. #define SMC_USER_STATUS_OFFSET 0x200
  39. #define SMC_USER_CONFIG_OFFSET 0x204
  40. #define SMC_ECC_STATUS_OFFSET 0x300
  41. #define SMC_ECC_MEMCFG_OFFSET 0x304
  42. #define SMC_ECC_MEMCOMMAND1_OFFSET 0x308
  43. #define SMC_ECC_MEMCOMMAND2_OFFSET 0x30C
  44. #define SMC_ECC_ADDR0_OFFSET 0x310
  45. #define SMC_ECC_ADDR1_OFFSET 0x314
  46. #define SMC_ECC_VALUE0_OFFSET 0x318
  47. #define SMC_ECC_VALUE1_OFFSET 0x31C
  48. #define SMC_ECC_VALUE2_OFFSET 0x320
  49. #define SMC_ECC_VALUE3_OFFSET 0x324
  50. #define SMC_PERIPH_ID_0_OFFSET 0xFE0
  51. #define SMC_PERIPH_ID_1_OFFSET 0xFE4
  52. #define SMC_PERIPH_ID_2_OFFSET 0xFE8
  53. #define SMC_PERIPH_ID_3_OFFSET 0xFEC
  54. #define SMC_PCELL_ID_0_OFFSET 0xFF0
  55. #define SMC_PCELL_ID_1_OFFSET 0xFF4
  56. #define SMC_PCELL_ID_2_OFFSET 0xFF8
  57. #define SMC_PCELL_ID_3_OFFSET 0xFFC
  58. #define CNS3XXX_GPIOA_BASE 0x74000000 /* GPIO port A */
  59. #define CNS3XXX_GPIOB_BASE 0x74800000 /* GPIO port B */
  60. #define CNS3XXX_RTC_BASE 0x75000000 /* Real Time Clock */
  61. #define RTC_SEC_OFFSET 0x00
  62. #define RTC_MIN_OFFSET 0x04
  63. #define RTC_HOUR_OFFSET 0x08
  64. #define RTC_DAY_OFFSET 0x0C
  65. #define RTC_SEC_ALM_OFFSET 0x10
  66. #define RTC_MIN_ALM_OFFSET 0x14
  67. #define RTC_HOUR_ALM_OFFSET 0x18
  68. #define RTC_REC_OFFSET 0x1C
  69. #define RTC_CTRL_OFFSET 0x20
  70. #define RTC_INTR_STS_OFFSET 0x34
  71. #define CNS3XXX_MISC_BASE 0x76000000 /* Misc Control */
  72. #define CNS3XXX_MISC_BASE_VIRT 0xFB000000 /* Misc Control */
  73. #define CNS3XXX_PM_BASE 0x77000000 /* Power Management Control */
  74. #define CNS3XXX_PM_BASE_VIRT 0xFB001000
  75. #define PM_CLK_GATE_OFFSET 0x00
  76. #define PM_SOFT_RST_OFFSET 0x04
  77. #define PM_HS_CFG_OFFSET 0x08
  78. #define PM_CACTIVE_STA_OFFSET 0x0C
  79. #define PM_PWR_STA_OFFSET 0x10
  80. #define PM_SYS_CLK_CTRL_OFFSET 0x14
  81. #define PM_PLL_LCD_I2S_CTRL_OFFSET 0x18
  82. #define PM_PLL_HM_PD_OFFSET 0x1C
  83. #define CNS3XXX_UART0_BASE 0x78000000 /* UART 0 */
  84. #define CNS3XXX_UART0_BASE_VIRT 0xFB002000
  85. #define CNS3XXX_UART1_BASE 0x78400000 /* UART 1 */
  86. #define CNS3XXX_UART2_BASE 0x78800000 /* UART 2 */
  87. #define CNS3XXX_DMAC_BASE 0x79000000 /* Generic DMA Control */
  88. #define CNS3XXX_CORESIGHT_BASE 0x7A000000 /* CoreSight */
  89. #define CNS3XXX_CRYPTO_BASE 0x7B000000 /* Crypto */
  90. #define CNS3XXX_I2S_BASE 0x7C000000 /* I2S */
  91. #define CNS3XXX_TIMER1_2_3_BASE 0x7C800000 /* Timer */
  92. #define CNS3XXX_TIMER1_2_3_BASE_VIRT 0xFB003000
  93. #define TIMER1_COUNTER_OFFSET 0x00
  94. #define TIMER1_AUTO_RELOAD_OFFSET 0x04
  95. #define TIMER1_MATCH_V1_OFFSET 0x08
  96. #define TIMER1_MATCH_V2_OFFSET 0x0C
  97. #define TIMER2_COUNTER_OFFSET 0x10
  98. #define TIMER2_AUTO_RELOAD_OFFSET 0x14
  99. #define TIMER2_MATCH_V1_OFFSET 0x18
  100. #define TIMER2_MATCH_V2_OFFSET 0x1C
  101. #define TIMER1_2_CONTROL_OFFSET 0x30
  102. #define TIMER1_2_INTERRUPT_STATUS_OFFSET 0x34
  103. #define TIMER1_2_INTERRUPT_MASK_OFFSET 0x38
  104. #define TIMER_FREERUN_OFFSET 0x40
  105. #define TIMER_FREERUN_CONTROL_OFFSET 0x44
  106. #define CNS3XXX_HCIE_BASE 0x7D000000 /* HCIE Control */
  107. #define CNS3XXX_RAID_BASE 0x7E000000 /* RAID Control */
  108. #define CNS3XXX_AXI_IXC_BASE 0x7F000000 /* AXI IXC */
  109. #define CNS3XXX_CLCD_BASE 0x80000000 /* LCD Control */
  110. #define CNS3XXX_USBOTG_BASE 0x81000000 /* USB OTG Control */
  111. #define CNS3XXX_USB_BASE 0x82000000 /* USB Host Control */
  112. #define CNS3XXX_SATA2_BASE 0x83000000 /* SATA */
  113. #define CNS3XXX_SATA2_SIZE SZ_16M
  114. #define CNS3XXX_CAMERA_BASE 0x84000000 /* Camera Interface */
  115. #define CNS3XXX_SDIO_BASE 0x85000000 /* SDIO */
  116. #define CNS3XXX_I2S_TDM_BASE 0x86000000 /* I2S TDM */
  117. #define CNS3XXX_2DG_BASE 0x87000000 /* 2D Graphic Control */
  118. #define CNS3XXX_USB_OHCI_BASE 0x88000000 /* USB OHCI */
  119. #define CNS3XXX_L2C_BASE 0x92000000 /* L2 Cache Control */
  120. #define CNS3XXX_PCIE0_MEM_BASE 0xA0000000 /* PCIe Port 0 IO/Memory Space */
  121. #define CNS3XXX_PCIE0_HOST_BASE 0xAB000000 /* PCIe Port 0 RC Base */
  122. #define CNS3XXX_PCIE0_HOST_BASE_VIRT 0xE1000000
  123. #define CNS3XXX_PCIE0_IO_BASE 0xAC000000 /* PCIe Port 0 */
  124. #define CNS3XXX_PCIE0_CFG0_BASE 0xAD000000 /* PCIe Port 0 CFG Type 0 */
  125. #define CNS3XXX_PCIE0_CFG0_BASE_VIRT 0xE3000000
  126. #define CNS3XXX_PCIE0_CFG1_BASE 0xAE000000 /* PCIe Port 0 CFG Type 1 */
  127. #define CNS3XXX_PCIE0_CFG1_BASE_VIRT 0xE4000000
  128. #define CNS3XXX_PCIE0_MSG_BASE 0xAF000000 /* PCIe Port 0 Message Space */
  129. #define CNS3XXX_PCIE1_MEM_BASE 0xB0000000 /* PCIe Port 1 IO/Memory Space */
  130. #define CNS3XXX_PCIE1_HOST_BASE 0xBB000000 /* PCIe Port 1 RC Base */
  131. #define CNS3XXX_PCIE1_HOST_BASE_VIRT 0xE9000000
  132. #define CNS3XXX_PCIE1_IO_BASE 0xBC000000 /* PCIe Port 1 */
  133. #define CNS3XXX_PCIE1_CFG0_BASE 0xBD000000 /* PCIe Port 1 CFG Type 0 */
  134. #define CNS3XXX_PCIE1_CFG0_BASE_VIRT 0xEB000000
  135. #define CNS3XXX_PCIE1_CFG1_BASE 0xBE000000 /* PCIe Port 1 CFG Type 1 */
  136. #define CNS3XXX_PCIE1_CFG1_BASE_VIRT 0xEC000000
  137. #define CNS3XXX_PCIE1_MSG_BASE 0xBF000000 /* PCIe Port 1 Message Space */
  138. /*
  139. * Testchip peripheral and fpga gic regions
  140. */
  141. #define CNS3XXX_TC11MP_SCU_BASE 0x90000000 /* IRQ, Test chip */
  142. #define CNS3XXX_TC11MP_SCU_BASE_VIRT 0xFB004000
  143. #define CNS3XXX_TC11MP_GIC_CPU_BASE 0x90000100 /* Test chip interrupt controller CPU interface */
  144. #define CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT (CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x100)
  145. #define CNS3XXX_TC11MP_TWD_BASE 0x90000600
  146. #define CNS3XXX_TC11MP_TWD_BASE_VIRT (CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x600)
  147. #define CNS3XXX_TC11MP_GIC_DIST_BASE 0x90001000 /* Test chip interrupt controller distributor */
  148. #define CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT (CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x1000)
  149. #define CNS3XXX_TC11MP_L220_BASE 0x92002000 /* L220 registers */
  150. /*
  151. * Misc block
  152. */
  153. #define MISC_MEM_MAP(offs) (void __iomem *)(CNS3XXX_MISC_BASE_VIRT + (offs))
  154. #define MISC_MEMORY_REMAP_REG MISC_MEM_MAP(0x00)
  155. #define MISC_CHIP_CONFIG_REG MISC_MEM_MAP(0x04)
  156. #define MISC_DEBUG_PROBE_DATA_REG MISC_MEM_MAP(0x08)
  157. #define MISC_DEBUG_PROBE_SELECTION_REG MISC_MEM_MAP(0x0C)
  158. #define MISC_IO_PIN_FUNC_SELECTION_REG MISC_MEM_MAP(0x10)
  159. #define MISC_GPIOA_PIN_ENABLE_REG MISC_MEM_MAP(0x14)
  160. #define MISC_GPIOB_PIN_ENABLE_REG MISC_MEM_MAP(0x18)
  161. #define MISC_IO_PAD_DRIVE_STRENGTH_CTRL_A MISC_MEM_MAP(0x1C)
  162. #define MISC_IO_PAD_DRIVE_STRENGTH_CTRL_B MISC_MEM_MAP(0x20)
  163. #define MISC_GPIOA_15_0_PULL_CTRL_REG MISC_MEM_MAP(0x24)
  164. #define MISC_GPIOA_16_31_PULL_CTRL_REG MISC_MEM_MAP(0x28)
  165. #define MISC_GPIOB_15_0_PULL_CTRL_REG MISC_MEM_MAP(0x2C)
  166. #define MISC_GPIOB_16_31_PULL_CTRL_REG MISC_MEM_MAP(0x30)
  167. #define MISC_IO_PULL_CTRL_REG MISC_MEM_MAP(0x34)
  168. #define MISC_E_FUSE_31_0_REG MISC_MEM_MAP(0x40)
  169. #define MISC_E_FUSE_63_32_REG MISC_MEM_MAP(0x44)
  170. #define MISC_E_FUSE_95_64_REG MISC_MEM_MAP(0x48)
  171. #define MISC_E_FUSE_127_96_REG MISC_MEM_MAP(0x4C)
  172. #define MISC_SOFTWARE_TEST_1_REG MISC_MEM_MAP(0x50)
  173. #define MISC_SOFTWARE_TEST_2_REG MISC_MEM_MAP(0x54)
  174. #define MISC_SATA_POWER_MODE MISC_MEM_MAP(0x310)
  175. #define MISC_USB_CFG_REG MISC_MEM_MAP(0x800)
  176. #define MISC_USB_STS_REG MISC_MEM_MAP(0x804)
  177. #define MISC_USBPHY00_CFG_REG MISC_MEM_MAP(0x808)
  178. #define MISC_USBPHY01_CFG_REG MISC_MEM_MAP(0x80c)
  179. #define MISC_USBPHY10_CFG_REG MISC_MEM_MAP(0x810)
  180. #define MISC_USBPHY11_CFG_REG MISC_MEM_MAP(0x814)
  181. #define MISC_PCIEPHY_CMCTL(x) MISC_MEM_MAP(0x900 + (x) * 0x004)
  182. #define MISC_PCIEPHY_CTL(x) MISC_MEM_MAP(0x940 + (x) * 0x100)
  183. #define MISC_PCIE_AXIS_AWMISC(x) MISC_MEM_MAP(0x944 + (x) * 0x100)
  184. #define MISC_PCIE_AXIS_ARMISC(x) MISC_MEM_MAP(0x948 + (x) * 0x100)
  185. #define MISC_PCIE_AXIS_RMISC(x) MISC_MEM_MAP(0x94C + (x) * 0x100)
  186. #define MISC_PCIE_AXIS_BMISC(x) MISC_MEM_MAP(0x950 + (x) * 0x100)
  187. #define MISC_PCIE_AXIM_RMISC(x) MISC_MEM_MAP(0x954 + (x) * 0x100)
  188. #define MISC_PCIE_AXIM_BMISC(x) MISC_MEM_MAP(0x958 + (x) * 0x100)
  189. #define MISC_PCIE_CTRL(x) MISC_MEM_MAP(0x95C + (x) * 0x100)
  190. #define MISC_PCIE_PM_DEBUG(x) MISC_MEM_MAP(0x960 + (x) * 0x100)
  191. #define MISC_PCIE_RFC_DEBUG(x) MISC_MEM_MAP(0x964 + (x) * 0x100)
  192. #define MISC_PCIE_CXPL_DEBUGL(x) MISC_MEM_MAP(0x968 + (x) * 0x100)
  193. #define MISC_PCIE_CXPL_DEBUGH(x) MISC_MEM_MAP(0x96C + (x) * 0x100)
  194. #define MISC_PCIE_DIAG_DEBUGH(x) MISC_MEM_MAP(0x970 + (x) * 0x100)
  195. #define MISC_PCIE_W1CLR(x) MISC_MEM_MAP(0x974 + (x) * 0x100)
  196. #define MISC_PCIE_INT_MASK(x) MISC_MEM_MAP(0x978 + (x) * 0x100)
  197. #define MISC_PCIE_INT_STATUS(x) MISC_MEM_MAP(0x97C + (x) * 0x100)
  198. /*
  199. * Power management and clock control
  200. */
  201. #define PMU_MEM_MAP(offs) (void __iomem *)(CNS3XXX_PM_BASE_VIRT + (offs))
  202. #define PM_CLK_GATE_REG PMU_MEM_MAP(0x000)
  203. #define PM_SOFT_RST_REG PMU_MEM_MAP(0x004)
  204. #define PM_HS_CFG_REG PMU_MEM_MAP(0x008)
  205. #define PM_CACTIVE_STA_REG PMU_MEM_MAP(0x00C)
  206. #define PM_PWR_STA_REG PMU_MEM_MAP(0x010)
  207. #define PM_CLK_CTRL_REG PMU_MEM_MAP(0x014)
  208. #define PM_PLL_LCD_I2S_CTRL_REG PMU_MEM_MAP(0x018)
  209. #define PM_PLL_HM_PD_CTRL_REG PMU_MEM_MAP(0x01C)
  210. #define PM_REGULAT_CTRL_REG PMU_MEM_MAP(0x020)
  211. #define PM_WDT_CTRL_REG PMU_MEM_MAP(0x024)
  212. #define PM_WU_CTRL0_REG PMU_MEM_MAP(0x028)
  213. #define PM_WU_CTRL1_REG PMU_MEM_MAP(0x02C)
  214. #define PM_CSR_REG PMU_MEM_MAP(0x030)
  215. /* PM_CLK_GATE_REG */
  216. #define PM_CLK_GATE_REG_OFFSET_SDIO (25)
  217. #define PM_CLK_GATE_REG_OFFSET_GPU (24)
  218. #define PM_CLK_GATE_REG_OFFSET_CIM (23)
  219. #define PM_CLK_GATE_REG_OFFSET_LCDC (22)
  220. #define PM_CLK_GATE_REG_OFFSET_I2S (21)
  221. #define PM_CLK_GATE_REG_OFFSET_RAID (20)
  222. #define PM_CLK_GATE_REG_OFFSET_SATA (19)
  223. #define PM_CLK_GATE_REG_OFFSET_PCIE(x) (17 + (x))
  224. #define PM_CLK_GATE_REG_OFFSET_USB_HOST (16)
  225. #define PM_CLK_GATE_REG_OFFSET_USB_OTG (15)
  226. #define PM_CLK_GATE_REG_OFFSET_TIMER (14)
  227. #define PM_CLK_GATE_REG_OFFSET_CRYPTO (13)
  228. #define PM_CLK_GATE_REG_OFFSET_HCIE (12)
  229. #define PM_CLK_GATE_REG_OFFSET_SWITCH (11)
  230. #define PM_CLK_GATE_REG_OFFSET_GPIO (10)
  231. #define PM_CLK_GATE_REG_OFFSET_UART3 (9)
  232. #define PM_CLK_GATE_REG_OFFSET_UART2 (8)
  233. #define PM_CLK_GATE_REG_OFFSET_UART1 (7)
  234. #define PM_CLK_GATE_REG_OFFSET_RTC (5)
  235. #define PM_CLK_GATE_REG_OFFSET_GDMA (4)
  236. #define PM_CLK_GATE_REG_OFFSET_SPI_PCM_I2C (3)
  237. #define PM_CLK_GATE_REG_OFFSET_SMC_NFI (1)
  238. #define PM_CLK_GATE_REG_MASK (0x03FFFFBA)
  239. /* PM_SOFT_RST_REG */
  240. #define PM_SOFT_RST_REG_OFFST_WARM_RST_FLAG (31)
  241. #define PM_SOFT_RST_REG_OFFST_CPU1 (29)
  242. #define PM_SOFT_RST_REG_OFFST_CPU0 (28)
  243. #define PM_SOFT_RST_REG_OFFST_SDIO (25)
  244. #define PM_SOFT_RST_REG_OFFST_GPU (24)
  245. #define PM_SOFT_RST_REG_OFFST_CIM (23)
  246. #define PM_SOFT_RST_REG_OFFST_LCDC (22)
  247. #define PM_SOFT_RST_REG_OFFST_I2S (21)
  248. #define PM_SOFT_RST_REG_OFFST_RAID (20)
  249. #define PM_SOFT_RST_REG_OFFST_SATA (19)
  250. #define PM_SOFT_RST_REG_OFFST_PCIE(x) (17 + (x))
  251. #define PM_SOFT_RST_REG_OFFST_USB_HOST (16)
  252. #define PM_SOFT_RST_REG_OFFST_USB_OTG (15)
  253. #define PM_SOFT_RST_REG_OFFST_TIMER (14)
  254. #define PM_SOFT_RST_REG_OFFST_CRYPTO (13)
  255. #define PM_SOFT_RST_REG_OFFST_HCIE (12)
  256. #define PM_SOFT_RST_REG_OFFST_SWITCH (11)
  257. #define PM_SOFT_RST_REG_OFFST_GPIO (10)
  258. #define PM_SOFT_RST_REG_OFFST_UART3 (9)
  259. #define PM_SOFT_RST_REG_OFFST_UART2 (8)
  260. #define PM_SOFT_RST_REG_OFFST_UART1 (7)
  261. #define PM_SOFT_RST_REG_OFFST_RTC (5)
  262. #define PM_SOFT_RST_REG_OFFST_GDMA (4)
  263. #define PM_SOFT_RST_REG_OFFST_SPI_PCM_I2C (3)
  264. #define PM_SOFT_RST_REG_OFFST_DMC (2)
  265. #define PM_SOFT_RST_REG_OFFST_SMC_NFI (1)
  266. #define PM_SOFT_RST_REG_OFFST_GLOBAL (0)
  267. #define PM_SOFT_RST_REG_MASK (0xF3FFFFBF)
  268. /* PMHS_CFG_REG */
  269. #define PM_HS_CFG_REG_OFFSET_SDIO (25)
  270. #define PM_HS_CFG_REG_OFFSET_GPU (24)
  271. #define PM_HS_CFG_REG_OFFSET_CIM (23)
  272. #define PM_HS_CFG_REG_OFFSET_LCDC (22)
  273. #define PM_HS_CFG_REG_OFFSET_I2S (21)
  274. #define PM_HS_CFG_REG_OFFSET_RAID (20)
  275. #define PM_HS_CFG_REG_OFFSET_SATA (19)
  276. #define PM_HS_CFG_REG_OFFSET_PCIE1 (18)
  277. #define PM_HS_CFG_REG_OFFSET_PCIE0 (17)
  278. #define PM_HS_CFG_REG_OFFSET_USB_HOST (16)
  279. #define PM_HS_CFG_REG_OFFSET_USB_OTG (15)
  280. #define PM_HS_CFG_REG_OFFSET_TIMER (14)
  281. #define PM_HS_CFG_REG_OFFSET_CRYPTO (13)
  282. #define PM_HS_CFG_REG_OFFSET_HCIE (12)
  283. #define PM_HS_CFG_REG_OFFSET_SWITCH (11)
  284. #define PM_HS_CFG_REG_OFFSET_GPIO (10)
  285. #define PM_HS_CFG_REG_OFFSET_UART3 (9)
  286. #define PM_HS_CFG_REG_OFFSET_UART2 (8)
  287. #define PM_HS_CFG_REG_OFFSET_UART1 (7)
  288. #define PM_HS_CFG_REG_OFFSET_RTC (5)
  289. #define PM_HS_CFG_REG_OFFSET_GDMA (4)
  290. #define PM_HS_CFG_REG_OFFSET_SPI_PCM_I2S (3)
  291. #define PM_HS_CFG_REG_OFFSET_DMC (2)
  292. #define PM_HS_CFG_REG_OFFSET_SMC_NFI (1)
  293. #define PM_HS_CFG_REG_MASK (0x03FFFFBE)
  294. #define PM_HS_CFG_REG_MASK_SUPPORT (0x01100806)
  295. /* PM_CACTIVE_STA_REG */
  296. #define PM_CACTIVE_STA_REG_OFFSET_SDIO (25)
  297. #define PM_CACTIVE_STA_REG_OFFSET_GPU (24)
  298. #define PM_CACTIVE_STA_REG_OFFSET_CIM (23)
  299. #define PM_CACTIVE_STA_REG_OFFSET_LCDC (22)
  300. #define PM_CACTIVE_STA_REG_OFFSET_I2S (21)
  301. #define PM_CACTIVE_STA_REG_OFFSET_RAID (20)
  302. #define PM_CACTIVE_STA_REG_OFFSET_SATA (19)
  303. #define PM_CACTIVE_STA_REG_OFFSET_PCIE1 (18)
  304. #define PM_CACTIVE_STA_REG_OFFSET_PCIE0 (17)
  305. #define PM_CACTIVE_STA_REG_OFFSET_USB_HOST (16)
  306. #define PM_CACTIVE_STA_REG_OFFSET_USB_OTG (15)
  307. #define PM_CACTIVE_STA_REG_OFFSET_TIMER (14)
  308. #define PM_CACTIVE_STA_REG_OFFSET_CRYPTO (13)
  309. #define PM_CACTIVE_STA_REG_OFFSET_HCIE (12)
  310. #define PM_CACTIVE_STA_REG_OFFSET_SWITCH (11)
  311. #define PM_CACTIVE_STA_REG_OFFSET_GPIO (10)
  312. #define PM_CACTIVE_STA_REG_OFFSET_UART3 (9)
  313. #define PM_CACTIVE_STA_REG_OFFSET_UART2 (8)
  314. #define PM_CACTIVE_STA_REG_OFFSET_UART1 (7)
  315. #define PM_CACTIVE_STA_REG_OFFSET_RTC (5)
  316. #define PM_CACTIVE_STA_REG_OFFSET_GDMA (4)
  317. #define PM_CACTIVE_STA_REG_OFFSET_SPI_PCM_I2S (3)
  318. #define PM_CACTIVE_STA_REG_OFFSET_DMC (2)
  319. #define PM_CACTIVE_STA_REG_OFFSET_SMC_NFI (1)
  320. #define PM_CACTIVE_STA_REG_MASK (0x03FFFFBE)
  321. /* PM_PWR_STA_REG */
  322. #define PM_PWR_STA_REG_REG_OFFSET_SDIO (25)
  323. #define PM_PWR_STA_REG_REG_OFFSET_GPU (24)
  324. #define PM_PWR_STA_REG_REG_OFFSET_CIM (23)
  325. #define PM_PWR_STA_REG_REG_OFFSET_LCDC (22)
  326. #define PM_PWR_STA_REG_REG_OFFSET_I2S (21)
  327. #define PM_PWR_STA_REG_REG_OFFSET_RAID (20)
  328. #define PM_PWR_STA_REG_REG_OFFSET_SATA (19)
  329. #define PM_PWR_STA_REG_REG_OFFSET_PCIE1 (18)
  330. #define PM_PWR_STA_REG_REG_OFFSET_PCIE0 (17)
  331. #define PM_PWR_STA_REG_REG_OFFSET_USB_HOST (16)
  332. #define PM_PWR_STA_REG_REG_OFFSET_USB_OTG (15)
  333. #define PM_PWR_STA_REG_REG_OFFSET_TIMER (14)
  334. #define PM_PWR_STA_REG_REG_OFFSET_CRYPTO (13)
  335. #define PM_PWR_STA_REG_REG_OFFSET_HCIE (12)
  336. #define PM_PWR_STA_REG_REG_OFFSET_SWITCH (11)
  337. #define PM_PWR_STA_REG_REG_OFFSET_GPIO (10)
  338. #define PM_PWR_STA_REG_REG_OFFSET_UART3 (9)
  339. #define PM_PWR_STA_REG_REG_OFFSET_UART2 (8)
  340. #define PM_PWR_STA_REG_REG_OFFSET_UART1 (7)
  341. #define PM_PWR_STA_REG_REG_OFFSET_RTC (5)
  342. #define PM_PWR_STA_REG_REG_OFFSET_GDMA (4)
  343. #define PM_PWR_STA_REG_REG_OFFSET_SPI_PCM_I2S (3)
  344. #define PM_PWR_STA_REG_REG_OFFSET_DMC (2)
  345. #define PM_PWR_STA_REG_REG_OFFSET_SMC_NFI (1)
  346. #define PM_PWR_STA_REG_REG_MASK (0x03FFFFBE)
  347. /* PM_CLK_CTRL_REG */
  348. #define PM_CLK_CTRL_REG_OFFSET_I2S_MCLK (31)
  349. #define PM_CLK_CTRL_REG_OFFSET_DDR2_CHG_EN (30)
  350. #define PM_CLK_CTRL_REG_OFFSET_PCIE_REF1_EN (29)
  351. #define PM_CLK_CTRL_REG_OFFSET_PCIE_REF0_EN (28)
  352. #define PM_CLK_CTRL_REG_OFFSET_TIMER_SIM_MODE (27)
  353. #define PM_CLK_CTRL_REG_OFFSET_I2SCLK_DIV (24)
  354. #define PM_CLK_CTRL_REG_OFFSET_I2SCLK_SEL (22)
  355. #define PM_CLK_CTRL_REG_OFFSET_CLKOUT_DIV (20)
  356. #define PM_CLK_CTRL_REG_OFFSET_CLKOUT_SEL (16)
  357. #define PM_CLK_CTRL_REG_OFFSET_MDC_DIV (14)
  358. #define PM_CLK_CTRL_REG_OFFSET_CRYPTO_CLK_SEL (12)
  359. #define PM_CLK_CTRL_REG_OFFSET_CPU_PWR_MODE (9)
  360. #define PM_CLK_CTRL_REG_OFFSET_PLL_DDR2_SEL (7)
  361. #define PM_CLK_CTRL_REG_OFFSET_DIV_IMMEDIATE (6)
  362. #define PM_CLK_CTRL_REG_OFFSET_CPU_CLK_DIV (4)
  363. #define PM_CLK_CTRL_REG_OFFSET_PLL_CPU_SEL (0)
  364. #define PM_CPU_CLK_DIV(DIV) { \
  365. PM_CLK_CTRL_REG &= ~((0x3) << PM_CLK_CTRL_REG_OFFSET_CPU_CLK_DIV); \
  366. PM_CLK_CTRL_REG |= (((DIV)&0x3) << PM_CLK_CTRL_REG_OFFSET_CPU_CLK_DIV); \
  367. }
  368. #define PM_PLL_CPU_SEL(CPU) { \
  369. PM_CLK_CTRL_REG &= ~((0xF) << PM_CLK_CTRL_REG_OFFSET_PLL_CPU_SEL); \
  370. PM_CLK_CTRL_REG |= (((CPU)&0xF) << PM_CLK_CTRL_REG_OFFSET_PLL_CPU_SEL); \
  371. }
  372. /* PM_PLL_LCD_I2S_CTRL_REG */
  373. #define PM_PLL_LCD_I2S_CTRL_REG_OFFSET_MCLK_SMC_DIV (22)
  374. #define PM_PLL_LCD_I2S_CTRL_REG_OFFSET_R_SEL (17)
  375. #define PM_PLL_LCD_I2S_CTRL_REG_OFFSET_PLL_LCD_P (11)
  376. #define PM_PLL_LCD_I2S_CTRL_REG_OFFSET_PLL_LCD_M (3)
  377. #define PM_PLL_LCD_I2S_CTRL_REG_OFFSET_PLL_LCD_S (0)
  378. /* PM_PLL_HM_PD_CTRL_REG */
  379. #define PM_PLL_HM_PD_CTRL_REG_OFFSET_SATA_PHY1 (11)
  380. #define PM_PLL_HM_PD_CTRL_REG_OFFSET_SATA_PHY0 (10)
  381. #define PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_I2SCD (6)
  382. #define PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_I2S (5)
  383. #define PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_LCD (4)
  384. #define PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_USB (3)
  385. #define PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_RGMII (2)
  386. #define PM_PLL_HM_PD_CTRL_REG_MASK (0x00000C7C)
  387. /* PM_WDT_CTRL_REG */
  388. #define PM_WDT_CTRL_REG_OFFSET_RESET_CPU_ONLY (0)
  389. /* PM_CSR_REG - Clock Scaling Register*/
  390. #define PM_CSR_REG_OFFSET_CSR_EN (30)
  391. #define PM_CSR_REG_OFFSET_CSR_NUM (0)
  392. #define CNS3XXX_PWR_CLK_EN(BLOCK) (0x1<<PM_CLK_GATE_REG_OFFSET_##BLOCK)
  393. /* Software reset*/
  394. #define CNS3XXX_PWR_SOFTWARE_RST(BLOCK) (0x1<<PM_SOFT_RST_REG_OFFST_##BLOCK)
  395. /*
  396. * CNS3XXX support several power saving mode as following,
  397. * DFS, IDLE, HALT, DOZE, SLEEP, Hibernate
  398. */
  399. #define CNS3XXX_PWR_CPU_MODE_DFS (0)
  400. #define CNS3XXX_PWR_CPU_MODE_IDLE (1)
  401. #define CNS3XXX_PWR_CPU_MODE_HALT (2)
  402. #define CNS3XXX_PWR_CPU_MODE_DOZE (3)
  403. #define CNS3XXX_PWR_CPU_MODE_SLEEP (4)
  404. #define CNS3XXX_PWR_CPU_MODE_HIBERNATE (5)
  405. #define CNS3XXX_PWR_PLL(BLOCK) (0x1<<PM_PLL_HM_PD_CTRL_REG_OFFSET_##BLOCK)
  406. #define CNS3XXX_PWR_PLL_ALL PM_PLL_HM_PD_CTRL_REG_MASK
  407. /* Change CPU frequency and divider */
  408. #define CNS3XXX_PWR_PLL_CPU_300MHZ (0)
  409. #define CNS3XXX_PWR_PLL_CPU_333MHZ (1)
  410. #define CNS3XXX_PWR_PLL_CPU_366MHZ (2)
  411. #define CNS3XXX_PWR_PLL_CPU_400MHZ (3)
  412. #define CNS3XXX_PWR_PLL_CPU_433MHZ (4)
  413. #define CNS3XXX_PWR_PLL_CPU_466MHZ (5)
  414. #define CNS3XXX_PWR_PLL_CPU_500MHZ (6)
  415. #define CNS3XXX_PWR_PLL_CPU_533MHZ (7)
  416. #define CNS3XXX_PWR_PLL_CPU_566MHZ (8)
  417. #define CNS3XXX_PWR_PLL_CPU_600MHZ (9)
  418. #define CNS3XXX_PWR_PLL_CPU_633MHZ (10)
  419. #define CNS3XXX_PWR_PLL_CPU_666MHZ (11)
  420. #define CNS3XXX_PWR_PLL_CPU_700MHZ (12)
  421. #define CNS3XXX_PWR_CPU_CLK_DIV_BY1 (0)
  422. #define CNS3XXX_PWR_CPU_CLK_DIV_BY2 (1)
  423. #define CNS3XXX_PWR_CPU_CLK_DIV_BY4 (2)
  424. /* Change DDR2 frequency */
  425. #define CNS3XXX_PWR_PLL_DDR2_200MHZ (0)
  426. #define CNS3XXX_PWR_PLL_DDR2_266MHZ (1)
  427. #define CNS3XXX_PWR_PLL_DDR2_333MHZ (2)
  428. #define CNS3XXX_PWR_PLL_DDR2_400MHZ (3)
  429. void cns3xxx_pwr_soft_rst(unsigned int block);
  430. void cns3xxx_pwr_clk_en(unsigned int block);
  431. int cns3xxx_cpu_clock(void);
  432. /*
  433. * ARM11 MPCore interrupt sources (primary GIC)
  434. */
  435. #define IRQ_TC11MP_GIC_START 32
  436. #define IRQ_CNS3XXX_PMU (IRQ_TC11MP_GIC_START + 0)
  437. #define IRQ_CNS3XXX_SDIO (IRQ_TC11MP_GIC_START + 1)
  438. #define IRQ_CNS3XXX_L2CC (IRQ_TC11MP_GIC_START + 2)
  439. #define IRQ_CNS3XXX_RTC (IRQ_TC11MP_GIC_START + 3)
  440. #define IRQ_CNS3XXX_I2S (IRQ_TC11MP_GIC_START + 4)
  441. #define IRQ_CNS3XXX_PCM (IRQ_TC11MP_GIC_START + 5)
  442. #define IRQ_CNS3XXX_SPI (IRQ_TC11MP_GIC_START + 6)
  443. #define IRQ_CNS3XXX_I2C (IRQ_TC11MP_GIC_START + 7)
  444. #define IRQ_CNS3XXX_CIM (IRQ_TC11MP_GIC_START + 8)
  445. #define IRQ_CNS3XXX_GPU (IRQ_TC11MP_GIC_START + 9)
  446. #define IRQ_CNS3XXX_LCD (IRQ_TC11MP_GIC_START + 10)
  447. #define IRQ_CNS3XXX_GPIOA (IRQ_TC11MP_GIC_START + 11)
  448. #define IRQ_CNS3XXX_GPIOB (IRQ_TC11MP_GIC_START + 12)
  449. #define IRQ_CNS3XXX_UART0 (IRQ_TC11MP_GIC_START + 13)
  450. #define IRQ_CNS3XXX_UART1 (IRQ_TC11MP_GIC_START + 14)
  451. #define IRQ_CNS3XXX_UART2 (IRQ_TC11MP_GIC_START + 15)
  452. #define IRQ_CNS3XXX_ARM11 (IRQ_TC11MP_GIC_START + 16)
  453. #define IRQ_CNS3XXX_SW_STATUS (IRQ_TC11MP_GIC_START + 17)
  454. #define IRQ_CNS3XXX_SW_R0TXC (IRQ_TC11MP_GIC_START + 18)
  455. #define IRQ_CNS3XXX_SW_R0RXC (IRQ_TC11MP_GIC_START + 19)
  456. #define IRQ_CNS3XXX_SW_R0QE (IRQ_TC11MP_GIC_START + 20)
  457. #define IRQ_CNS3XXX_SW_R0QF (IRQ_TC11MP_GIC_START + 21)
  458. #define IRQ_CNS3XXX_SW_R1TXC (IRQ_TC11MP_GIC_START + 22)
  459. #define IRQ_CNS3XXX_SW_R1RXC (IRQ_TC11MP_GIC_START + 23)
  460. #define IRQ_CNS3XXX_SW_R1QE (IRQ_TC11MP_GIC_START + 24)
  461. #define IRQ_CNS3XXX_SW_R1QF (IRQ_TC11MP_GIC_START + 25)
  462. #define IRQ_CNS3XXX_SW_PPE (IRQ_TC11MP_GIC_START + 26)
  463. #define IRQ_CNS3XXX_CRYPTO (IRQ_TC11MP_GIC_START + 27)
  464. #define IRQ_CNS3XXX_HCIE (IRQ_TC11MP_GIC_START + 28)
  465. #define IRQ_CNS3XXX_PCIE0_DEVICE (IRQ_TC11MP_GIC_START + 29)
  466. #define IRQ_CNS3XXX_PCIE1_DEVICE (IRQ_TC11MP_GIC_START + 30)
  467. #define IRQ_CNS3XXX_USB_OTG (IRQ_TC11MP_GIC_START + 31)
  468. #define IRQ_CNS3XXX_USB_EHCI (IRQ_TC11MP_GIC_START + 32)
  469. #define IRQ_CNS3XXX_SATA (IRQ_TC11MP_GIC_START + 33)
  470. #define IRQ_CNS3XXX_RAID (IRQ_TC11MP_GIC_START + 34)
  471. #define IRQ_CNS3XXX_SMC (IRQ_TC11MP_GIC_START + 35)
  472. #define IRQ_CNS3XXX_DMAC_ABORT (IRQ_TC11MP_GIC_START + 36)
  473. #define IRQ_CNS3XXX_DMAC0 (IRQ_TC11MP_GIC_START + 37)
  474. #define IRQ_CNS3XXX_DMAC1 (IRQ_TC11MP_GIC_START + 38)
  475. #define IRQ_CNS3XXX_DMAC2 (IRQ_TC11MP_GIC_START + 39)
  476. #define IRQ_CNS3XXX_DMAC3 (IRQ_TC11MP_GIC_START + 40)
  477. #define IRQ_CNS3XXX_DMAC4 (IRQ_TC11MP_GIC_START + 41)
  478. #define IRQ_CNS3XXX_DMAC5 (IRQ_TC11MP_GIC_START + 42)
  479. #define IRQ_CNS3XXX_DMAC6 (IRQ_TC11MP_GIC_START + 43)
  480. #define IRQ_CNS3XXX_DMAC7 (IRQ_TC11MP_GIC_START + 44)
  481. #define IRQ_CNS3XXX_DMAC8 (IRQ_TC11MP_GIC_START + 45)
  482. #define IRQ_CNS3XXX_DMAC9 (IRQ_TC11MP_GIC_START + 46)
  483. #define IRQ_CNS3XXX_DMAC10 (IRQ_TC11MP_GIC_START + 47)
  484. #define IRQ_CNS3XXX_DMAC11 (IRQ_TC11MP_GIC_START + 48)
  485. #define IRQ_CNS3XXX_DMAC12 (IRQ_TC11MP_GIC_START + 49)
  486. #define IRQ_CNS3XXX_DMAC13 (IRQ_TC11MP_GIC_START + 50)
  487. #define IRQ_CNS3XXX_DMAC14 (IRQ_TC11MP_GIC_START + 51)
  488. #define IRQ_CNS3XXX_DMAC15 (IRQ_TC11MP_GIC_START + 52)
  489. #define IRQ_CNS3XXX_DMAC16 (IRQ_TC11MP_GIC_START + 53)
  490. #define IRQ_CNS3XXX_DMAC17 (IRQ_TC11MP_GIC_START + 54)
  491. #define IRQ_CNS3XXX_PCIE0_RC (IRQ_TC11MP_GIC_START + 55)
  492. #define IRQ_CNS3XXX_PCIE1_RC (IRQ_TC11MP_GIC_START + 56)
  493. #define IRQ_CNS3XXX_TIMER0 (IRQ_TC11MP_GIC_START + 57)
  494. #define IRQ_CNS3XXX_TIMER1 (IRQ_TC11MP_GIC_START + 58)
  495. #define IRQ_CNS3XXX_USB_OHCI (IRQ_TC11MP_GIC_START + 59)
  496. #define IRQ_CNS3XXX_TIMER2 (IRQ_TC11MP_GIC_START + 60)
  497. #define IRQ_CNS3XXX_EXTERNAL_PIN0 (IRQ_TC11MP_GIC_START + 61)
  498. #define IRQ_CNS3XXX_EXTERNAL_PIN1 (IRQ_TC11MP_GIC_START + 62)
  499. #define IRQ_CNS3XXX_EXTERNAL_PIN2 (IRQ_TC11MP_GIC_START + 63)
  500. #define NR_IRQS_CNS3XXX (IRQ_TC11MP_GIC_START + 64)
  501. #endif /* __MACH_BOARD_CNS3XXX_H */