iop3xx.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. /*
  2. * arch/arm/include/asm/hardware/iop3xx.h
  3. *
  4. * Intel IOP32X and IOP33X register definitions
  5. *
  6. * Author: Rory Bolt <rorybolt@pacbell.net>
  7. * Copyright (C) 2002 Rory Bolt
  8. * Copyright (C) 2004 Intel Corp.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #ifndef __IOP3XX_H
  15. #define __IOP3XX_H
  16. /*
  17. * IOP3XX GPIO handling
  18. */
  19. #define GPIO_IN 0
  20. #define GPIO_OUT 1
  21. #define GPIO_LOW 0
  22. #define GPIO_HIGH 1
  23. #define IOP3XX_GPIO_LINE(x) (x)
  24. #ifndef __ASSEMBLY__
  25. extern void gpio_line_config(int line, int direction);
  26. extern int gpio_line_get(int line);
  27. extern void gpio_line_set(int line, int value);
  28. extern int init_atu;
  29. extern int iop3xx_get_init_atu(void);
  30. #endif
  31. /*
  32. * IOP3XX processor registers
  33. */
  34. #define IOP3XX_PERIPHERAL_PHYS_BASE 0xffffe000
  35. #define IOP3XX_PERIPHERAL_VIRT_BASE 0xfeffe000
  36. #define IOP3XX_PERIPHERAL_SIZE 0x00002000
  37. #define IOP3XX_PERIPHERAL_UPPER_PA (IOP3XX_PERIPHERAL_PHYS_BASE +\
  38. IOP3XX_PERIPHERAL_SIZE - 1)
  39. #define IOP3XX_PERIPHERAL_UPPER_VA (IOP3XX_PERIPHERAL_VIRT_BASE +\
  40. IOP3XX_PERIPHERAL_SIZE - 1)
  41. #define IOP3XX_PMMR_PHYS_TO_VIRT(addr) (u32) ((u32) (addr) -\
  42. (IOP3XX_PERIPHERAL_PHYS_BASE\
  43. - IOP3XX_PERIPHERAL_VIRT_BASE))
  44. #define IOP3XX_REG_ADDR(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + (reg))
  45. /* Address Translation Unit */
  46. #define IOP3XX_ATUVID (volatile u16 *)IOP3XX_REG_ADDR(0x0100)
  47. #define IOP3XX_ATUDID (volatile u16 *)IOP3XX_REG_ADDR(0x0102)
  48. #define IOP3XX_ATUCMD (volatile u16 *)IOP3XX_REG_ADDR(0x0104)
  49. #define IOP3XX_ATUSR (volatile u16 *)IOP3XX_REG_ADDR(0x0106)
  50. #define IOP3XX_ATURID (volatile u8 *)IOP3XX_REG_ADDR(0x0108)
  51. #define IOP3XX_ATUCCR (volatile u32 *)IOP3XX_REG_ADDR(0x0109)
  52. #define IOP3XX_ATUCLSR (volatile u8 *)IOP3XX_REG_ADDR(0x010c)
  53. #define IOP3XX_ATULT (volatile u8 *)IOP3XX_REG_ADDR(0x010d)
  54. #define IOP3XX_ATUHTR (volatile u8 *)IOP3XX_REG_ADDR(0x010e)
  55. #define IOP3XX_ATUBIST (volatile u8 *)IOP3XX_REG_ADDR(0x010f)
  56. #define IOP3XX_IABAR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0110)
  57. #define IOP3XX_IAUBAR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0114)
  58. #define IOP3XX_IABAR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0118)
  59. #define IOP3XX_IAUBAR1 (volatile u32 *)IOP3XX_REG_ADDR(0x011c)
  60. #define IOP3XX_IABAR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0120)
  61. #define IOP3XX_IAUBAR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0124)
  62. #define IOP3XX_ASVIR (volatile u16 *)IOP3XX_REG_ADDR(0x012c)
  63. #define IOP3XX_ASIR (volatile u16 *)IOP3XX_REG_ADDR(0x012e)
  64. #define IOP3XX_ERBAR (volatile u32 *)IOP3XX_REG_ADDR(0x0130)
  65. #define IOP3XX_ATUILR (volatile u8 *)IOP3XX_REG_ADDR(0x013c)
  66. #define IOP3XX_ATUIPR (volatile u8 *)IOP3XX_REG_ADDR(0x013d)
  67. #define IOP3XX_ATUMGNT (volatile u8 *)IOP3XX_REG_ADDR(0x013e)
  68. #define IOP3XX_ATUMLAT (volatile u8 *)IOP3XX_REG_ADDR(0x013f)
  69. #define IOP3XX_IALR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0140)
  70. #define IOP3XX_IATVR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0144)
  71. #define IOP3XX_ERLR (volatile u32 *)IOP3XX_REG_ADDR(0x0148)
  72. #define IOP3XX_ERTVR (volatile u32 *)IOP3XX_REG_ADDR(0x014c)
  73. #define IOP3XX_IALR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0150)
  74. #define IOP3XX_IALR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0154)
  75. #define IOP3XX_IATVR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0158)
  76. #define IOP3XX_OIOWTVR (volatile u32 *)IOP3XX_REG_ADDR(0x015c)
  77. #define IOP3XX_OMWTVR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0160)
  78. #define IOP3XX_OUMWTVR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0164)
  79. #define IOP3XX_OMWTVR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0168)
  80. #define IOP3XX_OUMWTVR1 (volatile u32 *)IOP3XX_REG_ADDR(0x016c)
  81. #define IOP3XX_OUDWTVR (volatile u32 *)IOP3XX_REG_ADDR(0x0178)
  82. #define IOP3XX_ATUCR (volatile u32 *)IOP3XX_REG_ADDR(0x0180)
  83. #define IOP3XX_PCSR (volatile u32 *)IOP3XX_REG_ADDR(0x0184)
  84. #define IOP3XX_ATUISR (volatile u32 *)IOP3XX_REG_ADDR(0x0188)
  85. #define IOP3XX_ATUIMR (volatile u32 *)IOP3XX_REG_ADDR(0x018c)
  86. #define IOP3XX_IABAR3 (volatile u32 *)IOP3XX_REG_ADDR(0x0190)
  87. #define IOP3XX_IAUBAR3 (volatile u32 *)IOP3XX_REG_ADDR(0x0194)
  88. #define IOP3XX_IALR3 (volatile u32 *)IOP3XX_REG_ADDR(0x0198)
  89. #define IOP3XX_IATVR3 (volatile u32 *)IOP3XX_REG_ADDR(0x019c)
  90. #define IOP3XX_OCCAR (volatile u32 *)IOP3XX_REG_ADDR(0x01a4)
  91. #define IOP3XX_OCCDR (volatile u32 *)IOP3XX_REG_ADDR(0x01ac)
  92. #define IOP3XX_PDSCR (volatile u32 *)IOP3XX_REG_ADDR(0x01bc)
  93. #define IOP3XX_PMCAPID (volatile u8 *)IOP3XX_REG_ADDR(0x01c0)
  94. #define IOP3XX_PMNEXT (volatile u8 *)IOP3XX_REG_ADDR(0x01c1)
  95. #define IOP3XX_APMCR (volatile u16 *)IOP3XX_REG_ADDR(0x01c2)
  96. #define IOP3XX_APMCSR (volatile u16 *)IOP3XX_REG_ADDR(0x01c4)
  97. #define IOP3XX_PCIXCAPID (volatile u8 *)IOP3XX_REG_ADDR(0x01e0)
  98. #define IOP3XX_PCIXNEXT (volatile u8 *)IOP3XX_REG_ADDR(0x01e1)
  99. #define IOP3XX_PCIXCMD (volatile u16 *)IOP3XX_REG_ADDR(0x01e2)
  100. #define IOP3XX_PCIXSR (volatile u32 *)IOP3XX_REG_ADDR(0x01e4)
  101. #define IOP3XX_PCIIRSR (volatile u32 *)IOP3XX_REG_ADDR(0x01ec)
  102. #define IOP3XX_PCSR_OUT_Q_BUSY (1 << 15)
  103. #define IOP3XX_PCSR_IN_Q_BUSY (1 << 14)
  104. #define IOP3XX_ATUCR_OUT_EN (1 << 1)
  105. #define IOP3XX_INIT_ATU_DEFAULT 0
  106. #define IOP3XX_INIT_ATU_DISABLE -1
  107. #define IOP3XX_INIT_ATU_ENABLE 1
  108. /* Messaging Unit */
  109. #define IOP3XX_IMR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0310)
  110. #define IOP3XX_IMR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0314)
  111. #define IOP3XX_OMR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0318)
  112. #define IOP3XX_OMR1 (volatile u32 *)IOP3XX_REG_ADDR(0x031c)
  113. #define IOP3XX_IDR (volatile u32 *)IOP3XX_REG_ADDR(0x0320)
  114. #define IOP3XX_IISR (volatile u32 *)IOP3XX_REG_ADDR(0x0324)
  115. #define IOP3XX_IIMR (volatile u32 *)IOP3XX_REG_ADDR(0x0328)
  116. #define IOP3XX_ODR (volatile u32 *)IOP3XX_REG_ADDR(0x032c)
  117. #define IOP3XX_OISR (volatile u32 *)IOP3XX_REG_ADDR(0x0330)
  118. #define IOP3XX_OIMR (volatile u32 *)IOP3XX_REG_ADDR(0x0334)
  119. #define IOP3XX_MUCR (volatile u32 *)IOP3XX_REG_ADDR(0x0350)
  120. #define IOP3XX_QBAR (volatile u32 *)IOP3XX_REG_ADDR(0x0354)
  121. #define IOP3XX_IFHPR (volatile u32 *)IOP3XX_REG_ADDR(0x0360)
  122. #define IOP3XX_IFTPR (volatile u32 *)IOP3XX_REG_ADDR(0x0364)
  123. #define IOP3XX_IPHPR (volatile u32 *)IOP3XX_REG_ADDR(0x0368)
  124. #define IOP3XX_IPTPR (volatile u32 *)IOP3XX_REG_ADDR(0x036c)
  125. #define IOP3XX_OFHPR (volatile u32 *)IOP3XX_REG_ADDR(0x0370)
  126. #define IOP3XX_OFTPR (volatile u32 *)IOP3XX_REG_ADDR(0x0374)
  127. #define IOP3XX_OPHPR (volatile u32 *)IOP3XX_REG_ADDR(0x0378)
  128. #define IOP3XX_OPTPR (volatile u32 *)IOP3XX_REG_ADDR(0x037c)
  129. #define IOP3XX_IAR (volatile u32 *)IOP3XX_REG_ADDR(0x0380)
  130. /* DMA Controller */
  131. #define IOP3XX_DMA_PHYS_BASE(chan) (IOP3XX_PERIPHERAL_PHYS_BASE + \
  132. (0x400 + (chan << 6)))
  133. #define IOP3XX_DMA_UPPER_PA(chan) (IOP3XX_DMA_PHYS_BASE(chan) + 0x27)
  134. /* Peripheral bus interface */
  135. #define IOP3XX_PBCR (volatile u32 *)IOP3XX_REG_ADDR(0x0680)
  136. #define IOP3XX_PBISR (volatile u32 *)IOP3XX_REG_ADDR(0x0684)
  137. #define IOP3XX_PBBAR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0688)
  138. #define IOP3XX_PBLR0 (volatile u32 *)IOP3XX_REG_ADDR(0x068c)
  139. #define IOP3XX_PBBAR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0690)
  140. #define IOP3XX_PBLR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0694)
  141. #define IOP3XX_PBBAR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0698)
  142. #define IOP3XX_PBLR2 (volatile u32 *)IOP3XX_REG_ADDR(0x069c)
  143. #define IOP3XX_PBBAR3 (volatile u32 *)IOP3XX_REG_ADDR(0x06a0)
  144. #define IOP3XX_PBLR3 (volatile u32 *)IOP3XX_REG_ADDR(0x06a4)
  145. #define IOP3XX_PBBAR4 (volatile u32 *)IOP3XX_REG_ADDR(0x06a8)
  146. #define IOP3XX_PBLR4 (volatile u32 *)IOP3XX_REG_ADDR(0x06ac)
  147. #define IOP3XX_PBBAR5 (volatile u32 *)IOP3XX_REG_ADDR(0x06b0)
  148. #define IOP3XX_PBLR5 (volatile u32 *)IOP3XX_REG_ADDR(0x06b4)
  149. #define IOP3XX_PMBR0 (volatile u32 *)IOP3XX_REG_ADDR(0x06c0)
  150. #define IOP3XX_PMBR1 (volatile u32 *)IOP3XX_REG_ADDR(0x06e0)
  151. #define IOP3XX_PMBR2 (volatile u32 *)IOP3XX_REG_ADDR(0x06e4)
  152. /* Peripheral performance monitoring unit */
  153. #define IOP3XX_GTMR (volatile u32 *)IOP3XX_REG_ADDR(0x0700)
  154. #define IOP3XX_ESR (volatile u32 *)IOP3XX_REG_ADDR(0x0704)
  155. #define IOP3XX_EMISR (volatile u32 *)IOP3XX_REG_ADDR(0x0708)
  156. #define IOP3XX_GTSR (volatile u32 *)IOP3XX_REG_ADDR(0x0710)
  157. /* PERCR0 DOESN'T EXIST - index from 1! */
  158. #define IOP3XX_PERCR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0710)
  159. /* General Purpose I/O */
  160. #define IOP3XX_GPOE (volatile u32 *)IOP3XX_GPIO_REG(0x0000)
  161. #define IOP3XX_GPID (volatile u32 *)IOP3XX_GPIO_REG(0x0004)
  162. #define IOP3XX_GPOD (volatile u32 *)IOP3XX_GPIO_REG(0x0008)
  163. /* Timers */
  164. #define IOP3XX_TU_TMR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0000)
  165. #define IOP3XX_TU_TMR1 (volatile u32 *)IOP3XX_TIMER_REG(0x0004)
  166. #define IOP3XX_TU_TCR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0008)
  167. #define IOP3XX_TU_TCR1 (volatile u32 *)IOP3XX_TIMER_REG(0x000c)
  168. #define IOP3XX_TU_TRR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0010)
  169. #define IOP3XX_TU_TRR1 (volatile u32 *)IOP3XX_TIMER_REG(0x0014)
  170. #define IOP3XX_TU_TISR (volatile u32 *)IOP3XX_TIMER_REG(0x0018)
  171. #define IOP3XX_TU_WDTCR (volatile u32 *)IOP3XX_TIMER_REG(0x001c)
  172. #define IOP_TMR_EN 0x02
  173. #define IOP_TMR_RELOAD 0x04
  174. #define IOP_TMR_PRIVILEGED 0x08
  175. #define IOP_TMR_RATIO_1_1 0x00
  176. /* Watchdog timer definitions */
  177. #define IOP_WDTCR_EN_ARM 0x1e1e1e1e
  178. #define IOP_WDTCR_EN 0xe1e1e1e1
  179. /* iop3xx does not support stopping the watchdog, so we just re-arm */
  180. #define IOP_WDTCR_DIS_ARM (IOP_WDTCR_EN_ARM)
  181. #define IOP_WDTCR_DIS (IOP_WDTCR_EN)
  182. /* Application accelerator unit */
  183. #define IOP3XX_AAU_PHYS_BASE (IOP3XX_PERIPHERAL_PHYS_BASE + 0x800)
  184. #define IOP3XX_AAU_UPPER_PA (IOP3XX_AAU_PHYS_BASE + 0xa7)
  185. /* I2C bus interface unit */
  186. #define IOP3XX_ICR0 (volatile u32 *)IOP3XX_REG_ADDR(0x1680)
  187. #define IOP3XX_ISR0 (volatile u32 *)IOP3XX_REG_ADDR(0x1684)
  188. #define IOP3XX_ISAR0 (volatile u32 *)IOP3XX_REG_ADDR(0x1688)
  189. #define IOP3XX_IDBR0 (volatile u32 *)IOP3XX_REG_ADDR(0x168c)
  190. #define IOP3XX_IBMR0 (volatile u32 *)IOP3XX_REG_ADDR(0x1694)
  191. #define IOP3XX_ICR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16a0)
  192. #define IOP3XX_ISR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16a4)
  193. #define IOP3XX_ISAR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16a8)
  194. #define IOP3XX_IDBR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16ac)
  195. #define IOP3XX_IBMR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16b4)
  196. /*
  197. * IOP3XX I/O and Mem space regions for PCI autoconfiguration
  198. */
  199. #define IOP3XX_PCI_LOWER_MEM_PA 0x80000000
  200. #define IOP3XX_PCI_MEM_WINDOW_SIZE 0x08000000
  201. #define IOP3XX_PCI_IO_WINDOW_SIZE 0x00010000
  202. #define IOP3XX_PCI_LOWER_IO_PA 0x90000000
  203. #define IOP3XX_PCI_LOWER_IO_VA 0xfe000000
  204. #define IOP3XX_PCI_LOWER_IO_BA 0x90000000
  205. #define IOP3XX_PCI_UPPER_IO_PA (IOP3XX_PCI_LOWER_IO_PA +\
  206. IOP3XX_PCI_IO_WINDOW_SIZE - 1)
  207. #define IOP3XX_PCI_UPPER_IO_VA (IOP3XX_PCI_LOWER_IO_VA +\
  208. IOP3XX_PCI_IO_WINDOW_SIZE - 1)
  209. #define IOP3XX_PCI_IO_PHYS_TO_VIRT(addr) (((u32) (addr) -\
  210. IOP3XX_PCI_LOWER_IO_PA) +\
  211. IOP3XX_PCI_LOWER_IO_VA)
  212. #ifndef __ASSEMBLY__
  213. #include <linux/types.h>
  214. void iop3xx_map_io(void);
  215. void iop_init_cp6_handler(void);
  216. void iop_init_time(unsigned long tickrate);
  217. void iop3xx_restart(char, const char *);
  218. static inline u32 read_tmr0(void)
  219. {
  220. u32 val;
  221. asm volatile("mrc p6, 0, %0, c0, c1, 0" : "=r" (val));
  222. return val;
  223. }
  224. static inline void write_tmr0(u32 val)
  225. {
  226. asm volatile("mcr p6, 0, %0, c0, c1, 0" : : "r" (val));
  227. }
  228. static inline void write_tmr1(u32 val)
  229. {
  230. asm volatile("mcr p6, 0, %0, c1, c1, 0" : : "r" (val));
  231. }
  232. static inline u32 read_tcr0(void)
  233. {
  234. u32 val;
  235. asm volatile("mrc p6, 0, %0, c2, c1, 0" : "=r" (val));
  236. return val;
  237. }
  238. static inline void write_tcr0(u32 val)
  239. {
  240. asm volatile("mcr p6, 0, %0, c2, c1, 0" : : "r" (val));
  241. }
  242. static inline u32 read_tcr1(void)
  243. {
  244. u32 val;
  245. asm volatile("mrc p6, 0, %0, c3, c1, 0" : "=r" (val));
  246. return val;
  247. }
  248. static inline void write_tcr1(u32 val)
  249. {
  250. asm volatile("mcr p6, 0, %0, c3, c1, 0" : : "r" (val));
  251. }
  252. static inline void write_trr0(u32 val)
  253. {
  254. asm volatile("mcr p6, 0, %0, c4, c1, 0" : : "r" (val));
  255. }
  256. static inline void write_trr1(u32 val)
  257. {
  258. asm volatile("mcr p6, 0, %0, c5, c1, 0" : : "r" (val));
  259. }
  260. static inline void write_tisr(u32 val)
  261. {
  262. asm volatile("mcr p6, 0, %0, c6, c1, 0" : : "r" (val));
  263. }
  264. static inline u32 read_wdtcr(void)
  265. {
  266. u32 val;
  267. asm volatile("mrc p6, 0, %0, c7, c1, 0":"=r" (val));
  268. return val;
  269. }
  270. static inline void write_wdtcr(u32 val)
  271. {
  272. asm volatile("mcr p6, 0, %0, c7, c1, 0"::"r" (val));
  273. }
  274. extern unsigned long get_iop_tick_rate(void);
  275. /* only iop13xx has these registers, we define these to present a
  276. * common register interface for the iop_wdt driver.
  277. */
  278. #define IOP_RCSR_WDT (0)
  279. static inline u32 read_rcsr(void)
  280. {
  281. return 0;
  282. }
  283. static inline void write_wdtsr(u32 val)
  284. {
  285. do { } while (0);
  286. }
  287. extern struct platform_device iop3xx_dma_0_channel;
  288. extern struct platform_device iop3xx_dma_1_channel;
  289. extern struct platform_device iop3xx_aau_channel;
  290. extern struct platform_device iop3xx_i2c0_device;
  291. extern struct platform_device iop3xx_i2c1_device;
  292. #endif
  293. #endif