hardware.h 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. #ifndef __HW_S3C4510_H
  2. #define __HW_S3C4510_H
  3. /*
  4. * Copyright (c) 2004 Cucy Systems (http://www.cucy.com)
  5. * Curt Brune <curt@cucy.com>
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. *
  25. * Description: Samsung S3C4510B register layout
  26. */
  27. /*------------------------------------------------------------------------
  28. * ASIC Address Definition
  29. *----------------------------------------------------------------------*/
  30. /* L1 8KB on chip SRAM base address */
  31. #define SRAM_BASE (0x03fe0000)
  32. /* Special Register Start Address After System Reset */
  33. #define REG_BASE (0x03ff0000)
  34. #define SPSTR (REG_BASE)
  35. /* *********************** */
  36. /* System Manager Register */
  37. /* *********************** */
  38. #define REG_SYSCFG (REG_BASE+0x0000)
  39. #define REG_CLKCON (REG_BASE+0x3000)
  40. #define REG_EXTACON0 (REG_BASE+0x3008)
  41. #define REG_EXTACON1 (REG_BASE+0x300c)
  42. #define REG_EXTDBWTH (REG_BASE+0x3010)
  43. #define REG_ROMCON0 (REG_BASE+0x3014)
  44. #define REG_ROMCON1 (REG_BASE+0x3018)
  45. #define REG_ROMCON2 (REG_BASE+0x301c)
  46. #define REG_ROMCON3 (REG_BASE+0x3020)
  47. #define REG_ROMCON4 (REG_BASE+0x3024)
  48. #define REG_ROMCON5 (REG_BASE+0x3028)
  49. #define REG_DRAMCON0 (REG_BASE+0x302c)
  50. #define REG_DRAMCON1 (REG_BASE+0x3030)
  51. #define REG_DRAMCON2 (REG_BASE+0x3034)
  52. #define REG_DRAMCON3 (REG_BASE+0x3038)
  53. #define REG_REFEXTCON (REG_BASE+0x303c)
  54. /* *********************** */
  55. /* Ethernet BDMA Register */
  56. /* *********************** */
  57. #define REG_BDMATXCON (REG_BASE+0x9000)
  58. #define REG_BDMARXCON (REG_BASE+0x9004)
  59. #define REG_BDMATXPTR (REG_BASE+0x9008)
  60. #define REG_BDMARXPTR (REG_BASE+0x900c)
  61. #define REG_BDMARXLSZ (REG_BASE+0x9010)
  62. #define REG_BDMASTAT (REG_BASE+0x9014)
  63. /* Content Address Memory */
  64. #define REG_CAM_BASE (REG_BASE+0x9100)
  65. #define REG_BDMATXBUF (REG_BASE+0x9200)
  66. #define REG_BDMARXBUF (REG_BASE+0x9800)
  67. /* *********************** */
  68. /* Ethernet MAC Register */
  69. /* *********************** */
  70. #define REG_MACCON (REG_BASE+0xa000)
  71. #define REG_CAMCON (REG_BASE+0xa004)
  72. #define REG_MACTXCON (REG_BASE+0xa008)
  73. #define REG_MACTXSTAT (REG_BASE+0xa00c)
  74. #define REG_MACRXCON (REG_BASE+0xa010)
  75. #define REG_MACRXSTAT (REG_BASE+0xa014)
  76. #define REG_STADATA (REG_BASE+0xa018)
  77. #define REG_STACON (REG_BASE+0xa01c)
  78. #define REG_CAMEN (REG_BASE+0xa028)
  79. #define REG_EMISSCNT (REG_BASE+0xa03c)
  80. #define REG_EPZCNT (REG_BASE+0xa040)
  81. #define REG_ERMPZCNT (REG_BASE+0xa044)
  82. #define REG_ETXSTAT (REG_BASE+0x9040)
  83. #define REG_MACRXDESTR (REG_BASE+0xa064)
  84. #define REG_MACRXSTATEM (REG_BASE+0xa090)
  85. #define REG_MACRXFIFO (REG_BASE+0xa200)
  86. /********************/
  87. /* I2C Bus Register */
  88. /********************/
  89. #define REG_I2C_CON (REG_BASE+0xf000)
  90. #define REG_I2C_BUF (REG_BASE+0xf004)
  91. #define REG_I2C_PS (REG_BASE+0xf008)
  92. #define REG_I2C_COUNT (REG_BASE+0xf00c)
  93. /********************/
  94. /* GDMA 0 */
  95. /********************/
  96. #define REG_GDMACON0 (REG_BASE+0xb000)
  97. #define REG_GDMA0_RUN_ENABLE (REG_BASE+0xb020)
  98. #define REG_GDMASRC0 (REG_BASE+0xb004)
  99. #define REG_GDMADST0 (REG_BASE+0xb008)
  100. #define REG_GDMACNT0 (REG_BASE+0xb00c)
  101. /********************/
  102. /* GDMA 1 */
  103. /********************/
  104. #define REG_GDMACON1 (REG_BASE+0xc000)
  105. #define REG_GDMA1_RUN_ENABLE (REG_BASE+0xc020)
  106. #define REG_GDMASRC1 (REG_BASE+0xc004)
  107. #define REG_GDMADST1 (REG_BASE+0xc008)
  108. #define REG_GDMACNT1 (REG_BASE+0xc00c)
  109. /********************/
  110. /* UART 0 */
  111. /********************/
  112. #define UART0_BASE (REG_BASE+0xd000)
  113. #define REG_UART0_LCON (REG_BASE+0xd000)
  114. #define REG_UART0_CTRL (REG_BASE+0xd004)
  115. #define REG_UART0_STAT (REG_BASE+0xd008)
  116. #define REG_UART0_TXB (REG_BASE+0xd00c)
  117. #define REG_UART0_RXB (REG_BASE+0xd010)
  118. #define REG_UART0_BAUD_DIV (REG_BASE+0xd014)
  119. #define REG_UART0_BAUD_CNT (REG_BASE+0xd018)
  120. #define REG_UART0_BAUD_CLK (REG_BASE+0xd01C)
  121. /********************/
  122. /* UART 1 */
  123. /********************/
  124. #define UART1_BASE (REG_BASE+0xe000)
  125. #define REG_UART1_LCON (REG_BASE+0xe000)
  126. #define REG_UART1_CTRL (REG_BASE+0xe004)
  127. #define REG_UART1_STAT (REG_BASE+0xe008)
  128. #define REG_UART1_TXB (REG_BASE+0xe00c)
  129. #define REG_UART1_RXB (REG_BASE+0xe010)
  130. #define REG_UART1_BAUD_DIV (REG_BASE+0xe014)
  131. #define REG_UART1_BAUD_CNT (REG_BASE+0xe018)
  132. #define REG_UART1_BAUD_CLK (REG_BASE+0xe01C)
  133. /********************/
  134. /* Timer Register */
  135. /********************/
  136. #define REG_TMOD (REG_BASE+0x6000)
  137. #define REG_TDATA0 (REG_BASE+0x6004)
  138. #define REG_TDATA1 (REG_BASE+0x6008)
  139. #define REG_TCNT0 (REG_BASE+0x600c)
  140. #define REG_TCNT1 (REG_BASE+0x6010)
  141. /**********************/
  142. /* I/O Port Interface */
  143. /**********************/
  144. #define REG_IOPMODE (REG_BASE+0x5000)
  145. #define REG_IOPCON (REG_BASE+0x5004)
  146. #define REG_IOPDATA (REG_BASE+0x5008)
  147. /*********************************/
  148. /* Interrupt Controller Register */
  149. /*********************************/
  150. #define REG_INTMODE (REG_BASE+0x4000)
  151. #define REG_INTPEND (REG_BASE+0x4004)
  152. #define REG_INTMASK (REG_BASE+0x4008)
  153. #define REG_INTPRI0 (REG_BASE+0x400c)
  154. #define REG_INTPRI1 (REG_BASE+0x4010)
  155. #define REG_INTPRI2 (REG_BASE+0x4014)
  156. #define REG_INTPRI3 (REG_BASE+0x4018)
  157. #define REG_INTPRI4 (REG_BASE+0x401c)
  158. #define REG_INTPRI5 (REG_BASE+0x4020)
  159. #define REG_INTOFFSET (REG_BASE+0x4024)
  160. #define REG_INTPNDPRI (REG_BASE+0x4028)
  161. #define REG_INTPNDTST (REG_BASE+0x402C)
  162. /*********************************/
  163. /* CACHE CONTROL MASKS */
  164. /*********************************/
  165. #define CACHE_STALL (0x00000001)
  166. #define CACHE_ENABLE (0x00000002)
  167. #define CACHE_WRITE_BUFF (0x00000004)
  168. #define CACHE_MODE (0x00000030)
  169. #define CACHE_MODE_00 (0x00000000)
  170. #define CACHE_MODE_01 (0x00000010)
  171. #define CACHE_MODE_10 (0x00000020)
  172. /*********************************/
  173. /* CACHE RAM BASE ADDRESSES */
  174. /*********************************/
  175. #define CACHE_SET0_RAM (0x10000000)
  176. #define CACHE_SET1_RAM (0x10800000)
  177. #define CACHE_TAG_RAM (0x11000000)
  178. /*********************************/
  179. /* CACHE_DISABLE MASK */
  180. /*********************************/
  181. #define CACHE_DISABLE_MASK (0x04000000)
  182. #define GET_REG(reg) (*((volatile u32 *)(reg)))
  183. #define PUT_REG(reg, val) (*((volatile u32 *)(reg)) = ((u32)(val)))
  184. #define SET_REG(reg, mask) (PUT_REG((reg), GET_REG((reg)) | mask))
  185. #define CLR_REG(reg, mask) (PUT_REG((reg), GET_REG((reg)) & ~mask))
  186. #define PUT_U16(reg, val) (*((volatile u16 *)(reg)) = ((u16)(val)))
  187. #define PUT__U8(reg, val) (*((volatile u8 *)(reg)) = (( u8)((val)&0xFF)))
  188. #define GET__U8(reg) (*((volatile u8 *)(reg)))
  189. #define PUT_LED(val) (PUT_REG(REG_IOPDATA, (~val)&0xFF))
  190. #define GET_LED() ((~GET_REG( REG_IOPDATA)) & 0xFF)
  191. #define SET_LED(val) { u32 led = GET_LED(); led |= 1 << (val); PUT_LED( led); }
  192. #define CLR_LED(val) { u32 led = GET_LED(); led &= ~(1 << (val)); PUT_LED( led); }
  193. /***********************************/
  194. /* CLOCK CONSTANTS -- 50 MHz Clock */
  195. /***********************************/
  196. #define CLK_FREQ_MHZ (50)
  197. #define t_data_us(t) ((t)*CLK_FREQ_MHZ-1) /* t is time tick,unit[us] */
  198. #define t_data_ms(t) (t_data_us((t)*1000)) /* t is time tick,unit[ms] */
  199. /*********************************************************/
  200. /* TIMER MODE REGISTER */
  201. /*********************************************************/
  202. #define TM0_RUN 0x01 /* Timer 0 enable */
  203. #define TM0_TOGGLE 0x02 /* 0, interval mode */
  204. #define TM0_OUT_1 0x04 /* Timer 0 Initial TOUT0 value */
  205. #define TM1_RUN 0x08 /* Timer 1 enable */
  206. #define TM1_TOGGLE 0x10 /* 0, interval mode */
  207. #define TM1_OUT_1 0x20 /* Timer 0 Initial TOUT0 value */
  208. /*********************************/
  209. /* INTERRUPT SOURCES */
  210. /*********************************/
  211. #define INT_EXTINT0 0
  212. #define INT_EXTINT1 1
  213. #define INT_EXTINT2 2
  214. #define INT_EXTINT3 3
  215. #define INT_UARTTX0 4
  216. #define INT_UARTRX0 5
  217. #define INT_UARTTX1 6
  218. #define INT_UARTRX1 7
  219. #define INT_GDMA0 8
  220. #define INT_GDMA1 9
  221. #define INT_TIMER0 10
  222. #define INT_TIMER1 11
  223. #define INT_HDLCTXA 12
  224. #define INT_HDLCRXA 13
  225. #define INT_HDLCTXB 14
  226. #define INT_HDLCRXB 15
  227. #define INT_BDMATX 16
  228. #define INT_BDMARX 17
  229. #define INT_MACTX 18
  230. #define INT_MACRX 19
  231. #define INT_IIC 20
  232. #define INT_GLOBAL 21
  233. #define N_IRQS (21)
  234. #ifndef __ASSEMBLER__
  235. struct _irq_handler {
  236. void *m_data;
  237. void (*m_func)( void *data);
  238. };
  239. #endif
  240. #endif /* __S3C4510_h */