tcc8k-regs.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807
  1. /*
  2. * Telechips TCC8000 register definitions
  3. *
  4. * (C) 2009 Hans J. Koch <hjk@linutronix.de>
  5. *
  6. * Licensed under the terms of the GPLv2.
  7. */
  8. #ifndef TCC8K_REGS_H
  9. #define TCC8K_REGS_H
  10. #include <linux/types.h>
  11. #define EXT_SDRAM_BASE 0x20000000
  12. #define INT_SRAM_BASE 0x30000000
  13. #define INT_SRAM_SIZE SZ_32K
  14. #define CS0_BASE 0x40000000
  15. #define CS1_BASE 0x50000000
  16. #define CS1_SIZE SZ_64K
  17. #define CS2_BASE 0x60000000
  18. #define CS3_BASE 0x70000000
  19. #define AHB_PERI_BASE 0x80000000
  20. #define AHB_PERI_SIZE SZ_64K
  21. #define APB0_PERI_BASE 0x90000000
  22. #define APB0_PERI_SIZE SZ_128K
  23. #define APB1_PERI_BASE 0x98000000
  24. #define APB1_PERI_SIZE SZ_128K
  25. #define DATA_TCM_BASE 0xa0000000
  26. #define DATA_TCM_SIZE SZ_8K
  27. #define EXT_MEM_CTRL_BASE 0xf0000000
  28. #define EXT_MEM_CTRL_SIZE SZ_4K
  29. #define CS1_BASE_VIRT (void __iomem *)0xf7000000
  30. #define AHB_PERI_BASE_VIRT (void __iomem *)0xf4000000
  31. #define APB0_PERI_BASE_VIRT (void __iomem *)0xf1000000
  32. #define APB1_PERI_BASE_VIRT (void __iomem *)0xf2000000
  33. #define EXT_MEM_CTRL_BASE_VIRT (void __iomem *)0xf3000000
  34. #define INT_SRAM_BASE_VIRT (void __iomem *)0xf5000000
  35. #define DATA_TCM_BASE_VIRT (void __iomem *)0xf6000000
  36. #define __REG(x) (*((volatile u32 *)(x)))
  37. /* USB Device Controller Registers */
  38. #define UDC_BASE (AHB_PERI_BASE_VIRT + 0x8000)
  39. #define UDC_BASE_PHYS (AHB_PERI_BASE + 0x8000)
  40. #define UDC_IR_OFFS 0x00
  41. #define UDC_EIR_OFFS 0x04
  42. #define UDC_EIER_OFFS 0x08
  43. #define UDC_FAR_OFFS 0x0c
  44. #define UDC_FNR_OFFS 0x10
  45. #define UDC_EDR_OFFS 0x14
  46. #define UDC_RT_OFFS 0x18
  47. #define UDC_SSR_OFFS 0x1c
  48. #define UDC_SCR_OFFS 0x20
  49. #define UDC_EP0SR_OFFS 0x24
  50. #define UDC_EP0CR_OFFS 0x28
  51. #define UDC_ESR_OFFS 0x2c
  52. #define UDC_ECR_OFFS 0x30
  53. #define UDC_BRCR_OFFS 0x34
  54. #define UDC_BWCR_OFFS 0x38
  55. #define UDC_MPR_OFFS 0x3c
  56. #define UDC_DCR_OFFS 0x40
  57. #define UDC_DTCR_OFFS 0x44
  58. #define UDC_DFCR_OFFS 0x48
  59. #define UDC_DTTCR1_OFFS 0x4c
  60. #define UDC_DTTCR2_OFFS 0x50
  61. #define UDC_ESR2_OFFS 0x54
  62. #define UDC_SCR2_OFFS 0x58
  63. #define UDC_EP0BUF_OFFS 0x60
  64. #define UDC_EP1BUF_OFFS 0x64
  65. #define UDC_EP2BUF_OFFS 0x68
  66. #define UDC_EP3BUF_OFFS 0x6c
  67. #define UDC_PLICR_OFFS 0xa0
  68. #define UDC_PCR_OFFS 0xa4
  69. #define UDC_UPCR0_OFFS 0xc8
  70. #define UDC_UPCR1_OFFS 0xcc
  71. #define UDC_UPCR2_OFFS 0xd0
  72. #define UDC_UPCR3_OFFS 0xd4
  73. /* Bits in UDC_EIR */
  74. #define UDC_EIR_EP0I (1 << 0)
  75. #define UDC_EIR_EP1I (1 << 1)
  76. #define UDC_EIR_EP2I (1 << 2)
  77. #define UDC_EIR_EP3I (1 << 3)
  78. #define UDC_EIR_EPI_MASK 0x0f
  79. /* Bits in UDC_EIER */
  80. #define UDC_EIER_EP0IE (1 << 0)
  81. #define UDC_EIER_EP1IE (1 << 1)
  82. #define UDC_EIER_EP2IE (1 << 2)
  83. #define UDC_EIER_EP3IE (1 << 3)
  84. /* Bits in UDC_FNR */
  85. #define UDC_FNR_FN_MASK 0x7ff
  86. #define UDC_FNR_SM (1 << 13)
  87. #define UDC_FNR_FTL (1 << 14)
  88. /* Bits in UDC_SSR */
  89. #define UDC_SSR_HFRES (1 << 0)
  90. #define UDC_SSR_HFSUSP (1 << 1)
  91. #define UDC_SSR_HFRM (1 << 2)
  92. #define UDC_SSR_SDE (1 << 3)
  93. #define UDC_SSR_HSP (1 << 4)
  94. #define UDC_SSR_DM (1 << 5)
  95. #define UDC_SSR_DP (1 << 6)
  96. #define UDC_SSR_TBM (1 << 7)
  97. #define UDC_SSR_VBON (1 << 8)
  98. #define UDC_SSR_VBOFF (1 << 9)
  99. #define UDC_SSR_EOERR (1 << 10)
  100. #define UDC_SSR_DCERR (1 << 11)
  101. #define UDC_SSR_TCERR (1 << 12)
  102. #define UDC_SSR_BSERR (1 << 13)
  103. #define UDC_SSR_TMERR (1 << 14)
  104. #define UDC_SSR_BAERR (1 << 15)
  105. /* Bits in UDC_SCR */
  106. #define UDC_SCR_HRESE (1 << 0)
  107. #define UDC_SCR_HSSPE (1 << 1)
  108. #define UDC_SCR_RRDE (1 << 5)
  109. #define UDC_SCR_SPDEN (1 << 6)
  110. #define UDC_SCR_DIEN (1 << 12)
  111. /* Bits in UDC_EP0SR */
  112. #define UDC_EP0SR_RSR (1 << 0)
  113. #define UDC_EP0SR_TST (1 << 1)
  114. #define UDC_EP0SR_SHT (1 << 4)
  115. #define UDC_EP0SR_LWO (1 << 6)
  116. /* Bits in UDC_EP0CR */
  117. #define UDC_EP0CR_ESS (1 << 1)
  118. /* Bits in UDC_ESR */
  119. #define UDC_ESR_RPS (1 << 0)
  120. #define UDC_ESR_TPS (1 << 1)
  121. #define UDC_ESR_LWO (1 << 4)
  122. #define UDC_ESR_FFS (1 << 6)
  123. /* Bits in UDC_ECR */
  124. #define UDC_ECR_ESS (1 << 1)
  125. #define UDC_ECR_CDP (1 << 2)
  126. #define UDC_ECR_FLUSH (1 << 6)
  127. #define UDC_ECR_DUEN (1 << 7)
  128. /* Bits in UDC_UPCR0 */
  129. #define UDC_UPCR0_VBD (1 << 1)
  130. #define UDC_UPCR0_VBDS (1 << 6)
  131. #define UDC_UPCR0_RCD_12 (0x0 << 9)
  132. #define UDC_UPCR0_RCD_24 (0x1 << 9)
  133. #define UDC_UPCR0_RCD_48 (0x2 << 9)
  134. #define UDC_UPCR0_RCS_EXT (0x1 << 11)
  135. #define UDC_UPCR0_RCS_XTAL (0x0 << 11)
  136. /* Bits in UDC_UPCR1 */
  137. #define UDC_UPCR1_CDT(x) ((x) << 0)
  138. #define UDC_UPCR1_OTGT(x) ((x) << 3)
  139. #define UDC_UPCR1_SQRXT(x) ((x) << 8)
  140. #define UDC_UPCR1_TXFSLST(x) ((x) << 12)
  141. /* Bits in UDC_UPCR2 */
  142. #define UDC_UPCR2_TP (1 << 0)
  143. #define UDC_UPCR2_TXRT(x) ((x) << 2)
  144. #define UDC_UPCR2_TXVRT(x) ((x) << 5)
  145. #define UDC_UPCR2_OPMODE(x) ((x) << 9)
  146. #define UDC_UPCR2_XCVRSEL(x) ((x) << 12)
  147. #define UDC_UPCR2_TM (1 << 14)
  148. /* USB Host Controller registers */
  149. #define USBH0_BASE (AHB_PERI_BASE_VIRT + 0xb000)
  150. #define USBH1_BASE (AHB_PERI_BASE_VIRT + 0xb800)
  151. #define OHCI_INT_ENABLE_OFFS 0x10
  152. #define RH_DESCRIPTOR_A_OFFS 0x48
  153. #define RH_DESCRIPTOR_B_OFFS 0x4c
  154. #define USBHTCFG0_OFFS 0x100
  155. #define USBHHCFG0_OFFS 0x104
  156. #define USBHHCFG1_OFFS 0x104
  157. /* DMA controller registers */
  158. #define DMAC0_BASE (AHB_PERI_BASE + 0x4000)
  159. #define DMAC1_BASE (AHB_PERI_BASE + 0xa000)
  160. #define DMAC2_BASE (AHB_PERI_BASE + 0x4800)
  161. #define DMAC3_BASE (AHB_PERI_BASE + 0xa800)
  162. #define DMAC_CH_OFFSET(ch) (ch * 0x30)
  163. #define ST_SADR_OFFS 0x00
  164. #define SPARAM_OFFS 0x04
  165. #define C_SADR_OFFS 0x0c
  166. #define ST_DADR_OFFS 0x10
  167. #define DPARAM_OFFS 0x14
  168. #define C_DADR_OFFS 0x1c
  169. #define HCOUNT_OFFS 0x20
  170. #define CHCTRL_OFFS 0x24
  171. #define RPTCTRL_OFFS 0x28
  172. #define EXTREQ_A_OFFS 0x2c
  173. /* Bits in CHCTRL register */
  174. #define CHCTRL_EN (1 << 0)
  175. #define CHCTRL_IEN (1 << 2)
  176. #define CHCTRL_FLAG (1 << 3)
  177. #define CHCTRL_WSIZE8 (0 << 4)
  178. #define CHCTRL_WSIZE16 (1 << 4)
  179. #define CHCTRL_WSIZE32 (2 << 4)
  180. #define CHCTRL_BSIZE1 (0 << 6)
  181. #define CHCTRL_BSIZE2 (1 << 6)
  182. #define CHCTRL_BSIZE4 (2 << 6)
  183. #define CHCTRL_BSIZE8 (3 << 6)
  184. #define CHCTRL_TYPE_SINGLE_E (0 << 8)
  185. #define CHCTRL_TYPE_HW (1 << 8)
  186. #define CHCTRL_TYPE_SW (2 << 8)
  187. #define CHCTRL_TYPE_SINGLE_L (3 << 8)
  188. #define CHCTRL_BST (1 << 10)
  189. /* Use DMA controller 0, channel 2 for USB */
  190. #define USB_DMA_BASE (DMAC0_BASE + DMAC_CH_OFFSET(2))
  191. /* NAND flash controller registers */
  192. #define NFC_BASE (AHB_PERI_BASE_VIRT + 0xd000)
  193. #define NFC_BASE_PHYS (AHB_PERI_BASE + 0xd000)
  194. #define NFC_CMD_OFFS 0x00
  195. #define NFC_LADDR_OFFS 0x04
  196. #define NFC_BADDR_OFFS 0x08
  197. #define NFC_SADDR_OFFS 0x0c
  198. #define NFC_WDATA_OFFS 0x10
  199. #define NFC_LDATA_OFFS 0x20
  200. #define NFC_SDATA_OFFS 0x40
  201. #define NFC_CTRL_OFFS 0x50
  202. #define NFC_PSTART_OFFS 0x54
  203. #define NFC_RSTART_OFFS 0x58
  204. #define NFC_DSIZE_OFFS 0x5c
  205. #define NFC_IREQ_OFFS 0x60
  206. #define NFC_RST_OFFS 0x64
  207. #define NFC_CTRL1_OFFS 0x68
  208. #define NFC_MDATA_OFFS 0x70
  209. #define NFC_WDATA_PHYS_ADDR (NFC_BASE_PHYS + NFC_WDATA_OFFS)
  210. /* Bits in NFC_CTRL */
  211. #define NFC_CTRL_BHLD_MASK (0xf << 0)
  212. #define NFC_CTRL_BPW_MASK (0xf << 4)
  213. #define NFC_CTRL_BSTP_MASK (0xf << 8)
  214. #define NFC_CTRL_CADDR_MASK (0x7 << 12)
  215. #define NFC_CTRL_CADDR_1 (0x0 << 12)
  216. #define NFC_CTRL_CADDR_2 (0x1 << 12)
  217. #define NFC_CTRL_CADDR_3 (0x2 << 12)
  218. #define NFC_CTRL_CADDR_4 (0x3 << 12)
  219. #define NFC_CTRL_CADDR_5 (0x4 << 12)
  220. #define NFC_CTRL_MSK (1 << 15)
  221. #define NFC_CTRL_PSIZE256 (0 << 16)
  222. #define NFC_CTRL_PSIZE512 (1 << 16)
  223. #define NFC_CTRL_PSIZE1024 (2 << 16)
  224. #define NFC_CTRL_PSIZE2048 (3 << 16)
  225. #define NFC_CTRL_PSIZE4096 (4 << 16)
  226. #define NFC_CTRL_PSIZE_MASK (7 << 16)
  227. #define NFC_CTRL_BSIZE1 (0 << 19)
  228. #define NFC_CTRL_BSIZE2 (1 << 19)
  229. #define NFC_CTRL_BSIZE4 (2 << 19)
  230. #define NFC_CTRL_BSIZE8 (3 << 19)
  231. #define NFC_CTRL_BSIZE_MASK (3 << 19)
  232. #define NFC_CTRL_RDY (1 << 21)
  233. #define NFC_CTRL_CS0SEL (1 << 22)
  234. #define NFC_CTRL_CS1SEL (1 << 23)
  235. #define NFC_CTRL_CS2SEL (1 << 24)
  236. #define NFC_CTRL_CS3SEL (1 << 25)
  237. #define NFC_CTRL_CSMASK (0xf << 22)
  238. #define NFC_CTRL_BW (1 << 26)
  239. #define NFC_CTRL_FS (1 << 27)
  240. #define NFC_CTRL_DEN (1 << 28)
  241. #define NFC_CTRL_READ_IEN (1 << 29)
  242. #define NFC_CTRL_PROG_IEN (1 << 30)
  243. #define NFC_CTRL_RDY_IEN (1 << 31)
  244. /* Bits in NFC_IREQ */
  245. #define NFC_IREQ_IRQ0 (1 << 0)
  246. #define NFC_IREQ_IRQ1 (1 << 1)
  247. #define NFC_IREQ_IRQ2 (1 << 2)
  248. #define NFC_IREQ_FLAG0 (1 << 4)
  249. #define NFC_IREQ_FLAG1 (1 << 5)
  250. #define NFC_IREQ_FLAG2 (1 << 6)
  251. /* MMC controller registers */
  252. #define MMC0_BASE (AHB_PERI_BASE_VIRT + 0xe000)
  253. #define MMC1_BASE (AHB_PERI_BASE_VIRT + 0xe800)
  254. /* UART base addresses */
  255. #define UART0_BASE (APB0_PERI_BASE_VIRT + 0x07000)
  256. #define UART0_BASE_PHYS (APB0_PERI_BASE + 0x07000)
  257. #define UART1_BASE (APB0_PERI_BASE_VIRT + 0x08000)
  258. #define UART1_BASE_PHYS (APB0_PERI_BASE + 0x08000)
  259. #define UART2_BASE (APB0_PERI_BASE_VIRT + 0x09000)
  260. #define UART2_BASE_PHYS (APB0_PERI_BASE + 0x09000)
  261. #define UART3_BASE (APB0_PERI_BASE_VIRT + 0x0a000)
  262. #define UART3_BASE_PHYS (APB0_PERI_BASE + 0x0a000)
  263. #define UART4_BASE (APB0_PERI_BASE_VIRT + 0x15000)
  264. #define UART4_BASE_PHYS (APB0_PERI_BASE + 0x15000)
  265. #define UART_BASE UART0_BASE
  266. #define UART_BASE_PHYS UART0_BASE_PHYS
  267. /* ECC controller */
  268. #define ECC_CTR_BASE (APB0_PERI_BASE_VIRT + 0xd000)
  269. #define ECC_CTRL_OFFS 0x00
  270. #define ECC_BASE_OFFS 0x04
  271. #define ECC_MASK_OFFS 0x08
  272. #define ECC_CLEAR_OFFS 0x0c
  273. #define ECC4_0_OFFS 0x10
  274. #define ECC4_1_OFFS 0x14
  275. #define ECC_EADDR0_OFFS 0x50
  276. #define ECC_ERRNUM_OFFS 0x90
  277. #define ECC_IREQ_OFFS 0x94
  278. /* Bits in ECC_CTRL */
  279. #define ECC_CTRL_ECC4_DIEN (1 << 28)
  280. #define ECC_CTRL_ECC8_DIEN (1 << 29)
  281. #define ECC_CTRL_ECC12_DIEN (1 << 30)
  282. #define ECC_CTRL_ECC_DISABLE 0x0
  283. #define ECC_CTRL_ECC_SLC_ENC 0x8
  284. #define ECC_CTRL_ECC_SLC_DEC 0x9
  285. #define ECC_CTRL_ECC4_ENC 0xa
  286. #define ECC_CTRL_ECC4_DEC 0xb
  287. #define ECC_CTRL_ECC8_ENC 0xc
  288. #define ECC_CTRL_ECC8_DEC 0xd
  289. #define ECC_CTRL_ECC12_ENC 0xe
  290. #define ECC_CTRL_ECC12_DEC 0xf
  291. /* Bits in ECC_IREQ */
  292. #define ECC_IREQ_E4DI (1 << 4)
  293. #define ECC_IREQ_E4DF (1 << 20)
  294. #define ECC_IREQ_E4EF (1 << 21)
  295. /* Interrupt controller */
  296. #define PIC0_BASE (APB1_PERI_BASE_VIRT + 0x3000)
  297. #define PIC0_BASE_PHYS (APB1_PERI_BASE + 0x3000)
  298. #define PIC0_IEN_OFFS 0x00
  299. #define PIC0_CREQ_OFFS 0x04
  300. #define PIC0_IREQ_OFFS 0x08
  301. #define PIC0_IRQSEL_OFFS 0x0c
  302. #define PIC0_SRC_OFFS 0x10
  303. #define PIC0_MREQ_OFFS 0x14
  304. #define PIC0_TSTREQ_OFFS 0x18
  305. #define PIC0_POL_OFFS 0x1c
  306. #define PIC0_IRQ_OFFS 0x20
  307. #define PIC0_FIQ_OFFS 0x24
  308. #define PIC0_MIRQ_OFFS 0x28
  309. #define PIC0_MFIQ_OFFS 0x2c
  310. #define PIC0_TMODE_OFFS 0x30
  311. #define PIC0_SYNC_OFFS 0x34
  312. #define PIC0_WKUP_OFFS 0x38
  313. #define PIC0_TMODEA_OFFS 0x3c
  314. #define PIC0_INTOEN_OFFS 0x40
  315. #define PIC0_MEN0_OFFS 0x44
  316. #define PIC0_MEN_OFFS 0x48
  317. #define PIC0_IEN __REG(PIC0_BASE + PIC0_IEN_OFFS)
  318. #define PIC0_IEN_PHYS __REG(PIC0_BASE_PHYS + PIC0_IEN_OFFS)
  319. #define PIC0_CREQ __REG(PIC0_BASE + PIC0_CREQ_OFFS)
  320. #define PIC0_CREQ_PHYS __REG(PIC0_BASE_PHYS + PIC0_CREQ_OFFS)
  321. #define PIC0_IREQ __REG(PIC0_BASE + PIC0_IREQ_OFFS)
  322. #define PIC0_IRQSEL __REG(PIC0_BASE + PIC0_IRQSEL_OFFS)
  323. #define PIC0_IRQSEL_PHYS __REG(PIC0_BASE_PHYS + PIC0_IRQSEL_OFFS)
  324. #define PIC0_SRC __REG(PIC0_BASE + PIC0_SRC_OFFS)
  325. #define PIC0_MREQ __REG(PIC0_BASE + PIC0_MREQ_OFFS)
  326. #define PIC0_TSTREQ __REG(PIC0_BASE + PIC0_TSTREQ_OFFS)
  327. #define PIC0_POL __REG(PIC0_BASE + PIC0_POL_OFFS)
  328. #define PIC0_IRQ __REG(PIC0_BASE + PIC0_IRQ_OFFS)
  329. #define PIC0_FIQ __REG(PIC0_BASE + PIC0_FIQ_OFFS)
  330. #define PIC0_MIRQ __REG(PIC0_BASE + PIC0_MIRQ_OFFS)
  331. #define PIC0_MFIQ __REG(PIC0_BASE + PIC0_MFIQ_OFFS)
  332. #define PIC0_TMODE __REG(PIC0_BASE + PIC0_TMODE_OFFS)
  333. #define PIC0_TMODE_PHYS __REG(PIC0_BASE_PHYS + PIC0_TMODE_OFFS)
  334. #define PIC0_SYNC __REG(PIC0_BASE + PIC0_SYNC_OFFS)
  335. #define PIC0_WKUP __REG(PIC0_BASE + PIC0_WKUP_OFFS)
  336. #define PIC0_TMODEA __REG(PIC0_BASE + PIC0_TMODEA_OFFS)
  337. #define PIC0_INTOEN __REG(PIC0_BASE + PIC0_INTOEN_OFFS)
  338. #define PIC0_MEN0 __REG(PIC0_BASE + PIC0_MEN0_OFFS)
  339. #define PIC0_MEN __REG(PIC0_BASE + PIC0_MEN_OFFS)
  340. #define PIC1_BASE (APB1_PERI_BASE_VIRT + 0x3080)
  341. #define PIC1_IEN_OFFS 0x00
  342. #define PIC1_CREQ_OFFS 0x04
  343. #define PIC1_IREQ_OFFS 0x08
  344. #define PIC1_IRQSEL_OFFS 0x0c
  345. #define PIC1_SRC_OFFS 0x10
  346. #define PIC1_MREQ_OFFS 0x14
  347. #define PIC1_TSTREQ_OFFS 0x18
  348. #define PIC1_POL_OFFS 0x1c
  349. #define PIC1_IRQ_OFFS 0x20
  350. #define PIC1_FIQ_OFFS 0x24
  351. #define PIC1_MIRQ_OFFS 0x28
  352. #define PIC1_MFIQ_OFFS 0x2c
  353. #define PIC1_TMODE_OFFS 0x30
  354. #define PIC1_SYNC_OFFS 0x34
  355. #define PIC1_WKUP_OFFS 0x38
  356. #define PIC1_TMODEA_OFFS 0x3c
  357. #define PIC1_INTOEN_OFFS 0x40
  358. #define PIC1_MEN1_OFFS 0x44
  359. #define PIC1_MEN_OFFS 0x48
  360. #define PIC1_IEN __REG(PIC1_BASE + PIC1_IEN_OFFS)
  361. #define PIC1_CREQ __REG(PIC1_BASE + PIC1_CREQ_OFFS)
  362. #define PIC1_IREQ __REG(PIC1_BASE + PIC1_IREQ_OFFS)
  363. #define PIC1_IRQSEL __REG(PIC1_BASE + PIC1_IRQSEL_OFFS)
  364. #define PIC1_SRC __REG(PIC1_BASE + PIC1_SRC_OFFS)
  365. #define PIC1_MREQ __REG(PIC1_BASE + PIC1_MREQ_OFFS)
  366. #define PIC1_TSTREQ __REG(PIC1_BASE + PIC1_TSTREQ_OFFS)
  367. #define PIC1_POL __REG(PIC1_BASE + PIC1_POL_OFFS)
  368. #define PIC1_IRQ __REG(PIC1_BASE + PIC1_IRQ_OFFS)
  369. #define PIC1_FIQ __REG(PIC1_BASE + PIC1_FIQ_OFFS)
  370. #define PIC1_MIRQ __REG(PIC1_BASE + PIC1_MIRQ_OFFS)
  371. #define PIC1_MFIQ __REG(PIC1_BASE + PIC1_MFIQ_OFFS)
  372. #define PIC1_TMODE __REG(PIC1_BASE + PIC1_TMODE_OFFS)
  373. #define PIC1_SYNC __REG(PIC1_BASE + PIC1_SYNC_OFFS)
  374. #define PIC1_WKUP __REG(PIC1_BASE + PIC1_WKUP_OFFS)
  375. #define PIC1_TMODEA __REG(PIC1_BASE + PIC1_TMODEA_OFFS)
  376. #define PIC1_INTOEN __REG(PIC1_BASE + PIC1_INTOEN_OFFS)
  377. #define PIC1_MEN1 __REG(PIC1_BASE + PIC1_MEN1_OFFS)
  378. #define PIC1_MEN __REG(PIC1_BASE + PIC1_MEN_OFFS)
  379. /* Timer registers */
  380. #define TIMER_BASE (APB1_PERI_BASE_VIRT + 0x4000)
  381. #define TIMER_BASE_PHYS (APB1_PERI_BASE + 0x4000)
  382. #define TWDCFG_OFFS 0x70
  383. #define TC32EN_OFFS 0x80
  384. #define TC32LDV_OFFS 0x84
  385. #define TC32CMP0_OFFS 0x88
  386. #define TC32CMP1_OFFS 0x8c
  387. #define TC32PCNT_OFFS 0x90
  388. #define TC32MCNT_OFFS 0x94
  389. #define TC32IRQ_OFFS 0x98
  390. /* Bits in TC32EN */
  391. #define TC32EN_PRESCALE_MASK 0x00ffffff
  392. #define TC32EN_ENABLE (1 << 24)
  393. #define TC32EN_LOADZERO (1 << 25)
  394. #define TC32EN_STOPMODE (1 << 26)
  395. #define TC32EN_LDM0 (1 << 28)
  396. #define TC32EN_LDM1 (1 << 29)
  397. /* Bits in TC32IRQ */
  398. #define TC32IRQ_MSTAT_MASK 0x0000001f
  399. #define TC32IRQ_RSTAT_MASK (0x1f << 8)
  400. #define TC32IRQ_IRQEN0 (1 << 16)
  401. #define TC32IRQ_IRQEN1 (1 << 17)
  402. #define TC32IRQ_IRQEN2 (1 << 18)
  403. #define TC32IRQ_IRQEN3 (1 << 19)
  404. #define TC32IRQ_IRQEN4 (1 << 20)
  405. #define TC32IRQ_RSYNC (1 << 30)
  406. #define TC32IRQ_IRQCLR (1 << 31)
  407. /* GPIO registers */
  408. #define GPIOPD_BASE (APB1_PERI_BASE_VIRT + 0x5000)
  409. #define GPIOPD_DAT_OFFS 0x00
  410. #define GPIOPD_DOE_OFFS 0x04
  411. #define GPIOPD_FS0_OFFS 0x08
  412. #define GPIOPD_FS1_OFFS 0x0c
  413. #define GPIOPD_FS2_OFFS 0x10
  414. #define GPIOPD_RPU_OFFS 0x30
  415. #define GPIOPD_RPD_OFFS 0x34
  416. #define GPIOPD_DV0_OFFS 0x38
  417. #define GPIOPD_DV1_OFFS 0x3c
  418. #define GPIOPS_BASE (APB1_PERI_BASE_VIRT + 0x5000)
  419. #define GPIOPS_DAT_OFFS 0x40
  420. #define GPIOPS_DOE_OFFS 0x44
  421. #define GPIOPS_FS0_OFFS 0x48
  422. #define GPIOPS_FS1_OFFS 0x4c
  423. #define GPIOPS_FS2_OFFS 0x50
  424. #define GPIOPS_FS3_OFFS 0x54
  425. #define GPIOPS_RPU_OFFS 0x70
  426. #define GPIOPS_RPD_OFFS 0x74
  427. #define GPIOPS_DV0_OFFS 0x78
  428. #define GPIOPS_DV1_OFFS 0x7c
  429. #define GPIOPS_FS1_SDH0_BITS 0x000000ff
  430. #define GPIOPS_FS1_SDH1_BITS 0x0000ff00
  431. #define GPIOPU_BASE (APB1_PERI_BASE_VIRT + 0x5000)
  432. #define GPIOPU_DAT_OFFS 0x80
  433. #define GPIOPU_DOE_OFFS 0x84
  434. #define GPIOPU_FS0_OFFS 0x88
  435. #define GPIOPU_FS1_OFFS 0x8c
  436. #define GPIOPU_FS2_OFFS 0x90
  437. #define GPIOPU_RPU_OFFS 0xb0
  438. #define GPIOPU_RPD_OFFS 0xb4
  439. #define GPIOPU_DV0_OFFS 0xb8
  440. #define GPIOPU_DV1_OFFS 0xbc
  441. #define GPIOPU_FS0_TXD0 (1 << 0)
  442. #define GPIOPU_FS0_RXD0 (1 << 1)
  443. #define GPIOPU_FS0_CTS0 (1 << 2)
  444. #define GPIOPU_FS0_RTS0 (1 << 3)
  445. #define GPIOPU_FS0_TXD1 (1 << 4)
  446. #define GPIOPU_FS0_RXD1 (1 << 5)
  447. #define GPIOPU_FS0_CTS1 (1 << 6)
  448. #define GPIOPU_FS0_RTS1 (1 << 7)
  449. #define GPIOPU_FS0_TXD2 (1 << 8)
  450. #define GPIOPU_FS0_RXD2 (1 << 9)
  451. #define GPIOPU_FS0_CTS2 (1 << 10)
  452. #define GPIOPU_FS0_RTS2 (1 << 11)
  453. #define GPIOPU_FS0_TXD3 (1 << 12)
  454. #define GPIOPU_FS0_RXD3 (1 << 13)
  455. #define GPIOPU_FS0_CTS3 (1 << 14)
  456. #define GPIOPU_FS0_RTS3 (1 << 15)
  457. #define GPIOPU_FS0_TXD4 (1 << 16)
  458. #define GPIOPU_FS0_RXD4 (1 << 17)
  459. #define GPIOPU_FS0_CTS4 (1 << 18)
  460. #define GPIOPU_FS0_RTS4 (1 << 19)
  461. #define GPIOFC_BASE (APB1_PERI_BASE_VIRT + 0x5000)
  462. #define GPIOFC_DAT_OFFS 0xc0
  463. #define GPIOFC_DOE_OFFS 0xc4
  464. #define GPIOFC_FS0_OFFS 0xc8
  465. #define GPIOFC_FS1_OFFS 0xcc
  466. #define GPIOFC_FS2_OFFS 0xd0
  467. #define GPIOFC_FS3_OFFS 0xd4
  468. #define GPIOFC_RPU_OFFS 0xf0
  469. #define GPIOFC_RPD_OFFS 0xf4
  470. #define GPIOFC_DV0_OFFS 0xf8
  471. #define GPIOFC_DV1_OFFS 0xfc
  472. #define GPIOFD_BASE (APB1_PERI_BASE_VIRT + 0x5000)
  473. #define GPIOFD_DAT_OFFS 0x100
  474. #define GPIOFD_DOE_OFFS 0x104
  475. #define GPIOFD_FS0_OFFS 0x108
  476. #define GPIOFD_FS1_OFFS 0x10c
  477. #define GPIOFD_FS2_OFFS 0x110
  478. #define GPIOFD_RPU_OFFS 0x130
  479. #define GPIOFD_RPD_OFFS 0x134
  480. #define GPIOFD_DV0_OFFS 0x138
  481. #define GPIOFD_DV1_OFFS 0x13c
  482. #define GPIOLC_BASE (APB1_PERI_BASE_VIRT + 0x5000)
  483. #define GPIOLC_DAT_OFFS 0x140
  484. #define GPIOLC_DOE_OFFS 0x144
  485. #define GPIOLC_FS0_OFFS 0x148
  486. #define GPIOLC_FS1_OFFS 0x14c
  487. #define GPIOLC_RPU_OFFS 0x170
  488. #define GPIOLC_RPD_OFFS 0x174
  489. #define GPIOLC_DV0_OFFS 0x178
  490. #define GPIOLC_DV1_OFFS 0x17c
  491. #define GPIOLD_BASE (APB1_PERI_BASE_VIRT + 0x5000)
  492. #define GPIOLD_DAT_OFFS 0x180
  493. #define GPIOLD_DOE_OFFS 0x184
  494. #define GPIOLD_FS0_OFFS 0x188
  495. #define GPIOLD_FS1_OFFS 0x18c
  496. #define GPIOLD_FS2_OFFS 0x190
  497. #define GPIOLD_RPU_OFFS 0x1b0
  498. #define GPIOLD_RPD_OFFS 0x1b4
  499. #define GPIOLD_DV0_OFFS 0x1b8
  500. #define GPIOLD_DV1_OFFS 0x1bc
  501. #define GPIOAD_BASE (APB1_PERI_BASE_VIRT + 0x5000)
  502. #define GPIOAD_DAT_OFFS 0x1c0
  503. #define GPIOAD_DOE_OFFS 0x1c4
  504. #define GPIOAD_FS0_OFFS 0x1c8
  505. #define GPIOAD_RPU_OFFS 0x1f0
  506. #define GPIOAD_RPD_OFFS 0x1f4
  507. #define GPIOAD_DV0_OFFS 0x1f8
  508. #define GPIOAD_DV1_OFFS 0x1fc
  509. #define GPIOXC_BASE (APB1_PERI_BASE_VIRT + 0x5000)
  510. #define GPIOXC_DAT_OFFS 0x200
  511. #define GPIOXC_DOE_OFFS 0x204
  512. #define GPIOXC_FS0_OFFS 0x208
  513. #define GPIOXC_RPU_OFFS 0x230
  514. #define GPIOXC_RPD_OFFS 0x234
  515. #define GPIOXC_DV0_OFFS 0x238
  516. #define GPIOXC_DV1_OFFS 0x23c
  517. #define GPIOXC_FS0 __REG(GPIOXC_BASE + GPIOXC_FS0_OFFS)
  518. #define GPIOXC_FS0_CS0 (1 << 26)
  519. #define GPIOXC_FS0_CS1 (1 << 27)
  520. #define GPIOXD_BASE (APB1_PERI_BASE_VIRT + 0x5000)
  521. #define GPIOXD_DAT_OFFS 0x240
  522. #define GPIOXD_FS0_OFFS 0x248
  523. #define GPIOXD_RPU_OFFS 0x270
  524. #define GPIOXD_RPD_OFFS 0x274
  525. #define GPIOXD_DV0_OFFS 0x278
  526. #define GPIOXD_DV1_OFFS 0x27c
  527. #define GPIOPK_BASE (APB1_PERI_BASE_VIRT + 0x1c000)
  528. #define GPIOPK_RST_OFFS 0x008
  529. #define GPIOPK_DAT_OFFS 0x100
  530. #define GPIOPK_DOE_OFFS 0x104
  531. #define GPIOPK_FS0_OFFS 0x108
  532. #define GPIOPK_FS1_OFFS 0x10c
  533. #define GPIOPK_FS2_OFFS 0x110
  534. #define GPIOPK_IRQST_OFFS 0x210
  535. #define GPIOPK_IRQEN_OFFS 0x214
  536. #define GPIOPK_IRQPOL_OFFS 0x218
  537. #define GPIOPK_IRQTM0_OFFS 0x21c
  538. #define GPIOPK_IRQTM1_OFFS 0x220
  539. #define GPIOPK_CTL_OFFS 0x22c
  540. #define PMGPIO_BASE (APB1_PERI_BASE_VIRT + 0x10000)
  541. #define BACKUP_RAM_BASE PMGPIO_BASE
  542. #define PMGPIO_DAT_OFFS 0x800
  543. #define PMGPIO_DOE_OFFS 0x804
  544. #define PMGPIO_FS0_OFFS 0x808
  545. #define PMGPIO_RPU_OFFS 0x810
  546. #define PMGPIO_RPD_OFFS 0x814
  547. #define PMGPIO_DV0_OFFS 0x818
  548. #define PMGPIO_DV1_OFFS 0x81c
  549. #define PMGPIO_EE0_OFFS 0x820
  550. #define PMGPIO_EE1_OFFS 0x824
  551. #define PMGPIO_CTL_OFFS 0x828
  552. #define PMGPIO_DI_OFFS 0x82c
  553. #define PMGPIO_STR_OFFS 0x830
  554. #define PMGPIO_STF_OFFS 0x834
  555. #define PMGPIO_POL_OFFS 0x838
  556. #define PMGPIO_APB_OFFS 0x800
  557. /* Clock controller registers */
  558. #define CKC_BASE ((void __iomem *)(APB1_PERI_BASE_VIRT + 0x6000))
  559. #define CLKCTRL_OFFS 0x00
  560. #define PLL0CFG_OFFS 0x04
  561. #define PLL1CFG_OFFS 0x08
  562. #define CLKDIVC0_OFFS 0x0c
  563. #define BCLKCTR0_OFFS 0x14
  564. #define SWRESET0_OFFS 0x18
  565. #define BCLKCTR1_OFFS 0x60
  566. #define SWRESET1_OFFS 0x64
  567. #define PWDCTL_OFFS 0x68
  568. #define PLL2CFG_OFFS 0x6c
  569. #define CLKDIVC1_OFFS 0x70
  570. #define ACLKREF_OFFS 0x80
  571. #define ACLKI2C_OFFS 0x84
  572. #define ACLKSPI0_OFFS 0x88
  573. #define ACLKSPI1_OFFS 0x8c
  574. #define ACLKUART0_OFFS 0x90
  575. #define ACLKUART1_OFFS 0x94
  576. #define ACLKUART2_OFFS 0x98
  577. #define ACLKUART3_OFFS 0x9c
  578. #define ACLKUART4_OFFS 0xa0
  579. #define ACLKTCT_OFFS 0xa4
  580. #define ACLKTCX_OFFS 0xa8
  581. #define ACLKTCZ_OFFS 0xac
  582. #define ACLKADC_OFFS 0xb0
  583. #define ACLKDAI0_OFFS 0xb4
  584. #define ACLKDAI1_OFFS 0xb8
  585. #define ACLKLCD_OFFS 0xbc
  586. #define ACLKSPDIF_OFFS 0xc0
  587. #define ACLKUSBH_OFFS 0xc4
  588. #define ACLKSDH0_OFFS 0xc8
  589. #define ACLKSDH1_OFFS 0xcc
  590. #define ACLKC3DEC_OFFS 0xd0
  591. #define ACLKEXT_OFFS 0xd4
  592. #define ACLKCAN0_OFFS 0xd8
  593. #define ACLKCAN1_OFFS 0xdc
  594. #define ACLKGSB0_OFFS 0xe0
  595. #define ACLKGSB1_OFFS 0xe4
  596. #define ACLKGSB2_OFFS 0xe8
  597. #define ACLKGSB3_OFFS 0xec
  598. #define PLLxCFG_PD (1 << 31)
  599. /* CLKCTRL bits */
  600. #define CLKCTRL_XE (1 << 31)
  601. /* CLKDIVCx bits */
  602. #define CLKDIVC0_XTE (1 << 7)
  603. #define CLKDIVC0_XE (1 << 15)
  604. #define CLKDIVC0_P1E (1 << 23)
  605. #define CLKDIVC0_P0E (1 << 31)
  606. #define CLKDIVC1_P2E (1 << 7)
  607. /* BCLKCTR0 clock bits */
  608. #define BCLKCTR0_USBD (1 << 4)
  609. #define BCLKCTR0_ECC (1 << 9)
  610. #define BCLKCTR0_USBH0 (1 << 11)
  611. #define BCLKCTR0_NFC (1 << 16)
  612. /* BCLKCTR1 clock bits */
  613. #define BCLKCTR1_USBH1 (1 << 20)
  614. /* SWRESET0 bits */
  615. #define SWRESET0_USBD (1 << 4)
  616. #define SWRESET0_USBH0 (1 << 11)
  617. /* SWRESET1 bits */
  618. #define SWRESET1_USBH1 (1 << 20)
  619. /* System clock sources.
  620. * Note: These are the clock sources that serve as parents for
  621. * all other clocks. They have no parents themselves.
  622. *
  623. * These values are used for struct clk->root_id. All clocks
  624. * that are not system clock sources have this value set to
  625. * CLK_SRC_NOROOT.
  626. * The values for system clocks start with CLK_SRC_PLL0 == 0
  627. * because this gives us exactly the values needed for the lower
  628. * 4 bits of ACLK_* registers. Therefore, CLK_SRC_NOROOT is
  629. * defined as -1 to not disturb the order.
  630. */
  631. enum root_clks {
  632. CLK_SRC_NOROOT = -1,
  633. CLK_SRC_PLL0 = 0,
  634. CLK_SRC_PLL1,
  635. CLK_SRC_PLL0DIV,
  636. CLK_SRC_PLL1DIV,
  637. CLK_SRC_XI,
  638. CLK_SRC_XIDIV,
  639. CLK_SRC_XTI,
  640. CLK_SRC_XTIDIV,
  641. CLK_SRC_PLL2,
  642. CLK_SRC_PLL2DIV,
  643. CLK_SRC_PK0,
  644. CLK_SRC_PK1,
  645. CLK_SRC_PK2,
  646. CLK_SRC_PK3,
  647. CLK_SRC_PK4,
  648. CLK_SRC_48MHZ
  649. };
  650. #define CLK_SRC_MASK 0xf
  651. /* Bits in ACLK* registers */
  652. #define ACLK_EN (1 << 28)
  653. #define ACLK_SEL_SHIFT 24
  654. #define ACLK_SEL_MASK 0x0f000000
  655. #define ACLK_DIV_MASK 0x00000fff
  656. /* System configuration registers */
  657. #define SCFG_BASE (APB1_PERI_BASE_VIRT + 0x13000)
  658. #define BMI_OFFS 0x00
  659. #define AHBCON0_OFFS 0x04
  660. #define APBPWE_OFFS 0x08
  661. #define DTCMWAIT_OFFS 0x0c
  662. #define ECCSEL_OFFS 0x10
  663. #define AHBCON1_OFFS 0x14
  664. #define SDHCFG_OFFS 0x18
  665. #define REMAP_OFFS 0x20
  666. #define LCDSIAE_OFFS 0x24
  667. #define XMCCFG_OFFS 0xe0
  668. #define IMCCFG_OFFS 0xe4
  669. /* Values for ECCSEL */
  670. #define ECCSEL_EXTMEM 0x0
  671. #define ECCSEL_DTCM 0x1
  672. #define ECCSEL_INT_SRAM 0x2
  673. #define ECCSEL_AHB 0x3
  674. /* Bits in XMCCFG */
  675. #define XMCCFG_NFCE (1 << 1)
  676. #define XMCCFG_FDXD (1 << 2)
  677. /* External memory controller registers */
  678. #define EMC_BASE EXT_MEM_CTRL_BASE
  679. #define SDCFG_OFFS 0x00
  680. #define SDFSM_OFFS 0x04
  681. #define MCFG_OFFS 0x08
  682. #define CSCFG0_OFFS 0x10
  683. #define CSCFG1_OFFS 0x14
  684. #define CSCFG2_OFFS 0x18
  685. #define CSCFG3_OFFS 0x1c
  686. #define MCFG_SDEN (1 << 4)
  687. #endif /* TCC8K_REGS_H */