serial_sh.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. /*
  2. * Copy and modify from linux/drivers/serial/sh-sci.h
  3. */
  4. #include <dm/platform_data/serial_sh.h>
  5. struct uart_port {
  6. unsigned long iobase; /* in/out[bwl] */
  7. unsigned char *membase; /* read/write[bwl] */
  8. unsigned long mapbase; /* for ioremap */
  9. enum sh_serial_type type; /* port type */
  10. enum sh_clk_mode clk_mode; /* clock mode */
  11. };
  12. #if defined(CONFIG_H83007) || defined(CONFIG_H83068)
  13. #include <asm/regs306x.h>
  14. #endif
  15. #if defined(CONFIG_H8S2678)
  16. #include <asm/regs267x.h>
  17. #endif
  18. #if defined(CONFIG_CPU_SH7706) || \
  19. defined(CONFIG_CPU_SH7707) || \
  20. defined(CONFIG_CPU_SH7708) || \
  21. defined(CONFIG_CPU_SH7709)
  22. # define SCPCR 0xA4000116 /* 16 bit SCI and SCIF */
  23. # define SCPDR 0xA4000136 /* 8 bit SCI and SCIF */
  24. # define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
  25. #elif defined(CONFIG_CPU_SH7705)
  26. # define SCIF0 0xA4400000
  27. # define SCIF2 0xA4410000
  28. # define SCSMR_Ir 0xA44A0000
  29. # define IRDA_SCIF SCIF0
  30. # define SCPCR 0xA4000116
  31. # define SCPDR 0xA4000136
  32. /* Set the clock source,
  33. * SCIF2 (0xA4410000) -> External clock, SCK pin used as clock input
  34. * SCIF0 (0xA4400000) -> Internal clock, SCK pin as serial clock output
  35. */
  36. # define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0
  37. #elif defined(CONFIG_CPU_SH7720) || \
  38. defined(CONFIG_CPU_SH7721) || \
  39. defined(CONFIG_ARCH_SH7367) || \
  40. defined(CONFIG_ARCH_SH7377) || \
  41. defined(CONFIG_ARCH_SH7372) || \
  42. defined(CONFIG_SH73A0) || \
  43. defined(CONFIG_R8A7740)
  44. # define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */
  45. # define PORT_PTCR 0xA405011EUL
  46. # define PORT_PVCR 0xA4050122UL
  47. # define SCIF_ORER 0x0200 /* overrun error bit */
  48. #elif defined(CONFIG_SH_RTS7751R2D)
  49. # define SCSPTR1 0xFFE0001C /* 8 bit SCIF */
  50. # define SCSPTR2 0xFFE80020 /* 16 bit SCIF */
  51. # define SCIF_ORER 0x0001 /* overrun error bit */
  52. # define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
  53. #elif defined(CONFIG_CPU_SH7750) || \
  54. defined(CONFIG_CPU_SH7750R) || \
  55. defined(CONFIG_CPU_SH7750S) || \
  56. defined(CONFIG_CPU_SH7091) || \
  57. defined(CONFIG_CPU_SH7751) || \
  58. defined(CONFIG_CPU_SH7751R)
  59. # define SCSPTR1 0xffe0001c /* 8 bit SCI */
  60. # define SCSPTR2 0xFFE80020 /* 16 bit SCIF */
  61. # define SCIF_ORER 0x0001 /* overrun error bit */
  62. # define SCSCR_INIT(port) (((port)->type == PORT_SCI) ? \
  63. 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ : \
  64. 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */)
  65. #elif defined(CONFIG_CPU_SH7760)
  66. # define SCSPTR0 0xfe600024 /* 16 bit SCIF */
  67. # define SCSPTR1 0xfe610024 /* 16 bit SCIF */
  68. # define SCSPTR2 0xfe620024 /* 16 bit SCIF */
  69. # define SCIF_ORER 0x0001 /* overrun error bit */
  70. # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
  71. #elif defined(CONFIG_CPU_SH7710) || defined(CONFIG_CPU_SH7712)
  72. # define SCSPTR0 0xA4400000 /* 16 bit SCIF */
  73. # define SCIF_ORER 0x0001 /* overrun error bit */
  74. # define PACR 0xa4050100
  75. # define PBCR 0xa4050102
  76. # define SCSCR_INIT(port) 0x3B
  77. #elif defined(CONFIG_CPU_SH7343)
  78. # define SCSPTR0 0xffe00010 /* 16 bit SCIF */
  79. # define SCSPTR1 0xffe10010 /* 16 bit SCIF */
  80. # define SCSPTR2 0xffe20010 /* 16 bit SCIF */
  81. # define SCSPTR3 0xffe30010 /* 16 bit SCIF */
  82. # define SCSCR_INIT(port) 0x32 /* TIE=0,RIE=0,TE=1,RE=1,REIE=0,CKE=1 */
  83. #elif defined(CONFIG_CPU_SH7722)
  84. # define PADR 0xA4050120
  85. # undef PSDR
  86. # define PSDR 0xA405013e
  87. # define PWDR 0xA4050166
  88. # define PSCR 0xA405011E
  89. # define SCIF_ORER 0x0001 /* overrun error bit */
  90. # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
  91. #elif defined(CONFIG_CPU_SH7366)
  92. # define SCPDR0 0xA405013E /* 16 bit SCIF0 PSDR */
  93. # define SCSPTR0 SCPDR0
  94. # define SCIF_ORER 0x0001 /* overrun error bit */
  95. # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
  96. #elif defined(CONFIG_CPU_SH7723)
  97. # define SCSPTR0 0xa4050160
  98. # define SCSPTR1 0xa405013e
  99. # define SCSPTR2 0xa4050160
  100. # define SCSPTR3 0xa405013e
  101. # define SCSPTR4 0xa4050128
  102. # define SCSPTR5 0xa4050128
  103. # define SCIF_ORER 0x0001 /* overrun error bit */
  104. # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
  105. #elif defined(CONFIG_CPU_SH7724)
  106. # define SCIF_ORER 0x0001 /* overrun error bit */
  107. # define SCSCR_INIT(port) ((port)->type == PORT_SCIFA ? \
  108. 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ : \
  109. 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */)
  110. #elif defined(CONFIG_CPU_SH7734)
  111. # define SCSPTR0 0xFFE40020
  112. # define SCSPTR1 0xFFE41020
  113. # define SCSPTR2 0xFFE42020
  114. # define SCSPTR3 0xFFE43020
  115. # define SCSPTR4 0xFFE44020
  116. # define SCSPTR5 0xFFE45020
  117. # define SCIF_ORER 0x0001 /* overrun error bit */
  118. # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
  119. #elif defined(CONFIG_CPU_SH4_202)
  120. # define SCSPTR2 0xffe80020 /* 16 bit SCIF */
  121. # define SCIF_ORER 0x0001 /* overrun error bit */
  122. # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
  123. #elif defined(CONFIG_CPU_SH5_101) || defined(CONFIG_CPU_SH5_103)
  124. # define SCIF_BASE_ADDR 0x01030000
  125. # define SCIF_ADDR_SH5 (PHYS_PERIPHERAL_BLOCK+SCIF_BASE_ADDR)
  126. # define SCIF_PTR2_OFFS 0x0000020
  127. # define SCIF_LSR2_OFFS 0x0000024
  128. # define SCSPTR\
  129. ((port->mapbase)+SCIF_PTR2_OFFS) /* 16 bit SCIF */
  130. # define SCLSR2\
  131. ((port->mapbase)+SCIF_LSR2_OFFS) /* 16 bit SCIF */
  132. # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0, TE=1,RE=1,REIE=1 */
  133. #elif defined(CONFIG_H83007) || defined(CONFIG_H83068)
  134. # define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
  135. # define H8300_SCI_DR(ch) (*(volatile char *)(P1DR + h8300_sci_pins[ch].port))
  136. #elif defined(CONFIG_H8S2678)
  137. # define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
  138. # define H8300_SCI_DR(ch) (*(volatile char *)(P1DR + h8300_sci_pins[ch].port))
  139. #elif defined(CONFIG_CPU_SH7757) || \
  140. defined(CONFIG_CPU_SH7752) || \
  141. defined(CONFIG_CPU_SH7753)
  142. # define SCSPTR0 0xfe4b0020
  143. # define SCSPTR1 0xfe4b0020
  144. # define SCSPTR2 0xfe4b0020
  145. # define SCIF_ORER 0x0001
  146. # define SCSCR_INIT(port) 0x38
  147. # define SCIF_ONLY
  148. #elif defined(CONFIG_CPU_SH7763)
  149. # define SCSPTR0 0xffe00024 /* 16 bit SCIF */
  150. # define SCSPTR1 0xffe08024 /* 16 bit SCIF */
  151. # define SCSPTR2 0xffe10020 /* 16 bit SCIF/IRDA */
  152. # define SCIF_ORER 0x0001 /* overrun error bit */
  153. # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
  154. #elif defined(CONFIG_CPU_SH7770)
  155. # define SCSPTR0 0xff923020 /* 16 bit SCIF */
  156. # define SCSPTR1 0xff924020 /* 16 bit SCIF */
  157. # define SCSPTR2 0xff925020 /* 16 bit SCIF */
  158. # define SCIF_ORER 0x0001 /* overrun error bit */
  159. # define SCSCR_INIT(port) 0x3c /* TIE=0,RIE=0,TE=1,RE=1,REIE=1,cke=2 */
  160. #elif defined(CONFIG_CPU_SH7780)
  161. # define SCSPTR0 0xffe00024 /* 16 bit SCIF */
  162. # define SCSPTR1 0xffe10024 /* 16 bit SCIF */
  163. # define SCIF_ORER 0x0001 /* Overrun error bit */
  164. #if defined(CONFIG_SH_SH2007)
  165. /* TIE=0,RIE=0,TE=1,RE=1,REIE=1,CKE1=0 */
  166. # define SCSCR_INIT(port) 0x38
  167. #else
  168. /* TIE=0,RIE=0,TE=1,RE=1,REIE=1,CKE1=1 */
  169. # define SCSCR_INIT(port) 0x3a
  170. #endif
  171. #elif defined(CONFIG_CPU_SH7785) || \
  172. defined(CONFIG_CPU_SH7786)
  173. # define SCSPTR0 0xffea0024 /* 16 bit SCIF */
  174. # define SCSPTR1 0xffeb0024 /* 16 bit SCIF */
  175. # define SCSPTR2 0xffec0024 /* 16 bit SCIF */
  176. # define SCSPTR3 0xffed0024 /* 16 bit SCIF */
  177. # define SCSPTR4 0xffee0024 /* 16 bit SCIF */
  178. # define SCSPTR5 0xffef0024 /* 16 bit SCIF */
  179. # define SCIF_ORER 0x0001 /* Overrun error bit */
  180. # define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
  181. #elif defined(CONFIG_CPU_SH7201) || \
  182. defined(CONFIG_CPU_SH7203) || \
  183. defined(CONFIG_CPU_SH7206) || \
  184. defined(CONFIG_CPU_SH7263) || \
  185. defined(CONFIG_CPU_SH7264)
  186. # define SCSPTR0 0xfffe8020 /* 16 bit SCIF */
  187. # define SCSPTR1 0xfffe8820 /* 16 bit SCIF */
  188. # define SCSPTR2 0xfffe9020 /* 16 bit SCIF */
  189. # define SCSPTR3 0xfffe9820 /* 16 bit SCIF */
  190. # if defined(CONFIG_CPU_SH7201)
  191. # define SCSPTR4 0xfffeA020 /* 16 bit SCIF */
  192. # define SCSPTR5 0xfffeA820 /* 16 bit SCIF */
  193. # define SCSPTR6 0xfffeB020 /* 16 bit SCIF */
  194. # define SCSPTR7 0xfffeB820 /* 16 bit SCIF */
  195. # endif
  196. # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
  197. #elif defined(CONFIG_CPU_SH7269)
  198. # define SCSPTR0 0xe8007020 /* 16 bit SCIF */
  199. # define SCSPTR1 0xe8007820 /* 16 bit SCIF */
  200. # define SCSPTR2 0xe8008020 /* 16 bit SCIF */
  201. # define SCSPTR3 0xe8008820 /* 16 bit SCIF */
  202. # define SCSPTR4 0xe8009020 /* 16 bit SCIF */
  203. # define SCSPTR5 0xe8009820 /* 16 bit SCIF */
  204. # define SCSPTR6 0xe800a020 /* 16 bit SCIF */
  205. # define SCSPTR7 0xe800a820 /* 16 bit SCIF */
  206. # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
  207. #elif defined(CONFIG_CPU_SH7619)
  208. # define SCSPTR0 0xf8400020 /* 16 bit SCIF */
  209. # define SCSPTR1 0xf8410020 /* 16 bit SCIF */
  210. # define SCSPTR2 0xf8420020 /* 16 bit SCIF */
  211. # define SCIF_ORER 0x0001 /* overrun error bit */
  212. # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
  213. #elif defined(CONFIG_CPU_SHX3)
  214. # define SCSPTR0 0xffc30020 /* 16 bit SCIF */
  215. # define SCSPTR1 0xffc40020 /* 16 bit SCIF */
  216. # define SCSPTR2 0xffc50020 /* 16 bit SCIF */
  217. # define SCSPTR3 0xffc60020 /* 16 bit SCIF */
  218. # define SCIF_ORER 0x0001 /* Overrun error bit */
  219. # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
  220. #elif defined(CONFIG_RCAR_GEN2) || defined(CONFIG_RCAR_GEN3) || \
  221. defined(CONFIG_R7S72100)
  222. # if defined(CONFIG_SCIF_A)
  223. # define SCIF_ORER 0x0200
  224. # else
  225. # define SCIF_ORER 0x0001
  226. # endif
  227. # define SCSCR_INIT(port) (port->clk_mode == EXT_CLK ? 0x32 : 0x30)
  228. /* TIE=0,RIE=0,TE=1,RE=1,REIE=0, */
  229. #else
  230. # error CPU subtype not defined
  231. #endif
  232. /* SCSCR */
  233. #define SCI_CTRL_FLAGS_TIE 0x80 /* all */
  234. #define SCI_CTRL_FLAGS_RIE 0x40 /* all */
  235. #define SCI_CTRL_FLAGS_TE 0x20 /* all */
  236. #define SCI_CTRL_FLAGS_RE 0x10 /* all */
  237. #if defined(CONFIG_CPU_SH7750) || \
  238. defined(CONFIG_CPU_SH7091) || \
  239. defined(CONFIG_CPU_SH7750R) || \
  240. defined(CONFIG_CPU_SH7722) || \
  241. defined(CONFIG_CPU_SH7734) || \
  242. defined(CONFIG_CPU_SH7750S) || \
  243. defined(CONFIG_CPU_SH7751) || \
  244. defined(CONFIG_CPU_SH7751R) || \
  245. defined(CONFIG_CPU_SH7763) || \
  246. defined(CONFIG_CPU_SH7780) || \
  247. defined(CONFIG_CPU_SH7785) || \
  248. defined(CONFIG_CPU_SH7786) || \
  249. defined(CONFIG_CPU_SHX3)
  250. #define SCI_CTRL_FLAGS_REIE 0x08 /* 7750 SCIF */
  251. #elif defined(CONFIG_CPU_SH7724)
  252. #define SCI_CTRL_FLAGS_REIE ((port)->type == PORT_SCIFA ? 0 : 8)
  253. #else
  254. #define SCI_CTRL_FLAGS_REIE 0
  255. #endif
  256. /* SCI_CTRL_FLAGS_MPIE 0x08 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
  257. /* SCI_CTRL_FLAGS_TEIE 0x04 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
  258. /* SCI_CTRL_FLAGS_CKE1 0x02 * all */
  259. /* SCI_CTRL_FLAGS_CKE0 0x01 * 7707 SCI/SCIF, 7708 SCI, 7709 SCI/SCIF, 7750 SCI */
  260. /* SCxSR SCI */
  261. #define SCI_TDRE 0x80 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
  262. #define SCI_RDRF 0x40 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
  263. #define SCI_ORER 0x20 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
  264. #define SCI_FER 0x10 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
  265. #define SCI_PER 0x08 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
  266. #define SCI_TEND 0x04 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
  267. /* SCI_MPB 0x02 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
  268. /* SCI_MPBT 0x01 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
  269. #define SCI_ERRORS ( SCI_PER | SCI_FER | SCI_ORER)
  270. /* SCxSR SCIF */
  271. #define SCIF_ER 0x0080 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
  272. #define SCIF_TEND 0x0040 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
  273. #define SCIF_TDFE 0x0020 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
  274. #define SCIF_BRK 0x0010 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
  275. #define SCIF_FER 0x0008 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
  276. #define SCIF_PER 0x0004 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
  277. #define SCIF_RDF 0x0002 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
  278. #define SCIF_DR 0x0001 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
  279. #if defined(CONFIG_CPU_SH7705) || \
  280. defined(CONFIG_CPU_SH7720) || \
  281. defined(CONFIG_CPU_SH7721) || \
  282. defined(CONFIG_ARCH_SH7367) || \
  283. defined(CONFIG_ARCH_SH7377) || \
  284. defined(CONFIG_ARCH_SH7372) || \
  285. defined(CONFIG_SH73A0) || \
  286. defined(CONFIG_R8A7740)
  287. # define SCIF_ORER 0x0200
  288. # define SCIF_ERRORS (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER)
  289. # define SCIF_RFDC_MASK 0x007f
  290. # define SCIF_TXROOM_MAX 64
  291. #elif defined(CONFIG_CPU_SH7763)
  292. # define SCIF_ERRORS (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
  293. # define SCIF_RFDC_MASK 0x007f
  294. # define SCIF_TXROOM_MAX 64
  295. /* SH7763 SCIF2 support */
  296. # define SCIF2_RFDC_MASK 0x001f
  297. # define SCIF2_TXROOM_MAX 16
  298. #elif defined(CONFIG_RCAR_GEN2)
  299. # define SCIF_ERRORS (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
  300. # if defined(CONFIG_SCIF_A)
  301. # define SCIF_RFDC_MASK 0x007f
  302. # else
  303. # define SCIF_RFDC_MASK 0x001f
  304. # endif
  305. #else
  306. # define SCIF_ERRORS (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
  307. # define SCIF_RFDC_MASK 0x001f
  308. # define SCIF_TXROOM_MAX 16
  309. #endif
  310. #ifndef SCIF_ORER
  311. #define SCIF_ORER 0x0000
  312. #endif
  313. #define SCxSR_TEND(port)\
  314. (((port)->type == PORT_SCI) ? SCI_TEND : SCIF_TEND)
  315. #define SCxSR_ERRORS(port)\
  316. (((port)->type == PORT_SCI) ? SCI_ERRORS : SCIF_ERRORS)
  317. #define SCxSR_RDxF(port)\
  318. (((port)->type == PORT_SCI) ? SCI_RDRF : SCIF_RDF)
  319. #define SCxSR_TDxE(port)\
  320. (((port)->type == PORT_SCI) ? SCI_TDRE : SCIF_TDFE)
  321. #define SCxSR_FER(port)\
  322. (((port)->type == PORT_SCI) ? SCI_FER : SCIF_FER)
  323. #define SCxSR_PER(port)\
  324. (((port)->type == PORT_SCI) ? SCI_PER : SCIF_PER)
  325. #define SCxSR_BRK(port)\
  326. ((port)->type == PORT_SCI) ? 0x00 : SCIF_BRK)
  327. #define SCxSR_ORER(port)\
  328. (((port)->type == PORT_SCI) ? SCI_ORER : SCIF_ORER)
  329. #if defined(CONFIG_CPU_SH7705) || \
  330. defined(CONFIG_CPU_SH7720) || \
  331. defined(CONFIG_CPU_SH7721) || \
  332. defined(CONFIG_ARCH_SH7367) || \
  333. defined(CONFIG_ARCH_SH7377) || \
  334. defined(CONFIG_ARCH_SH7372) || \
  335. defined(CONFIG_SH73A0) || \
  336. defined(CONFIG_R8A7740)
  337. # define SCxSR_RDxF_CLEAR(port) (sci_in(port, SCxSR) & 0xfffc)
  338. # define SCxSR_ERROR_CLEAR(port) (sci_in(port, SCxSR) & 0xfd73)
  339. # define SCxSR_TDxE_CLEAR(port) (sci_in(port, SCxSR) & 0xffdf)
  340. # define SCxSR_BREAK_CLEAR(port) (sci_in(port, SCxSR) & 0xffe3)
  341. #else
  342. # define SCxSR_RDxF_CLEAR(port) (((port)->type == PORT_SCI) ? 0xbc : 0x00fc)
  343. # define SCxSR_ERROR_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x0073)
  344. # define SCxSR_TDxE_CLEAR(port) (((port)->type == PORT_SCI) ? 0x78 : 0x00df)
  345. # define SCxSR_BREAK_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x00e3)
  346. #endif
  347. /* SCFCR */
  348. #define SCFCR_RFRST 0x0002
  349. #define SCFCR_TFRST 0x0004
  350. #define SCFCR_TCRST 0x4000
  351. #define SCFCR_MCE 0x0008
  352. #define SCI_MAJOR 204
  353. #define SCI_MINOR_START 8
  354. /* Generic serial flags */
  355. #define SCI_RX_THROTTLE 0x0000001
  356. #define SCI_MAGIC 0xbabeface
  357. /*
  358. * Events are used to schedule things to happen at timer-interrupt
  359. * time, instead of at rs interrupt time.
  360. */
  361. #define SCI_EVENT_WRITE_WAKEUP 0
  362. #define SCI_IN(size, offset)\
  363. if ((size) == 8) {\
  364. return readb(port->membase + (offset));\
  365. } else {\
  366. return readw(port->membase + (offset));\
  367. }
  368. #define SCI_OUT(size, offset, value)\
  369. if ((size) == 8) {\
  370. writeb(value, port->membase + (offset));\
  371. } else if ((size) == 16) {\
  372. writew(value, port->membase + (offset));\
  373. }
  374. #define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\
  375. static inline unsigned int sci_##name##_in(struct uart_port *port) {\
  376. if (port->type == PORT_SCIF || port->type == PORT_SCIFB) {\
  377. SCI_IN(scif_size, scif_offset)\
  378. } else { /* PORT_SCI or PORT_SCIFA */\
  379. SCI_IN(sci_size, sci_offset);\
  380. }\
  381. }\
  382. static inline void sci_##name##_out(struct uart_port *port,\
  383. unsigned int value) {\
  384. if (port->type == PORT_SCIF || port->type == PORT_SCIFB) {\
  385. SCI_OUT(scif_size, scif_offset, value)\
  386. } else { /* PORT_SCI or PORT_SCIFA */\
  387. SCI_OUT(sci_size, sci_offset, value);\
  388. }\
  389. }
  390. #ifdef CONFIG_H8300
  391. /* h8300 don't have SCIF */
  392. #define CPU_SCIF_FNS(name) \
  393. static inline unsigned int sci_##name##_in(struct uart_port *port) {\
  394. return 0;\
  395. }\
  396. static inline void sci_##name##_out(struct uart_port *port,\
  397. unsigned int value) {\
  398. }
  399. #else
  400. #define CPU_SCIF_FNS(name, scif_offset, scif_size) \
  401. static inline unsigned int sci_##name##_in(struct uart_port *port) {\
  402. SCI_IN(scif_size, scif_offset);\
  403. }\
  404. static inline void sci_##name##_out(struct uart_port *port,\
  405. unsigned int value) {\
  406. SCI_OUT(scif_size, scif_offset, value);\
  407. }
  408. #endif
  409. #define CPU_SCI_FNS(name, sci_offset, sci_size)\
  410. static inline unsigned int sci_##name##_in(struct uart_port *port) {\
  411. SCI_IN(sci_size, sci_offset);\
  412. }\
  413. static inline void sci_##name##_out(struct uart_port *port,\
  414. unsigned int value) {\
  415. SCI_OUT(sci_size, sci_offset, value);\
  416. }
  417. #if defined(CONFIG_CPU_SH3) || \
  418. defined(CONFIG_ARCH_SH7367) || \
  419. defined(CONFIG_ARCH_SH7377) || \
  420. defined(CONFIG_ARCH_SH7372) || \
  421. defined(CONFIG_SH73A0) || \
  422. defined(CONFIG_R8A7740)
  423. #if defined(CONFIG_CPU_SH7710) || defined(CONFIG_CPU_SH7712)
  424. #define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size,\
  425. sh4_sci_offset, sh4_sci_size, \
  426. sh3_scif_offset, sh3_scif_size, \
  427. sh4_scif_offset, sh4_scif_size, \
  428. h8_sci_offset, h8_sci_size) \
  429. CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size,\
  430. sh4_scif_offset, sh4_scif_size)
  431. #define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size,\
  432. sh4_scif_offset, sh4_scif_size) \
  433. CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
  434. #elif defined(CONFIG_CPU_SH7705) || \
  435. defined(CONFIG_CPU_SH7720) || \
  436. defined(CONFIG_CPU_SH7721) || \
  437. defined(CONFIG_ARCH_SH7367) || \
  438. defined(CONFIG_ARCH_SH7377) || \
  439. defined(CONFIG_SH73A0)
  440. #define SCIF_FNS(name, scif_offset, scif_size) \
  441. CPU_SCIF_FNS(name, scif_offset, scif_size)
  442. #elif defined(CONFIG_ARCH_SH7372) || \
  443. defined(CONFIG_R8A7740)
  444. #define SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size,\
  445. sh4_scifb_offset, sh4_scifb_size) \
  446. CPU_SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size,\
  447. sh4_scifb_offset, sh4_scifb_size)
  448. #define SCIF_FNS(name, scif_offset, scif_size) \
  449. CPU_SCIF_FNS(name, scif_offset, scif_size)
  450. #else
  451. #define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size,\
  452. sh4_sci_offset, sh4_sci_size, \
  453. sh3_scif_offset, sh3_scif_size,\
  454. sh4_scif_offset, sh4_scif_size, \
  455. h8_sci_offset, h8_sci_size) \
  456. CPU_SCIx_FNS(name, sh3_sci_offset, sh3_sci_size,\
  457. sh3_scif_offset, sh3_scif_size)
  458. #define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size,\
  459. sh4_scif_offset, sh4_scif_size) \
  460. CPU_SCIF_FNS(name, sh3_scif_offset, sh3_scif_size)
  461. #endif
  462. #elif defined(__H8300H__) || defined(__H8300S__)
  463. #define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size,\
  464. sh4_sci_offset, sh4_sci_size, \
  465. sh3_scif_offset, sh3_scif_size,\
  466. sh4_scif_offset, sh4_scif_size, \
  467. h8_sci_offset, h8_sci_size) \
  468. CPU_SCI_FNS(name, h8_sci_offset, h8_sci_size)
  469. #define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size,\
  470. sh4_scif_offset, sh4_scif_size) \
  471. CPU_SCIF_FNS(name)
  472. #elif defined(CONFIG_CPU_SH7723) || defined(CONFIG_CPU_SH7724)
  473. #define SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size,\
  474. sh4_scif_offset, sh4_scif_size) \
  475. CPU_SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size,\
  476. sh4_scif_offset, sh4_scif_size)
  477. #define SCIF_FNS(name, sh4_scif_offset, sh4_scif_size) \
  478. CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
  479. #else
  480. #define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size,\
  481. sh4_sci_offset, sh4_sci_size, \
  482. sh3_scif_offset, sh3_scif_size,\
  483. sh4_scif_offset, sh4_scif_size, \
  484. h8_sci_offset, h8_sci_size) \
  485. CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size,\
  486. sh4_scif_offset, sh4_scif_size)
  487. #define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, \
  488. sh4_scif_offset, sh4_scif_size) \
  489. CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
  490. #endif
  491. #if defined(CONFIG_CPU_SH7705) || \
  492. defined(CONFIG_CPU_SH7720) || \
  493. defined(CONFIG_CPU_SH7721) || \
  494. defined(CONFIG_ARCH_SH7367) || \
  495. defined(CONFIG_ARCH_SH7377) || \
  496. defined(CONFIG_SH73A0)
  497. SCIF_FNS(SCSMR, 0x00, 16)
  498. SCIF_FNS(SCBRR, 0x04, 8)
  499. SCIF_FNS(SCSCR, 0x08, 16)
  500. SCIF_FNS(SCTDSR, 0x0c, 8)
  501. SCIF_FNS(SCFER, 0x10, 16)
  502. SCIF_FNS(SCxSR, 0x14, 16)
  503. SCIF_FNS(SCFCR, 0x18, 16)
  504. SCIF_FNS(SCFDR, 0x1c, 16)
  505. SCIF_FNS(SCxTDR, 0x20, 8)
  506. SCIF_FNS(SCxRDR, 0x24, 8)
  507. SCIF_FNS(SCLSR, 0x00, 0)
  508. SCIF_FNS(DL, 0x00, 0) /* dummy */
  509. #elif defined(CONFIG_ARCH_SH7372) || \
  510. defined(CONFIG_R8A7740)
  511. SCIF_FNS(SCSMR, 0x00, 16)
  512. SCIF_FNS(SCBRR, 0x04, 8)
  513. SCIF_FNS(SCSCR, 0x08, 16)
  514. SCIF_FNS(SCTDSR, 0x0c, 16)
  515. SCIF_FNS(SCFER, 0x10, 16)
  516. SCIF_FNS(SCxSR, 0x14, 16)
  517. SCIF_FNS(SCFCR, 0x18, 16)
  518. SCIF_FNS(SCFDR, 0x1c, 16)
  519. SCIF_FNS(SCTFDR, 0x38, 16)
  520. SCIF_FNS(SCRFDR, 0x3c, 16)
  521. SCIx_FNS(SCxTDR, 0x20, 8, 0x40, 8)
  522. SCIx_FNS(SCxRDR, 0x24, 8, 0x60, 8)
  523. SCIF_FNS(SCLSR, 0x00, 0)
  524. SCIF_FNS(DL, 0x00, 0) /* dummy */
  525. #elif defined(CONFIG_CPU_SH7723) ||\
  526. defined(CONFIG_CPU_SH7724)
  527. SCIx_FNS(SCSMR, 0x00, 16, 0x00, 16)
  528. SCIx_FNS(SCBRR, 0x04, 8, 0x04, 8)
  529. SCIx_FNS(SCSCR, 0x08, 16, 0x08, 16)
  530. SCIx_FNS(SCxTDR, 0x20, 8, 0x0c, 8)
  531. SCIx_FNS(SCxSR, 0x14, 16, 0x10, 16)
  532. SCIx_FNS(SCxRDR, 0x24, 8, 0x14, 8)
  533. SCIx_FNS(SCSPTR, 0, 0, 0, 0)
  534. SCIF_FNS(SCTDSR, 0x0c, 8)
  535. SCIF_FNS(SCFER, 0x10, 16)
  536. SCIF_FNS(SCFCR, 0x18, 16)
  537. SCIF_FNS(SCFDR, 0x1c, 16)
  538. SCIF_FNS(SCLSR, 0x24, 16)
  539. SCIF_FNS(DL, 0x00, 0) /* dummy */
  540. #elif defined(CONFIG_RCAR_GEN2)
  541. /* SCIFA and SCIF register offsets and size */
  542. SCIx_FNS(SCSMR, 0, 0, 0x00, 16, 0, 0, 0x00, 16, 0, 0)
  543. SCIx_FNS(SCBRR, 0, 0, 0x04, 8, 0, 0, 0x04, 8, 0, 0)
  544. SCIx_FNS(SCSCR, 0, 0, 0x08, 16, 0, 0, 0x08, 16, 0, 0)
  545. SCIx_FNS(SCxTDR, 0, 0, 0x20, 8, 0, 0, 0x0C, 8, 0, 0)
  546. SCIx_FNS(SCxSR, 0, 0, 0x14, 16, 0, 0, 0x10, 16, 0, 0)
  547. SCIx_FNS(SCxRDR, 0, 0, 0x24, 8, 0, 0, 0x14, 8, 0, 0)
  548. SCIF_FNS(SCFCR, 0, 0, 0x18, 16)
  549. SCIF_FNS(SCFDR, 0, 0, 0x1C, 16)
  550. SCIF_FNS(SCSPTR, 0, 0, 0x20, 16)
  551. SCIF_FNS(DL, 0, 0, 0x30, 16)
  552. SCIF_FNS(CKS, 0, 0, 0x34, 16)
  553. #if defined(CONFIG_SCIF_A)
  554. SCIF_FNS(SCLSR, 0, 0, 0x14, 16)
  555. #else
  556. SCIF_FNS(SCLSR, 0, 0, 0x24, 16)
  557. #endif
  558. #else
  559. /* reg SCI/SH3 SCI/SH4 SCIF/SH3 SCIF/SH4 SCI/H8*/
  560. /* name off sz off sz off sz off sz off sz*/
  561. SCIx_FNS(SCSMR, 0x00, 8, 0x00, 8, 0x00, 8, 0x00, 16, 0x00, 8)
  562. SCIx_FNS(SCBRR, 0x02, 8, 0x04, 8, 0x02, 8, 0x04, 8, 0x01, 8)
  563. SCIx_FNS(SCSCR, 0x04, 8, 0x08, 8, 0x04, 8, 0x08, 16, 0x02, 8)
  564. SCIx_FNS(SCxTDR, 0x06, 8, 0x0c, 8, 0x06, 8, 0x0C, 8, 0x03, 8)
  565. SCIx_FNS(SCxSR, 0x08, 8, 0x10, 8, 0x08, 16, 0x10, 16, 0x04, 8)
  566. SCIx_FNS(SCxRDR, 0x0a, 8, 0x14, 8, 0x0A, 8, 0x14, 8, 0x05, 8)
  567. SCIF_FNS(SCFCR, 0x0c, 8, 0x18, 16)
  568. #if defined(CONFIG_CPU_SH7760) || \
  569. defined(CONFIG_CPU_SH7780) || \
  570. defined(CONFIG_CPU_SH7785) || \
  571. defined(CONFIG_CPU_SH7786)
  572. SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16)
  573. SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16)
  574. SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16)
  575. SCIF_FNS(SCSPTR, 0, 0, 0x24, 16)
  576. SCIF_FNS(SCLSR, 0, 0, 0x28, 16)
  577. #elif defined(CONFIG_CPU_SH7763)
  578. SCIF_FNS(SCFDR, 0, 0, 0x1C, 16)
  579. SCIF_FNS(SCSPTR2, 0, 0, 0x20, 16)
  580. SCIF_FNS(SCLSR2, 0, 0, 0x24, 16)
  581. SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16)
  582. SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16)
  583. SCIF_FNS(SCSPTR, 0, 0, 0x24, 16)
  584. SCIF_FNS(SCLSR, 0, 0, 0x28, 16)
  585. #else
  586. SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16)
  587. #if defined(CONFIG_CPU_SH7722)
  588. SCIF_FNS(SCSPTR, 0, 0, 0, 0)
  589. #else
  590. SCIF_FNS(SCSPTR, 0, 0, 0x20, 16)
  591. #endif
  592. SCIF_FNS(SCLSR, 0, 0, 0x24, 16)
  593. #endif
  594. SCIF_FNS(DL, 0, 0, 0x0, 0) /* dummy */
  595. #endif
  596. #define sci_in(port, reg) sci_##reg##_in(port)
  597. #define sci_out(port, reg, value) sci_##reg##_out(port, value)
  598. /* H8/300 series SCI pins assignment */
  599. #if defined(__H8300H__) || defined(__H8300S__)
  600. static const struct __attribute__((packed)) {
  601. int port; /* GPIO port no */
  602. unsigned short rx, tx; /* GPIO bit no */
  603. } h8300_sci_pins[] = {
  604. #if defined(CONFIG_H83007) || defined(CONFIG_H83068)
  605. { /* SCI0 */
  606. .port = H8300_GPIO_P9,
  607. .rx = H8300_GPIO_B2,
  608. .tx = H8300_GPIO_B0,
  609. },
  610. { /* SCI1 */
  611. .port = H8300_GPIO_P9,
  612. .rx = H8300_GPIO_B3,
  613. .tx = H8300_GPIO_B1,
  614. },
  615. { /* SCI2 */
  616. .port = H8300_GPIO_PB,
  617. .rx = H8300_GPIO_B7,
  618. .tx = H8300_GPIO_B6,
  619. }
  620. #elif defined(CONFIG_H8S2678)
  621. { /* SCI0 */
  622. .port = H8300_GPIO_P3,
  623. .rx = H8300_GPIO_B2,
  624. .tx = H8300_GPIO_B0,
  625. },
  626. { /* SCI1 */
  627. .port = H8300_GPIO_P3,
  628. .rx = H8300_GPIO_B3,
  629. .tx = H8300_GPIO_B1,
  630. },
  631. { /* SCI2 */
  632. .port = H8300_GPIO_P5,
  633. .rx = H8300_GPIO_B1,
  634. .tx = H8300_GPIO_B0,
  635. }
  636. #endif
  637. };
  638. #endif
  639. #if defined(CONFIG_CPU_SH7706) || \
  640. defined(CONFIG_CPU_SH7707) || \
  641. defined(CONFIG_CPU_SH7708) || \
  642. defined(CONFIG_CPU_SH7709)
  643. static inline int sci_rxd_in(struct uart_port *port)
  644. {
  645. if (port->mapbase == 0xfffffe80)
  646. return __raw_readb(SCPDR)&0x01 ? 1 : 0; /* SCI */
  647. return 1;
  648. }
  649. #elif defined(CONFIG_CPU_SH7750) || \
  650. defined(CONFIG_CPU_SH7751) || \
  651. defined(CONFIG_CPU_SH7751R) || \
  652. defined(CONFIG_CPU_SH7750R) || \
  653. defined(CONFIG_CPU_SH7750S) || \
  654. defined(CONFIG_CPU_SH7091)
  655. static inline int sci_rxd_in(struct uart_port *port)
  656. {
  657. if (port->mapbase == 0xffe00000)
  658. return __raw_readb(SCSPTR1)&0x01 ? 1 : 0; /* SCI */
  659. return 1;
  660. }
  661. #elif defined(__H8300H__) || defined(__H8300S__)
  662. static inline int sci_rxd_in(struct uart_port *port)
  663. {
  664. int ch = (port->mapbase - SMR0) >> 3;
  665. return (H8300_SCI_DR(ch) & h8300_sci_pins[ch].rx) ? 1 : 0;
  666. }
  667. #else /* default case for non-SCI processors */
  668. static inline int sci_rxd_in(struct uart_port *port)
  669. {
  670. return 1;
  671. }
  672. #endif
  673. /*
  674. * Values for the BitRate Register (SCBRR)
  675. *
  676. * The values are actually divisors for a frequency which can
  677. * be internal to the SH3 (14.7456MHz) or derived from an external
  678. * clock source. This driver assumes the internal clock is used;
  679. * to support using an external clock source, config options or
  680. * possibly command-line options would need to be added.
  681. *
  682. * Also, to support speeds below 2400 (why?) the lower 2 bits of
  683. * the SCSMR register would also need to be set to non-zero values.
  684. *
  685. * -- Greg Banks 27Feb2000
  686. *
  687. * Answer: The SCBRR register is only eight bits, and the value in
  688. * it gets larger with lower baud rates. At around 2400 (depending on
  689. * the peripherial module clock) you run out of bits. However the
  690. * lower two bits of SCSMR allow the module clock to be divided down,
  691. * scaling the value which is needed in SCBRR.
  692. *
  693. * -- Stuart Menefy - 23 May 2000
  694. *
  695. * I meant, why would anyone bother with bitrates below 2400.
  696. *
  697. * -- Greg Banks - 7Jul2000
  698. *
  699. * You "speedist"! How will I use my 110bps ASR-33 teletype with paper
  700. * tape reader as a console!
  701. *
  702. * -- Mitch Davis - 15 Jul 2000
  703. */
  704. #if (defined(CONFIG_CPU_SH7780) || \
  705. defined(CONFIG_CPU_SH7785) || \
  706. defined(CONFIG_CPU_SH7786)) && \
  707. !defined(CONFIG_SH_SH2007)
  708. #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1)
  709. #elif defined(CONFIG_CPU_SH7705) || \
  710. defined(CONFIG_CPU_SH7720) || \
  711. defined(CONFIG_CPU_SH7721) || \
  712. defined(CONFIG_ARCH_SH7367) || \
  713. defined(CONFIG_ARCH_SH7377) || \
  714. defined(CONFIG_ARCH_SH7372) || \
  715. defined(CONFIG_SH73A0) || \
  716. defined(CONFIG_R8A7740)
  717. #define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1)
  718. #elif defined(CONFIG_CPU_SH7723) ||\
  719. defined(CONFIG_CPU_SH7724)
  720. static inline int scbrr_calc(struct uart_port *port, int bps, int clk)
  721. {
  722. if (port->type == PORT_SCIF)
  723. return (clk+16*bps)/(32*bps)-1;
  724. else
  725. return ((clk*2)+16*bps)/(16*bps)-1;
  726. }
  727. #define SCBRR_VALUE(bps, clk) scbrr_calc(port, bps, clk)
  728. #elif defined(__H8300H__) || defined(__H8300S__)
  729. #define SCBRR_VALUE(bps, clk) (((clk*1000/32)/bps)-1)
  730. #elif defined(CONFIG_RCAR_GEN2)
  731. #define DL_VALUE(bps, clk) (clk / bps / 16) /* External Clock */
  732. #if defined(CONFIG_SCIF_A)
  733. #define SCBRR_VALUE(bps, clk) (clk / bps / 16 - 1) /* Internal Clock */
  734. #else
  735. #define SCBRR_VALUE(bps, clk) (clk / bps / 32 - 1) /* Internal Clock */
  736. #endif
  737. #else /* Generic SH */
  738. #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(32*bps)-1)
  739. #endif
  740. #ifndef DL_VALUE
  741. #define DL_VALUE(bps, clk) 0
  742. #endif