regs-serial.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. /* arch/arm/plat-samsung/include/plat/regs-serial.h
  2. *
  3. * From linux/include/asm-arm/hardware/serial_s3c2410.h
  4. *
  5. * Internal header file for Samsung S3C2410 serial ports (UART0-2)
  6. *
  7. * Copyright (C) 2002 Shane Nay (shane@minirl.com)
  8. *
  9. * Additional defines, Copyright 2003 Simtec Electronics (linux@simtec.co.uk)
  10. *
  11. * Adapted from:
  12. *
  13. * Internal header file for MX1ADS serial ports (UART1 & 2)
  14. *
  15. * Copyright (C) 2002 Shane Nay (shane@minirl.com)
  16. *
  17. * This program is free software; you can redistribute it and/or modify
  18. * it under the terms of the GNU General Public License as published by
  19. * the Free Software Foundation; either version 2 of the License, or
  20. * (at your option) any later version.
  21. *
  22. * This program is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. * GNU General Public License for more details.
  26. *
  27. * You should have received a copy of the GNU General Public License
  28. * along with this program; if not, write to the Free Software
  29. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  30. */
  31. #ifndef __ASM_ARM_REGS_SERIAL_H
  32. #define __ASM_ARM_REGS_SERIAL_H
  33. #define S3C24XX_VA_UART0 (S3C_VA_UART)
  34. #define S3C24XX_VA_UART1 (S3C_VA_UART + 0x4000 )
  35. #define S3C24XX_VA_UART2 (S3C_VA_UART + 0x8000 )
  36. #define S3C24XX_VA_UART3 (S3C_VA_UART + 0xC000 )
  37. #define S3C2410_PA_UART0 (S3C24XX_PA_UART)
  38. #define S3C2410_PA_UART1 (S3C24XX_PA_UART + 0x4000 )
  39. #define S3C2410_PA_UART2 (S3C24XX_PA_UART + 0x8000 )
  40. #define S3C2443_PA_UART3 (S3C24XX_PA_UART + 0xC000 )
  41. #define S3C2410_URXH (0x24)
  42. #define S3C2410_UTXH (0x20)
  43. #define S3C2410_ULCON (0x00)
  44. #define S3C2410_UCON (0x04)
  45. #define S3C2410_UFCON (0x08)
  46. #define S3C2410_UMCON (0x0C)
  47. #define S3C2410_UBRDIV (0x28)
  48. #define S3C2410_UTRSTAT (0x10)
  49. #define S3C2410_UERSTAT (0x14)
  50. #define S3C2410_UFSTAT (0x18)
  51. #define S3C2410_UMSTAT (0x1C)
  52. #define S3C2410_LCON_CFGMASK ((0xF<<3)|(0x3))
  53. #define S3C2410_LCON_CS5 (0x0)
  54. #define S3C2410_LCON_CS6 (0x1)
  55. #define S3C2410_LCON_CS7 (0x2)
  56. #define S3C2410_LCON_CS8 (0x3)
  57. #define S3C2410_LCON_CSMASK (0x3)
  58. #define S3C2410_LCON_PNONE (0x0)
  59. #define S3C2410_LCON_PEVEN (0x5 << 3)
  60. #define S3C2410_LCON_PODD (0x4 << 3)
  61. #define S3C2410_LCON_PMASK (0x7 << 3)
  62. #define S3C2410_LCON_STOPB (1<<2)
  63. #define S3C2410_LCON_IRM (1<<6)
  64. #define S3C2440_UCON_CLKMASK (3<<10)
  65. #define S3C2440_UCON_CLKSHIFT (10)
  66. #define S3C2440_UCON_PCLK (0<<10)
  67. #define S3C2440_UCON_UCLK (1<<10)
  68. #define S3C2440_UCON_PCLK2 (2<<10)
  69. #define S3C2440_UCON_FCLK (3<<10)
  70. #define S3C2443_UCON_EPLL (3<<10)
  71. #define S3C6400_UCON_CLKMASK (3<<10)
  72. #define S3C6400_UCON_CLKSHIFT (10)
  73. #define S3C6400_UCON_PCLK (0<<10)
  74. #define S3C6400_UCON_PCLK2 (2<<10)
  75. #define S3C6400_UCON_UCLK0 (1<<10)
  76. #define S3C6400_UCON_UCLK1 (3<<10)
  77. #define S3C2440_UCON2_FCLK_EN (1<<15)
  78. #define S3C2440_UCON0_DIVMASK (15 << 12)
  79. #define S3C2440_UCON1_DIVMASK (15 << 12)
  80. #define S3C2440_UCON2_DIVMASK (7 << 12)
  81. #define S3C2440_UCON_DIVSHIFT (12)
  82. #define S3C2412_UCON_CLKMASK (3<<10)
  83. #define S3C2412_UCON_CLKSHIFT (10)
  84. #define S3C2412_UCON_UCLK (1<<10)
  85. #define S3C2412_UCON_USYSCLK (3<<10)
  86. #define S3C2412_UCON_PCLK (0<<10)
  87. #define S3C2412_UCON_PCLK2 (2<<10)
  88. #define S3C2410_UCON_CLKMASK (1 << 10)
  89. #define S3C2410_UCON_CLKSHIFT (10)
  90. #define S3C2410_UCON_UCLK (1<<10)
  91. #define S3C2410_UCON_SBREAK (1<<4)
  92. #define S3C2410_UCON_TXILEVEL (1<<9)
  93. #define S3C2410_UCON_RXILEVEL (1<<8)
  94. #define S3C2410_UCON_TXIRQMODE (1<<2)
  95. #define S3C2410_UCON_RXIRQMODE (1<<0)
  96. #define S3C2410_UCON_RXFIFO_TOI (1<<7)
  97. #define S3C2443_UCON_RXERR_IRQEN (1<<6)
  98. #define S3C2443_UCON_LOOPBACK (1<<5)
  99. #define S3C2410_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  100. S3C2410_UCON_RXILEVEL | \
  101. S3C2410_UCON_TXIRQMODE | \
  102. S3C2410_UCON_RXIRQMODE | \
  103. S3C2410_UCON_RXFIFO_TOI)
  104. #define S3C2410_UFCON_FIFOMODE (1<<0)
  105. #define S3C2410_UFCON_TXTRIG0 (0<<6)
  106. #define S3C2410_UFCON_RXTRIG8 (1<<4)
  107. #define S3C2410_UFCON_RXTRIG12 (2<<4)
  108. /* S3C2440 FIFO trigger levels */
  109. #define S3C2440_UFCON_RXTRIG1 (0<<4)
  110. #define S3C2440_UFCON_RXTRIG8 (1<<4)
  111. #define S3C2440_UFCON_RXTRIG16 (2<<4)
  112. #define S3C2440_UFCON_RXTRIG32 (3<<4)
  113. #define S3C2440_UFCON_TXTRIG0 (0<<6)
  114. #define S3C2440_UFCON_TXTRIG16 (1<<6)
  115. #define S3C2440_UFCON_TXTRIG32 (2<<6)
  116. #define S3C2440_UFCON_TXTRIG48 (3<<6)
  117. #define S3C2410_UFCON_RESETBOTH (3<<1)
  118. #define S3C2410_UFCON_RESETTX (1<<2)
  119. #define S3C2410_UFCON_RESETRX (1<<1)
  120. #define S3C2410_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  121. S3C2410_UFCON_TXTRIG0 | \
  122. S3C2410_UFCON_RXTRIG8 )
  123. #define S3C2410_UMCOM_AFC (1<<4)
  124. #define S3C2410_UMCOM_RTS_LOW (1<<0)
  125. #define S3C2412_UMCON_AFC_63 (0<<5) /* same as s3c2443 */
  126. #define S3C2412_UMCON_AFC_56 (1<<5)
  127. #define S3C2412_UMCON_AFC_48 (2<<5)
  128. #define S3C2412_UMCON_AFC_40 (3<<5)
  129. #define S3C2412_UMCON_AFC_32 (4<<5)
  130. #define S3C2412_UMCON_AFC_24 (5<<5)
  131. #define S3C2412_UMCON_AFC_16 (6<<5)
  132. #define S3C2412_UMCON_AFC_8 (7<<5)
  133. #define S3C2410_UFSTAT_TXFULL (1<<9)
  134. #define S3C2410_UFSTAT_RXFULL (1<<8)
  135. #define S3C2410_UFSTAT_TXMASK (15<<4)
  136. #define S3C2410_UFSTAT_TXSHIFT (4)
  137. #define S3C2410_UFSTAT_RXMASK (15<<0)
  138. #define S3C2410_UFSTAT_RXSHIFT (0)
  139. /* UFSTAT S3C2443 same as S3C2440 */
  140. #define S3C2440_UFSTAT_TXFULL (1<<14)
  141. #define S3C2440_UFSTAT_RXFULL (1<<6)
  142. #define S3C2440_UFSTAT_TXSHIFT (8)
  143. #define S3C2440_UFSTAT_RXSHIFT (0)
  144. #define S3C2440_UFSTAT_TXMASK (63<<8)
  145. #define S3C2440_UFSTAT_RXMASK (63)
  146. #define S3C2410_UTRSTAT_TXE (1<<2)
  147. #define S3C2410_UTRSTAT_TXFE (1<<1)
  148. #define S3C2410_UTRSTAT_RXDR (1<<0)
  149. #define S3C2410_UERSTAT_OVERRUN (1<<0)
  150. #define S3C2410_UERSTAT_FRAME (1<<2)
  151. #define S3C2410_UERSTAT_BREAK (1<<3)
  152. #define S3C2443_UERSTAT_PARITY (1<<1)
  153. #define S3C2410_UERSTAT_ANY (S3C2410_UERSTAT_OVERRUN | \
  154. S3C2410_UERSTAT_FRAME | \
  155. S3C2410_UERSTAT_BREAK)
  156. #define S3C2410_UMSTAT_CTS (1<<0)
  157. #define S3C2410_UMSTAT_DeltaCTS (1<<2)
  158. #define S3C2443_DIVSLOT (0x2C)
  159. /* S3C64XX interrupt registers. */
  160. #define S3C64XX_UINTP 0x30
  161. #define S3C64XX_UINTSP 0x34
  162. #define S3C64XX_UINTM 0x38
  163. #define S3C64XX_UINTM_RXD (0)
  164. #define S3C64XX_UINTM_TXD (2)
  165. #define S3C64XX_UINTM_RXD_MSK (1 << S3C64XX_UINTM_RXD)
  166. #define S3C64XX_UINTM_TXD_MSK (1 << S3C64XX_UINTM_TXD)
  167. /* Following are specific to S5PV210 */
  168. #define S5PV210_UCON_CLKMASK (1<<10)
  169. #define S5PV210_UCON_CLKSHIFT (10)
  170. #define S5PV210_UCON_PCLK (0<<10)
  171. #define S5PV210_UCON_UCLK (1<<10)
  172. #define S5PV210_UFCON_TXTRIG0 (0<<8)
  173. #define S5PV210_UFCON_TXTRIG4 (1<<8)
  174. #define S5PV210_UFCON_TXTRIG8 (2<<8)
  175. #define S5PV210_UFCON_TXTRIG16 (3<<8)
  176. #define S5PV210_UFCON_TXTRIG32 (4<<8)
  177. #define S5PV210_UFCON_TXTRIG64 (5<<8)
  178. #define S5PV210_UFCON_TXTRIG128 (6<<8)
  179. #define S5PV210_UFCON_TXTRIG256 (7<<8)
  180. #define S5PV210_UFCON_RXTRIG1 (0<<4)
  181. #define S5PV210_UFCON_RXTRIG4 (1<<4)
  182. #define S5PV210_UFCON_RXTRIG8 (2<<4)
  183. #define S5PV210_UFCON_RXTRIG16 (3<<4)
  184. #define S5PV210_UFCON_RXTRIG32 (4<<4)
  185. #define S5PV210_UFCON_RXTRIG64 (5<<4)
  186. #define S5PV210_UFCON_RXTRIG128 (6<<4)
  187. #define S5PV210_UFCON_RXTRIG256 (7<<4)
  188. #define S5PV210_UFSTAT_TXFULL (1<<24)
  189. #define S5PV210_UFSTAT_RXFULL (1<<8)
  190. #define S5PV210_UFSTAT_TXMASK (255<<16)
  191. #define S5PV210_UFSTAT_TXSHIFT (16)
  192. #define S5PV210_UFSTAT_RXMASK (255<<0)
  193. #define S5PV210_UFSTAT_RXSHIFT (0)
  194. #define S3C2410_UCON_CLKSEL0 (1 << 0)
  195. #define S3C2410_UCON_CLKSEL1 (1 << 1)
  196. #define S3C2410_UCON_CLKSEL2 (1 << 2)
  197. #define S3C2410_UCON_CLKSEL3 (1 << 3)
  198. /* Default values for s5pv210 UCON and UFCON uart registers */
  199. #define S5PV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  200. S3C2410_UCON_RXILEVEL | \
  201. S3C2410_UCON_TXIRQMODE | \
  202. S3C2410_UCON_RXIRQMODE | \
  203. S3C2410_UCON_RXFIFO_TOI | \
  204. S3C2443_UCON_RXERR_IRQEN)
  205. #define S5PV210_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  206. S5PV210_UFCON_TXTRIG4 | \
  207. S5PV210_UFCON_RXTRIG4)
  208. #ifndef __ASSEMBLY__
  209. /* configuration structure for per-machine configurations for the
  210. * serial port
  211. *
  212. * the pointer is setup by the machine specific initialisation from the
  213. * arch/arm/mach-s3c2410/ directory.
  214. */
  215. struct s3c2410_uartcfg {
  216. unsigned char hwport; /* hardware port number */
  217. unsigned char unused;
  218. unsigned short flags;
  219. upf_t uart_flags; /* default uart flags */
  220. unsigned int clk_sel;
  221. unsigned int has_fracval;
  222. unsigned long ucon; /* value of ucon for port */
  223. unsigned long ulcon; /* value of ulcon for port */
  224. unsigned long ufcon; /* value of ufcon for port */
  225. };
  226. /* s3c24xx_uart_devs
  227. *
  228. * this is exported from the core as we cannot use driver_register(),
  229. * or platform_add_device() before the console_initcall()
  230. */
  231. extern struct platform_device *s3c24xx_uart_devs[4];
  232. #endif /* __ASSEMBLY__ */
  233. #endif /* __ASM_ARM_REGS_SERIAL_H */