emma2rh.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. /*
  2. * Copyright (C) NEC Electronics Corporation 2005-2006
  3. *
  4. * This file based on include/asm-mips/ddb5xxx/ddb5xxx.h
  5. * Copyright 2001 MontaVista Software Inc.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #ifndef __ASM_EMMA_EMMA2RH_H
  22. #define __ASM_EMMA_EMMA2RH_H
  23. #include <irq.h>
  24. /*
  25. * EMMA2RH registers
  26. */
  27. #define REGBASE 0x10000000
  28. #define EMMA2RH_BHIF_STRAP_0 (0x000010+REGBASE)
  29. #define EMMA2RH_BHIF_INT_ST_0 (0x000030+REGBASE)
  30. #define EMMA2RH_BHIF_INT_ST_1 (0x000034+REGBASE)
  31. #define EMMA2RH_BHIF_INT_ST_2 (0x000038+REGBASE)
  32. #define EMMA2RH_BHIF_INT_EN_0 (0x000040+REGBASE)
  33. #define EMMA2RH_BHIF_INT_EN_1 (0x000044+REGBASE)
  34. #define EMMA2RH_BHIF_INT_EN_2 (0x000048+REGBASE)
  35. #define EMMA2RH_BHIF_INT1_EN_0 (0x000050+REGBASE)
  36. #define EMMA2RH_BHIF_INT1_EN_1 (0x000054+REGBASE)
  37. #define EMMA2RH_BHIF_INT1_EN_2 (0x000058+REGBASE)
  38. #define EMMA2RH_BHIF_SW_INT (0x000070+REGBASE)
  39. #define EMMA2RH_BHIF_SW_INT_EN (0x000080+REGBASE)
  40. #define EMMA2RH_BHIF_SW_INT_CLR (0x000090+REGBASE)
  41. #define EMMA2RH_BHIF_MAIN_CTRL (0x0000b4+REGBASE)
  42. #define EMMA2RH_BHIF_EXCEPT_VECT_BASE_ADDRESS (0x0000c0+REGBASE)
  43. #define EMMA2RH_GPIO_DIR (0x110d20+REGBASE)
  44. #define EMMA2RH_GPIO_INT_ST (0x110d30+REGBASE)
  45. #define EMMA2RH_GPIO_INT_MASK (0x110d3c+REGBASE)
  46. #define EMMA2RH_GPIO_INT_MODE (0x110d48+REGBASE)
  47. #define EMMA2RH_GPIO_INT_CND_A (0x110d54+REGBASE)
  48. #define EMMA2RH_GPIO_INT_CND_B (0x110d60+REGBASE)
  49. #define EMMA2RH_PBRD_INT_EN (0x100010+REGBASE)
  50. #define EMMA2RH_PBRD_CLKSEL (0x100028+REGBASE)
  51. #define EMMA2RH_PFUR0_BASE (0x101000+REGBASE)
  52. #define EMMA2RH_PFUR1_BASE (0x102000+REGBASE)
  53. #define EMMA2RH_PFUR2_BASE (0x103000+REGBASE)
  54. #define EMMA2RH_PIIC0_BASE (0x107000+REGBASE)
  55. #define EMMA2RH_PIIC1_BASE (0x108000+REGBASE)
  56. #define EMMA2RH_PIIC2_BASE (0x109000+REGBASE)
  57. #define EMMA2RH_PCI_CONTROL (0x200000+REGBASE)
  58. #define EMMA2RH_PCI_ARBIT_CTR (0x200004+REGBASE)
  59. #define EMMA2RH_PCI_IWIN0_CTR (0x200010+REGBASE)
  60. #define EMMA2RH_PCI_IWIN1_CTR (0x200014+REGBASE)
  61. #define EMMA2RH_PCI_INIT_ESWP (0x200018+REGBASE)
  62. #define EMMA2RH_PCI_INT (0x200020+REGBASE)
  63. #define EMMA2RH_PCI_INT_EN (0x200024+REGBASE)
  64. #define EMMA2RH_PCI_TWIN_CTR (0x200030+REGBASE)
  65. #define EMMA2RH_PCI_TWIN_BADR (0x200034+REGBASE)
  66. #define EMMA2RH_PCI_TWIN0_DADR (0x200038+REGBASE)
  67. #define EMMA2RH_PCI_TWIN1_DADR (0x20003c+REGBASE)
  68. /*
  69. * Memory map (physical address)
  70. *
  71. * Note most of the following address must be properly aligned by the
  72. * corresponding size. For example, if PCI_IO_SIZE is 16MB, then
  73. * PCI_IO_BASE must be aligned along 16MB boundary.
  74. */
  75. /* the actual ram size is detected at run-time */
  76. #define EMMA2RH_RAM_BASE 0x00000000
  77. #define EMMA2RH_RAM_SIZE 0x10000000 /* less than 256MB */
  78. #define EMMA2RH_IO_BASE 0x10000000
  79. #define EMMA2RH_IO_SIZE 0x01000000 /* 16 MB */
  80. #define EMMA2RH_GENERALIO_BASE 0x11000000
  81. #define EMMA2RH_GENERALIO_SIZE 0x01000000 /* 16 MB */
  82. #define EMMA2RH_PCI_IO_BASE 0x12000000
  83. #define EMMA2RH_PCI_IO_SIZE 0x02000000 /* 32 MB */
  84. #define EMMA2RH_PCI_MEM_BASE 0x14000000
  85. #define EMMA2RH_PCI_MEM_SIZE 0x08000000 /* 128 MB */
  86. #define EMMA2RH_ROM_BASE 0x1c000000
  87. #define EMMA2RH_ROM_SIZE 0x04000000 /* 64 MB */
  88. #define EMMA2RH_PCI_CONFIG_BASE EMMA2RH_PCI_IO_BASE
  89. #define EMMA2RH_PCI_CONFIG_SIZE EMMA2RH_PCI_IO_SIZE
  90. #define NUM_EMMA2RH_IRQ 96
  91. #define EMMA2RH_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8)
  92. /*
  93. * emma2rh irq defs
  94. */
  95. #define EMMA2RH_IRQ_INT(n) (EMMA2RH_IRQ_BASE + (n))
  96. #define EMMA2RH_IRQ_PFUR0 EMMA2RH_IRQ_INT(49)
  97. #define EMMA2RH_IRQ_PFUR1 EMMA2RH_IRQ_INT(50)
  98. #define EMMA2RH_IRQ_PFUR2 EMMA2RH_IRQ_INT(51)
  99. #define EMMA2RH_IRQ_PIIC0 EMMA2RH_IRQ_INT(56)
  100. #define EMMA2RH_IRQ_PIIC1 EMMA2RH_IRQ_INT(57)
  101. #define EMMA2RH_IRQ_PIIC2 EMMA2RH_IRQ_INT(58)
  102. /*
  103. * EMMA2RH Register Access
  104. */
  105. #define EMMA2RH_BASE (0xa0000000)
  106. static inline void emma2rh_sync(void)
  107. {
  108. volatile u32 *p = (volatile u32 *)0xbfc00000;
  109. (void)(*p);
  110. }
  111. static inline void emma2rh_out32(u32 offset, u32 val)
  112. {
  113. *(volatile u32 *)(EMMA2RH_BASE | offset) = val;
  114. emma2rh_sync();
  115. }
  116. static inline u32 emma2rh_in32(u32 offset)
  117. {
  118. u32 val = *(volatile u32 *)(EMMA2RH_BASE | offset);
  119. return val;
  120. }
  121. static inline void emma2rh_out16(u32 offset, u16 val)
  122. {
  123. *(volatile u16 *)(EMMA2RH_BASE | offset) = val;
  124. emma2rh_sync();
  125. }
  126. static inline u16 emma2rh_in16(u32 offset)
  127. {
  128. u16 val = *(volatile u16 *)(EMMA2RH_BASE | offset);
  129. return val;
  130. }
  131. static inline void emma2rh_out8(u32 offset, u8 val)
  132. {
  133. *(volatile u8 *)(EMMA2RH_BASE | offset) = val;
  134. emma2rh_sync();
  135. }
  136. static inline u8 emma2rh_in8(u32 offset)
  137. {
  138. u8 val = *(volatile u8 *)(EMMA2RH_BASE | offset);
  139. return val;
  140. }
  141. /**
  142. * IIC registers map
  143. **/
  144. /*---------------------------------------------------------------------------*/
  145. /* CNT - Control register (00H R/W) */
  146. /*---------------------------------------------------------------------------*/
  147. #define SPT 0x00000001
  148. #define STT 0x00000002
  149. #define ACKE 0x00000004
  150. #define WTIM 0x00000008
  151. #define SPIE 0x00000010
  152. #define WREL 0x00000020
  153. #define LREL 0x00000040
  154. #define IICE 0x00000080
  155. #define CNT_RESERVED 0x000000ff /* reserved bit 0 */
  156. #define I2C_EMMA_START (IICE | STT)
  157. #define I2C_EMMA_STOP (IICE | SPT)
  158. #define I2C_EMMA_REPSTART I2C_EMMA_START
  159. /*---------------------------------------------------------------------------*/
  160. /* STA - Status register (10H Read) */
  161. /*---------------------------------------------------------------------------*/
  162. #define MSTS 0x00000080
  163. #define ALD 0x00000040
  164. #define EXC 0x00000020
  165. #define COI 0x00000010
  166. #define TRC 0x00000008
  167. #define ACKD 0x00000004
  168. #define STD 0x00000002
  169. #define SPD 0x00000001
  170. /*---------------------------------------------------------------------------*/
  171. /* CSEL - Clock select register (20H R/W) */
  172. /*---------------------------------------------------------------------------*/
  173. #define FCL 0x00000080
  174. #define ND50 0x00000040
  175. #define CLD 0x00000020
  176. #define DAD 0x00000010
  177. #define SMC 0x00000008
  178. #define DFC 0x00000004
  179. #define CL 0x00000003
  180. #define CSEL_RESERVED 0x000000ff /* reserved bit 0 */
  181. #define FAST397 0x0000008b
  182. #define FAST297 0x0000008a
  183. #define FAST347 0x0000000b
  184. #define FAST260 0x0000000a
  185. #define FAST130 0x00000008
  186. #define STANDARD108 0x00000083
  187. #define STANDARD83 0x00000082
  188. #define STANDARD95 0x00000003
  189. #define STANDARD73 0x00000002
  190. #define STANDARD36 0x00000001
  191. #define STANDARD71 0x00000000
  192. /*---------------------------------------------------------------------------*/
  193. /* SVA - Slave address register (30H R/W) */
  194. /*---------------------------------------------------------------------------*/
  195. #define SVA 0x000000fe
  196. /*---------------------------------------------------------------------------*/
  197. /* SHR - Shift register (40H R/W) */
  198. /*---------------------------------------------------------------------------*/
  199. #define SR 0x000000ff
  200. /*---------------------------------------------------------------------------*/
  201. /* INT - Interrupt register (50H R/W) */
  202. /* INTM - Interrupt mask register (60H R/W) */
  203. /*---------------------------------------------------------------------------*/
  204. #define INTE0 0x00000001
  205. /***********************************************************************
  206. * I2C registers
  207. ***********************************************************************
  208. */
  209. #define I2C_EMMA_CNT 0x00
  210. #define I2C_EMMA_STA 0x10
  211. #define I2C_EMMA_CSEL 0x20
  212. #define I2C_EMMA_SVA 0x30
  213. #define I2C_EMMA_SHR 0x40
  214. #define I2C_EMMA_INT 0x50
  215. #define I2C_EMMA_INTM 0x60
  216. /*
  217. * include the board dependent part
  218. */
  219. #ifdef CONFIG_NEC_MARKEINS
  220. #include <asm/emma/markeins.h>
  221. #else
  222. #error "Unknown EMMA2RH board!"
  223. #endif
  224. #endif /* __ASM_EMMA_EMMA2RH_H */