iop3xx.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /*
  2. * include/asm-arm/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. #endif
  29. /*
  30. * IOP3XX processor registers
  31. */
  32. #define IOP3XX_PERIPHERAL_PHYS_BASE 0xffffe000
  33. #define IOP3XX_PERIPHERAL_VIRT_BASE 0xfeffe000
  34. #define IOP3XX_PERIPHERAL_SIZE 0x00002000
  35. #define IOP3XX_REG_ADDR(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + (reg))
  36. /* Address Translation Unit */
  37. #define IOP3XX_ATUVID (volatile u16 *)IOP3XX_REG_ADDR(0x0100)
  38. #define IOP3XX_ATUDID (volatile u16 *)IOP3XX_REG_ADDR(0x0102)
  39. #define IOP3XX_ATUCMD (volatile u16 *)IOP3XX_REG_ADDR(0x0104)
  40. #define IOP3XX_ATUSR (volatile u16 *)IOP3XX_REG_ADDR(0x0106)
  41. #define IOP3XX_ATURID (volatile u8 *)IOP3XX_REG_ADDR(0x0108)
  42. #define IOP3XX_ATUCCR (volatile u32 *)IOP3XX_REG_ADDR(0x0109)
  43. #define IOP3XX_ATUCLSR (volatile u8 *)IOP3XX_REG_ADDR(0x010c)
  44. #define IOP3XX_ATULT (volatile u8 *)IOP3XX_REG_ADDR(0x010d)
  45. #define IOP3XX_ATUHTR (volatile u8 *)IOP3XX_REG_ADDR(0x010e)
  46. #define IOP3XX_ATUBIST (volatile u8 *)IOP3XX_REG_ADDR(0x010f)
  47. #define IOP3XX_IABAR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0110)
  48. #define IOP3XX_IAUBAR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0114)
  49. #define IOP3XX_IABAR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0118)
  50. #define IOP3XX_IAUBAR1 (volatile u32 *)IOP3XX_REG_ADDR(0x011c)
  51. #define IOP3XX_IABAR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0120)
  52. #define IOP3XX_IAUBAR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0124)
  53. #define IOP3XX_ASVIR (volatile u16 *)IOP3XX_REG_ADDR(0x012c)
  54. #define IOP3XX_ASIR (volatile u16 *)IOP3XX_REG_ADDR(0x012e)
  55. #define IOP3XX_ERBAR (volatile u32 *)IOP3XX_REG_ADDR(0x0130)
  56. #define IOP3XX_ATUILR (volatile u8 *)IOP3XX_REG_ADDR(0x013c)
  57. #define IOP3XX_ATUIPR (volatile u8 *)IOP3XX_REG_ADDR(0x013d)
  58. #define IOP3XX_ATUMGNT (volatile u8 *)IOP3XX_REG_ADDR(0x013e)
  59. #define IOP3XX_ATUMLAT (volatile u8 *)IOP3XX_REG_ADDR(0x013f)
  60. #define IOP3XX_IALR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0140)
  61. #define IOP3XX_IATVR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0144)
  62. #define IOP3XX_ERLR (volatile u32 *)IOP3XX_REG_ADDR(0x0148)
  63. #define IOP3XX_ERTVR (volatile u32 *)IOP3XX_REG_ADDR(0x014c)
  64. #define IOP3XX_IALR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0150)
  65. #define IOP3XX_IALR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0154)
  66. #define IOP3XX_IATVR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0158)
  67. #define IOP3XX_OIOWTVR (volatile u32 *)IOP3XX_REG_ADDR(0x015c)
  68. #define IOP3XX_OMWTVR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0160)
  69. #define IOP3XX_OUMWTVR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0164)
  70. #define IOP3XX_OMWTVR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0168)
  71. #define IOP3XX_OUMWTVR1 (volatile u32 *)IOP3XX_REG_ADDR(0x016c)
  72. #define IOP3XX_OUDWTVR (volatile u32 *)IOP3XX_REG_ADDR(0x0178)
  73. #define IOP3XX_ATUCR (volatile u32 *)IOP3XX_REG_ADDR(0x0180)
  74. #define IOP3XX_PCSR (volatile u32 *)IOP3XX_REG_ADDR(0x0184)
  75. #define IOP3XX_ATUISR (volatile u32 *)IOP3XX_REG_ADDR(0x0188)
  76. #define IOP3XX_ATUIMR (volatile u32 *)IOP3XX_REG_ADDR(0x018c)
  77. #define IOP3XX_IABAR3 (volatile u32 *)IOP3XX_REG_ADDR(0x0190)
  78. #define IOP3XX_IAUBAR3 (volatile u32 *)IOP3XX_REG_ADDR(0x0194)
  79. #define IOP3XX_IALR3 (volatile u32 *)IOP3XX_REG_ADDR(0x0198)
  80. #define IOP3XX_IATVR3 (volatile u32 *)IOP3XX_REG_ADDR(0x019c)
  81. #define IOP3XX_OCCAR (volatile u32 *)IOP3XX_REG_ADDR(0x01a4)
  82. #define IOP3XX_OCCDR (volatile u32 *)IOP3XX_REG_ADDR(0x01ac)
  83. #define IOP3XX_PDSCR (volatile u32 *)IOP3XX_REG_ADDR(0x01bc)
  84. #define IOP3XX_PMCAPID (volatile u8 *)IOP3XX_REG_ADDR(0x01c0)
  85. #define IOP3XX_PMNEXT (volatile u8 *)IOP3XX_REG_ADDR(0x01c1)
  86. #define IOP3XX_APMCR (volatile u16 *)IOP3XX_REG_ADDR(0x01c2)
  87. #define IOP3XX_APMCSR (volatile u16 *)IOP3XX_REG_ADDR(0x01c4)
  88. #define IOP3XX_PCIXCAPID (volatile u8 *)IOP3XX_REG_ADDR(0x01e0)
  89. #define IOP3XX_PCIXNEXT (volatile u8 *)IOP3XX_REG_ADDR(0x01e1)
  90. #define IOP3XX_PCIXCMD (volatile u16 *)IOP3XX_REG_ADDR(0x01e2)
  91. #define IOP3XX_PCIXSR (volatile u32 *)IOP3XX_REG_ADDR(0x01e4)
  92. #define IOP3XX_PCIIRSR (volatile u32 *)IOP3XX_REG_ADDR(0x01ec)
  93. /* General Purpose I/O */
  94. #define IOP3XX_GPOE (volatile u32 *)IOP3XX_GPIO_REG(0x0004)
  95. #define IOP3XX_GPID (volatile u32 *)IOP3XX_GPIO_REG(0x0008)
  96. #define IOP3XX_GPOD (volatile u32 *)IOP3XX_GPIO_REG(0x000c)
  97. /* Timers */
  98. #define IOP3XX_TU_TMR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0000)
  99. #define IOP3XX_TU_TMR1 (volatile u32 *)IOP3XX_TIMER_REG(0x0004)
  100. #define IOP3XX_TU_TCR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0008)
  101. #define IOP3XX_TU_TCR1 (volatile u32 *)IOP3XX_TIMER_REG(0x000c)
  102. #define IOP3XX_TU_TRR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0010)
  103. #define IOP3XX_TU_TRR1 (volatile u32 *)IOP3XX_TIMER_REG(0x0014)
  104. #define IOP3XX_TU_TISR (volatile u32 *)IOP3XX_TIMER_REG(0x0018)
  105. #define IOP3XX_TU_WDTCR (volatile u32 *)IOP3XX_TIMER_REG(0x001c)
  106. #define IOP3XX_TMR_TC 0x01
  107. #define IOP3XX_TMR_EN 0x02
  108. #define IOP3XX_TMR_RELOAD 0x04
  109. #define IOP3XX_TMR_PRIVILEGED 0x09
  110. #define IOP3XX_TMR_RATIO_1_1 0x00
  111. #define IOP3XX_TMR_RATIO_4_1 0x10
  112. #define IOP3XX_TMR_RATIO_8_1 0x20
  113. #define IOP3XX_TMR_RATIO_16_1 0x30
  114. /* I2C bus interface unit */
  115. #define IOP3XX_ICR0 (volatile u32 *)IOP3XX_REG_ADDR(0x1680)
  116. #define IOP3XX_ISR0 (volatile u32 *)IOP3XX_REG_ADDR(0x1684)
  117. #define IOP3XX_ISAR0 (volatile u32 *)IOP3XX_REG_ADDR(0x1688)
  118. #define IOP3XX_IDBR0 (volatile u32 *)IOP3XX_REG_ADDR(0x168c)
  119. #define IOP3XX_IBMR0 (volatile u32 *)IOP3XX_REG_ADDR(0x1694)
  120. #define IOP3XX_ICR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16a0)
  121. #define IOP3XX_ISR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16a4)
  122. #define IOP3XX_ISAR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16a8)
  123. #define IOP3XX_IDBR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16ac)
  124. #define IOP3XX_IBMR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16b4)
  125. /*
  126. * IOP3XX I/O and Mem space regions for PCI autoconfiguration
  127. */
  128. #define IOP3XX_PCI_MEM_WINDOW_SIZE 0x04000000
  129. #define IOP3XX_PCI_LOWER_MEM_PA 0x80000000
  130. #define IOP3XX_PCI_LOWER_MEM_BA (*IOP3XX_OMWTVR0)
  131. #define IOP3XX_PCI_IO_WINDOW_SIZE 0x00010000
  132. #define IOP3XX_PCI_LOWER_IO_PA 0x90000000
  133. #define IOP3XX_PCI_LOWER_IO_VA 0xfe000000
  134. #define IOP3XX_PCI_LOWER_IO_BA (*IOP3XX_OIOWTVR)
  135. #ifndef __ASSEMBLY__
  136. void iop3xx_map_io(void);
  137. void iop3xx_init_time(unsigned long);
  138. unsigned long iop3xx_gettimeoffset(void);
  139. extern struct platform_device iop3xx_i2c0_device;
  140. extern struct platform_device iop3xx_i2c1_device;
  141. extern inline void iop3xx_cp6_enable(void)
  142. {
  143. u32 temp;
  144. asm volatile (
  145. "mrc p15, 0, %0, c15, c1, 0\n\t"
  146. "orr %0, %0, #(1 << 6)\n\t"
  147. "mcr p15, 0, %0, c15, c1, 0\n\t"
  148. "mrc p15, 0, %0, c15, c1, 0\n\t"
  149. "mov %0, %0\n\t"
  150. "sub pc, pc, #4\n\t"
  151. : "=r" (temp) );
  152. }
  153. extern inline void iop3xx_cp6_disable(void)
  154. {
  155. u32 temp;
  156. asm volatile (
  157. "mrc p15, 0, %0, c15, c1, 0\n\t"
  158. "bic %0, %0, #(1 << 6)\n\t"
  159. "mcr p15, 0, %0, c15, c1, 0\n\t"
  160. "mrc p15, 0, %0, c15, c1, 0\n\t"
  161. "mov %0, %0\n\t"
  162. "sub pc, pc, #4\n\t"
  163. : "=r" (temp) );
  164. }
  165. #endif
  166. #endif