serial_txx9.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171
  1. /*
  2. * drivers/serial/serial_txx9.c
  3. *
  4. * Derived from many drivers using generic_serial interface,
  5. * especially serial_tx3912.c by Steven J. Hill and r39xx_serial.c
  6. * (was in Linux/VR tree) by Jim Pick.
  7. *
  8. * Copyright (C) 1999 Harald Koerfgen
  9. * Copyright (C) 2000 Jim Pick <jim@jimpick.com>
  10. * Copyright (C) 2001 Steven J. Hill (sjhill@realitydiluted.com)
  11. * Copyright (C) 2000-2002 Toshiba Corporation
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License version 2 as
  15. * published by the Free Software Foundation.
  16. *
  17. * Serial driver for TX3927/TX4927/TX4925/TX4938 internal SIO controller
  18. *
  19. * Revision History:
  20. * 0.30 Initial revision. (Renamed from serial_txx927.c)
  21. * 0.31 Use save_flags instead of local_irq_save.
  22. * 0.32 Support SCLK.
  23. * 0.33 Switch TXX9_TTY_NAME by CONFIG_SERIAL_TXX9_STDSERIAL.
  24. * Support TIOCSERGETLSR.
  25. * 0.34 Support slow baudrate.
  26. * 0.40 Merge codes from mainstream kernel (2.4.22).
  27. * 0.41 Fix console checking in rs_shutdown_port().
  28. * Disable flow-control in serial_console_write().
  29. * 0.42 Fix minor compiler warning.
  30. * 1.00 Kernel 2.6. Converted to new serial core (based on 8250.c).
  31. * 1.01 Set fifosize to make tx_empry called properly.
  32. * Use standard uart_get_divisor.
  33. * 1.02 Cleanup. (import 8250.c changes)
  34. */
  35. #include <linux/config.h>
  36. #if defined(CONFIG_SERIAL_TXX9_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
  37. #define SUPPORT_SYSRQ
  38. #endif
  39. #include <linux/module.h>
  40. #include <linux/ioport.h>
  41. #include <linux/init.h>
  42. #include <linux/console.h>
  43. #include <linux/sysrq.h>
  44. #include <linux/delay.h>
  45. #include <linux/device.h>
  46. #include <linux/pci.h>
  47. #include <linux/tty.h>
  48. #include <linux/tty_flip.h>
  49. #include <linux/serial_core.h>
  50. #include <linux/serial.h>
  51. #include <asm/io.h>
  52. #include <asm/irq.h>
  53. static char *serial_version = "1.02";
  54. static char *serial_name = "TX39/49 Serial driver";
  55. #define PASS_LIMIT 256
  56. #if !defined(CONFIG_SERIAL_TXX9_STDSERIAL)
  57. /* "ttyS" is used for standard serial driver */
  58. #define TXX9_TTY_NAME "ttyTX"
  59. #define TXX9_TTY_DEVFS_NAME "tttx/"
  60. #define TXX9_TTY_MINOR_START (64 + 64) /* ttyTX0(128), ttyTX1(129) */
  61. #else
  62. /* acts like standard serial driver */
  63. #define TXX9_TTY_NAME "ttyS"
  64. #define TXX9_TTY_DEVFS_NAME "tts/"
  65. #define TXX9_TTY_MINOR_START 64
  66. #endif
  67. #define TXX9_TTY_MAJOR TTY_MAJOR
  68. /* flag aliases */
  69. #define UPF_TXX9_HAVE_CTS_LINE UPF_BUGGY_UART
  70. #define UPF_TXX9_USE_SCLK UPF_MAGIC_MULTIPLIER
  71. #ifdef CONFIG_PCI
  72. /* support for Toshiba TC86C001 SIO */
  73. #define ENABLE_SERIAL_TXX9_PCI
  74. #endif
  75. /*
  76. * Number of serial ports
  77. */
  78. #ifdef ENABLE_SERIAL_TXX9_PCI
  79. #define NR_PCI_BOARDS 4
  80. #define UART_NR (2 + NR_PCI_BOARDS)
  81. #else
  82. #define UART_NR 2
  83. #endif
  84. struct uart_txx9_port {
  85. struct uart_port port;
  86. /*
  87. * We provide a per-port pm hook.
  88. */
  89. void (*pm)(struct uart_port *port,
  90. unsigned int state, unsigned int old);
  91. };
  92. #define TXX9_REGION_SIZE 0x24
  93. /* TXX9 Serial Registers */
  94. #define TXX9_SILCR 0x00
  95. #define TXX9_SIDICR 0x04
  96. #define TXX9_SIDISR 0x08
  97. #define TXX9_SICISR 0x0c
  98. #define TXX9_SIFCR 0x10
  99. #define TXX9_SIFLCR 0x14
  100. #define TXX9_SIBGR 0x18
  101. #define TXX9_SITFIFO 0x1c
  102. #define TXX9_SIRFIFO 0x20
  103. /* SILCR : Line Control */
  104. #define TXX9_SILCR_SCS_MASK 0x00000060
  105. #define TXX9_SILCR_SCS_IMCLK 0x00000000
  106. #define TXX9_SILCR_SCS_IMCLK_BG 0x00000020
  107. #define TXX9_SILCR_SCS_SCLK 0x00000040
  108. #define TXX9_SILCR_SCS_SCLK_BG 0x00000060
  109. #define TXX9_SILCR_UEPS 0x00000010
  110. #define TXX9_SILCR_UPEN 0x00000008
  111. #define TXX9_SILCR_USBL_MASK 0x00000004
  112. #define TXX9_SILCR_USBL_1BIT 0x00000000
  113. #define TXX9_SILCR_USBL_2BIT 0x00000004
  114. #define TXX9_SILCR_UMODE_MASK 0x00000003
  115. #define TXX9_SILCR_UMODE_8BIT 0x00000000
  116. #define TXX9_SILCR_UMODE_7BIT 0x00000001
  117. /* SIDICR : DMA/Int. Control */
  118. #define TXX9_SIDICR_TDE 0x00008000
  119. #define TXX9_SIDICR_RDE 0x00004000
  120. #define TXX9_SIDICR_TIE 0x00002000
  121. #define TXX9_SIDICR_RIE 0x00001000
  122. #define TXX9_SIDICR_SPIE 0x00000800
  123. #define TXX9_SIDICR_CTSAC 0x00000600
  124. #define TXX9_SIDICR_STIE_MASK 0x0000003f
  125. #define TXX9_SIDICR_STIE_OERS 0x00000020
  126. #define TXX9_SIDICR_STIE_CTSS 0x00000010
  127. #define TXX9_SIDICR_STIE_RBRKD 0x00000008
  128. #define TXX9_SIDICR_STIE_TRDY 0x00000004
  129. #define TXX9_SIDICR_STIE_TXALS 0x00000002
  130. #define TXX9_SIDICR_STIE_UBRKD 0x00000001
  131. /* SIDISR : DMA/Int. Status */
  132. #define TXX9_SIDISR_UBRK 0x00008000
  133. #define TXX9_SIDISR_UVALID 0x00004000
  134. #define TXX9_SIDISR_UFER 0x00002000
  135. #define TXX9_SIDISR_UPER 0x00001000
  136. #define TXX9_SIDISR_UOER 0x00000800
  137. #define TXX9_SIDISR_ERI 0x00000400
  138. #define TXX9_SIDISR_TOUT 0x00000200
  139. #define TXX9_SIDISR_TDIS 0x00000100
  140. #define TXX9_SIDISR_RDIS 0x00000080
  141. #define TXX9_SIDISR_STIS 0x00000040
  142. #define TXX9_SIDISR_RFDN_MASK 0x0000001f
  143. /* SICISR : Change Int. Status */
  144. #define TXX9_SICISR_OERS 0x00000020
  145. #define TXX9_SICISR_CTSS 0x00000010
  146. #define TXX9_SICISR_RBRKD 0x00000008
  147. #define TXX9_SICISR_TRDY 0x00000004
  148. #define TXX9_SICISR_TXALS 0x00000002
  149. #define TXX9_SICISR_UBRKD 0x00000001
  150. /* SIFCR : FIFO Control */
  151. #define TXX9_SIFCR_SWRST 0x00008000
  152. #define TXX9_SIFCR_RDIL_MASK 0x00000180
  153. #define TXX9_SIFCR_RDIL_1 0x00000000
  154. #define TXX9_SIFCR_RDIL_4 0x00000080
  155. #define TXX9_SIFCR_RDIL_8 0x00000100
  156. #define TXX9_SIFCR_RDIL_12 0x00000180
  157. #define TXX9_SIFCR_RDIL_MAX 0x00000180
  158. #define TXX9_SIFCR_TDIL_MASK 0x00000018
  159. #define TXX9_SIFCR_TDIL_MASK 0x00000018
  160. #define TXX9_SIFCR_TDIL_1 0x00000000
  161. #define TXX9_SIFCR_TDIL_4 0x00000001
  162. #define TXX9_SIFCR_TDIL_8 0x00000010
  163. #define TXX9_SIFCR_TDIL_MAX 0x00000010
  164. #define TXX9_SIFCR_TFRST 0x00000004
  165. #define TXX9_SIFCR_RFRST 0x00000002
  166. #define TXX9_SIFCR_FRSTE 0x00000001
  167. #define TXX9_SIO_TX_FIFO 8
  168. #define TXX9_SIO_RX_FIFO 16
  169. /* SIFLCR : Flow Control */
  170. #define TXX9_SIFLCR_RCS 0x00001000
  171. #define TXX9_SIFLCR_TES 0x00000800
  172. #define TXX9_SIFLCR_RTSSC 0x00000200
  173. #define TXX9_SIFLCR_RSDE 0x00000100
  174. #define TXX9_SIFLCR_TSDE 0x00000080
  175. #define TXX9_SIFLCR_RTSTL_MASK 0x0000001e
  176. #define TXX9_SIFLCR_RTSTL_MAX 0x0000001e
  177. #define TXX9_SIFLCR_TBRK 0x00000001
  178. /* SIBGR : Baudrate Control */
  179. #define TXX9_SIBGR_BCLK_MASK 0x00000300
  180. #define TXX9_SIBGR_BCLK_T0 0x00000000
  181. #define TXX9_SIBGR_BCLK_T2 0x00000100
  182. #define TXX9_SIBGR_BCLK_T4 0x00000200
  183. #define TXX9_SIBGR_BCLK_T6 0x00000300
  184. #define TXX9_SIBGR_BRD_MASK 0x000000ff
  185. static inline unsigned int sio_in(struct uart_txx9_port *up, int offset)
  186. {
  187. switch (up->port.iotype) {
  188. default:
  189. return *(volatile u32 *)(up->port.membase + offset);
  190. case UPIO_PORT:
  191. return inl(up->port.iobase + offset);
  192. }
  193. }
  194. static inline void
  195. sio_out(struct uart_txx9_port *up, int offset, int value)
  196. {
  197. switch (up->port.iotype) {
  198. default:
  199. *(volatile u32 *)(up->port.membase + offset) = value;
  200. break;
  201. case UPIO_PORT:
  202. outl(value, up->port.iobase + offset);
  203. break;
  204. }
  205. }
  206. static inline void
  207. sio_mask(struct uart_txx9_port *up, int offset, unsigned int value)
  208. {
  209. sio_out(up, offset, sio_in(up, offset) & ~value);
  210. }
  211. static inline void
  212. sio_set(struct uart_txx9_port *up, int offset, unsigned int value)
  213. {
  214. sio_out(up, offset, sio_in(up, offset) | value);
  215. }
  216. static inline void
  217. sio_quot_set(struct uart_txx9_port *up, int quot)
  218. {
  219. quot >>= 1;
  220. if (quot < 256)
  221. sio_out(up, TXX9_SIBGR, quot | TXX9_SIBGR_BCLK_T0);
  222. else if (quot < (256 << 2))
  223. sio_out(up, TXX9_SIBGR, (quot >> 2) | TXX9_SIBGR_BCLK_T2);
  224. else if (quot < (256 << 4))
  225. sio_out(up, TXX9_SIBGR, (quot >> 4) | TXX9_SIBGR_BCLK_T4);
  226. else if (quot < (256 << 6))
  227. sio_out(up, TXX9_SIBGR, (quot >> 6) | TXX9_SIBGR_BCLK_T6);
  228. else
  229. sio_out(up, TXX9_SIBGR, 0xff | TXX9_SIBGR_BCLK_T6);
  230. }
  231. static void serial_txx9_stop_tx(struct uart_port *port, unsigned int tty_stop)
  232. {
  233. struct uart_txx9_port *up = (struct uart_txx9_port *)port;
  234. unsigned long flags;
  235. spin_lock_irqsave(&up->port.lock, flags);
  236. sio_mask(up, TXX9_SIDICR, TXX9_SIDICR_TIE);
  237. spin_unlock_irqrestore(&up->port.lock, flags);
  238. }
  239. static void serial_txx9_start_tx(struct uart_port *port, unsigned int tty_start)
  240. {
  241. struct uart_txx9_port *up = (struct uart_txx9_port *)port;
  242. unsigned long flags;
  243. spin_lock_irqsave(&up->port.lock, flags);
  244. sio_set(up, TXX9_SIDICR, TXX9_SIDICR_TIE);
  245. spin_unlock_irqrestore(&up->port.lock, flags);
  246. }
  247. static void serial_txx9_stop_rx(struct uart_port *port)
  248. {
  249. struct uart_txx9_port *up = (struct uart_txx9_port *)port;
  250. unsigned long flags;
  251. spin_lock_irqsave(&up->port.lock, flags);
  252. up->port.read_status_mask &= ~TXX9_SIDISR_RDIS;
  253. #if 0
  254. sio_mask(up, TXX9_SIDICR, TXX9_SIDICR_RIE);
  255. #endif
  256. spin_unlock_irqrestore(&up->port.lock, flags);
  257. }
  258. static void serial_txx9_enable_ms(struct uart_port *port)
  259. {
  260. /* TXX9-SIO can not control DTR... */
  261. }
  262. static inline void
  263. receive_chars(struct uart_txx9_port *up, unsigned int *status, struct pt_regs *regs)
  264. {
  265. struct tty_struct *tty = up->port.info->tty;
  266. unsigned char ch;
  267. unsigned int disr = *status;
  268. int max_count = 256;
  269. char flag;
  270. do {
  271. /* The following is not allowed by the tty layer and
  272. unsafe. It should be fixed ASAP */
  273. if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) {
  274. if(tty->low_latency)
  275. tty_flip_buffer_push(tty);
  276. /* If this failed then we will throw away the
  277. bytes but must do so to clear interrupts */
  278. }
  279. ch = sio_in(up, TXX9_SIRFIFO);
  280. flag = TTY_NORMAL;
  281. up->port.icount.rx++;
  282. if (unlikely(disr & (TXX9_SIDISR_UBRK | TXX9_SIDISR_UPER |
  283. TXX9_SIDISR_UFER | TXX9_SIDISR_UOER))) {
  284. /*
  285. * For statistics only
  286. */
  287. if (disr & TXX9_SIDISR_UBRK) {
  288. disr &= ~(TXX9_SIDISR_UFER | TXX9_SIDISR_UPER);
  289. up->port.icount.brk++;
  290. /*
  291. * We do the SysRQ and SAK checking
  292. * here because otherwise the break
  293. * may get masked by ignore_status_mask
  294. * or read_status_mask.
  295. */
  296. if (uart_handle_break(&up->port))
  297. goto ignore_char;
  298. } else if (disr & TXX9_SIDISR_UPER)
  299. up->port.icount.parity++;
  300. else if (disr & TXX9_SIDISR_UFER)
  301. up->port.icount.frame++;
  302. if (disr & TXX9_SIDISR_UOER)
  303. up->port.icount.overrun++;
  304. /*
  305. * Mask off conditions which should be ingored.
  306. */
  307. disr &= up->port.read_status_mask;
  308. if (disr & TXX9_SIDISR_UBRK) {
  309. flag = TTY_BREAK;
  310. } else if (disr & TXX9_SIDISR_UPER)
  311. flag = TTY_PARITY;
  312. else if (disr & TXX9_SIDISR_UFER)
  313. flag = TTY_FRAME;
  314. }
  315. if (uart_handle_sysrq_char(&up->port, ch, regs))
  316. goto ignore_char;
  317. if ((disr & up->port.ignore_status_mask) == 0) {
  318. tty_insert_flip_char(tty, ch, flag);
  319. }
  320. if ((disr & TXX9_SIDISR_UOER) &&
  321. tty->flip.count < TTY_FLIPBUF_SIZE) {
  322. /*
  323. * Overrun is special, since it's reported
  324. * immediately, and doesn't affect the current
  325. * character.
  326. */
  327. tty_insert_flip_char(tty, 0, TTY_OVERRUN);
  328. }
  329. ignore_char:
  330. disr = sio_in(up, TXX9_SIDISR);
  331. } while (!(disr & TXX9_SIDISR_UVALID) && (max_count-- > 0));
  332. tty_flip_buffer_push(tty);
  333. *status = disr;
  334. }
  335. static inline void transmit_chars(struct uart_txx9_port *up)
  336. {
  337. struct circ_buf *xmit = &up->port.info->xmit;
  338. int count;
  339. if (up->port.x_char) {
  340. sio_out(up, TXX9_SITFIFO, up->port.x_char);
  341. up->port.icount.tx++;
  342. up->port.x_char = 0;
  343. return;
  344. }
  345. if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) {
  346. serial_txx9_stop_tx(&up->port, 0);
  347. return;
  348. }
  349. count = TXX9_SIO_TX_FIFO;
  350. do {
  351. sio_out(up, TXX9_SITFIFO, xmit->buf[xmit->tail]);
  352. xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
  353. up->port.icount.tx++;
  354. if (uart_circ_empty(xmit))
  355. break;
  356. } while (--count > 0);
  357. if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
  358. uart_write_wakeup(&up->port);
  359. if (uart_circ_empty(xmit))
  360. serial_txx9_stop_tx(&up->port, 0);
  361. }
  362. static irqreturn_t serial_txx9_interrupt(int irq, void *dev_id, struct pt_regs *regs)
  363. {
  364. int pass_counter = 0;
  365. struct uart_txx9_port *up = dev_id;
  366. unsigned int status;
  367. while (1) {
  368. spin_lock(&up->port.lock);
  369. status = sio_in(up, TXX9_SIDISR);
  370. if (!(sio_in(up, TXX9_SIDICR) & TXX9_SIDICR_TIE))
  371. status &= ~TXX9_SIDISR_TDIS;
  372. if (!(status & (TXX9_SIDISR_TDIS | TXX9_SIDISR_RDIS |
  373. TXX9_SIDISR_TOUT))) {
  374. spin_unlock(&up->port.lock);
  375. break;
  376. }
  377. if (status & TXX9_SIDISR_RDIS)
  378. receive_chars(up, &status, regs);
  379. if (status & TXX9_SIDISR_TDIS)
  380. transmit_chars(up);
  381. /* Clear TX/RX Int. Status */
  382. sio_mask(up, TXX9_SIDISR,
  383. TXX9_SIDISR_TDIS | TXX9_SIDISR_RDIS |
  384. TXX9_SIDISR_TOUT);
  385. spin_unlock(&up->port.lock);
  386. if (pass_counter++ > PASS_LIMIT)
  387. break;
  388. }
  389. return pass_counter ? IRQ_HANDLED : IRQ_NONE;
  390. }
  391. static unsigned int serial_txx9_tx_empty(struct uart_port *port)
  392. {
  393. struct uart_txx9_port *up = (struct uart_txx9_port *)port;
  394. unsigned long flags;
  395. unsigned int ret;
  396. spin_lock_irqsave(&up->port.lock, flags);
  397. ret = (sio_in(up, TXX9_SICISR) & TXX9_SICISR_TXALS) ? TIOCSER_TEMT : 0;
  398. spin_unlock_irqrestore(&up->port.lock, flags);
  399. return ret;
  400. }
  401. static unsigned int serial_txx9_get_mctrl(struct uart_port *port)
  402. {
  403. struct uart_txx9_port *up = (struct uart_txx9_port *)port;
  404. unsigned long flags;
  405. unsigned int ret;
  406. spin_lock_irqsave(&up->port.lock, flags);
  407. ret = ((sio_in(up, TXX9_SIFLCR) & TXX9_SIFLCR_RTSSC) ? 0 : TIOCM_RTS)
  408. | ((sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS) ? 0 : TIOCM_CTS);
  409. spin_unlock_irqrestore(&up->port.lock, flags);
  410. return ret;
  411. }
  412. static void serial_txx9_set_mctrl(struct uart_port *port, unsigned int mctrl)
  413. {
  414. struct uart_txx9_port *up = (struct uart_txx9_port *)port;
  415. unsigned long flags;
  416. spin_lock_irqsave(&up->port.lock, flags);
  417. if (mctrl & TIOCM_RTS)
  418. sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSSC);
  419. else
  420. sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSSC);
  421. spin_unlock_irqrestore(&up->port.lock, flags);
  422. }
  423. static void serial_txx9_break_ctl(struct uart_port *port, int break_state)
  424. {
  425. struct uart_txx9_port *up = (struct uart_txx9_port *)port;
  426. unsigned long flags;
  427. spin_lock_irqsave(&up->port.lock, flags);
  428. if (break_state == -1)
  429. sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK);
  430. else
  431. sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK);
  432. spin_unlock_irqrestore(&up->port.lock, flags);
  433. }
  434. static int serial_txx9_startup(struct uart_port *port)
  435. {
  436. struct uart_txx9_port *up = (struct uart_txx9_port *)port;
  437. unsigned long flags;
  438. int retval;
  439. /*
  440. * Clear the FIFO buffers and disable them.
  441. * (they will be reeanbled in set_termios())
  442. */
  443. sio_set(up, TXX9_SIFCR,
  444. TXX9_SIFCR_TFRST | TXX9_SIFCR_RFRST | TXX9_SIFCR_FRSTE);
  445. /* clear reset */
  446. sio_mask(up, TXX9_SIFCR,
  447. TXX9_SIFCR_TFRST | TXX9_SIFCR_RFRST | TXX9_SIFCR_FRSTE);
  448. sio_out(up, TXX9_SIDICR, 0);
  449. /*
  450. * Clear the interrupt registers.
  451. */
  452. sio_out(up, TXX9_SIDISR, 0);
  453. retval = request_irq(up->port.irq, serial_txx9_interrupt,
  454. SA_SHIRQ, "serial_txx9", up);
  455. if (retval)
  456. return retval;
  457. /*
  458. * Now, initialize the UART
  459. */
  460. spin_lock_irqsave(&up->port.lock, flags);
  461. serial_txx9_set_mctrl(&up->port, up->port.mctrl);
  462. spin_unlock_irqrestore(&up->port.lock, flags);
  463. /* Enable RX/TX */
  464. sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_RSDE | TXX9_SIFLCR_TSDE);
  465. /*
  466. * Finally, enable interrupts.
  467. */
  468. sio_set(up, TXX9_SIDICR, TXX9_SIDICR_RIE);
  469. return 0;
  470. }
  471. static void serial_txx9_shutdown(struct uart_port *port)
  472. {
  473. struct uart_txx9_port *up = (struct uart_txx9_port *)port;
  474. unsigned long flags;
  475. /*
  476. * Disable interrupts from this port
  477. */
  478. sio_out(up, TXX9_SIDICR, 0); /* disable all intrs */
  479. spin_lock_irqsave(&up->port.lock, flags);
  480. serial_txx9_set_mctrl(&up->port, up->port.mctrl);
  481. spin_unlock_irqrestore(&up->port.lock, flags);
  482. /*
  483. * Disable break condition
  484. */
  485. sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK);
  486. #ifdef CONFIG_SERIAL_TXX9_CONSOLE
  487. if (up->port.cons && up->port.line == up->port.cons->index) {
  488. free_irq(up->port.irq, up);
  489. return;
  490. }
  491. #endif
  492. /* reset FIFOs */
  493. sio_set(up, TXX9_SIFCR,
  494. TXX9_SIFCR_TFRST | TXX9_SIFCR_RFRST | TXX9_SIFCR_FRSTE);
  495. /* clear reset */
  496. sio_mask(up, TXX9_SIFCR,
  497. TXX9_SIFCR_TFRST | TXX9_SIFCR_RFRST | TXX9_SIFCR_FRSTE);
  498. /* Disable RX/TX */
  499. sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_RSDE | TXX9_SIFLCR_TSDE);
  500. free_irq(up->port.irq, up);
  501. }
  502. static void
  503. serial_txx9_set_termios(struct uart_port *port, struct termios *termios,
  504. struct termios *old)
  505. {
  506. struct uart_txx9_port *up = (struct uart_txx9_port *)port;
  507. unsigned int cval, fcr = 0;
  508. unsigned long flags;
  509. unsigned int baud, quot;
  510. cval = sio_in(up, TXX9_SILCR);
  511. /* byte size and parity */
  512. cval &= ~TXX9_SILCR_UMODE_MASK;
  513. switch (termios->c_cflag & CSIZE) {
  514. case CS7:
  515. cval |= TXX9_SILCR_UMODE_7BIT;
  516. break;
  517. default:
  518. case CS5: /* not supported */
  519. case CS6: /* not supported */
  520. case CS8:
  521. cval |= TXX9_SILCR_UMODE_8BIT;
  522. break;
  523. }
  524. cval &= ~TXX9_SILCR_USBL_MASK;
  525. if (termios->c_cflag & CSTOPB)
  526. cval |= TXX9_SILCR_USBL_2BIT;
  527. else
  528. cval |= TXX9_SILCR_USBL_1BIT;
  529. cval &= ~(TXX9_SILCR_UPEN | TXX9_SILCR_UEPS);
  530. if (termios->c_cflag & PARENB)
  531. cval |= TXX9_SILCR_UPEN;
  532. if (!(termios->c_cflag & PARODD))
  533. cval |= TXX9_SILCR_UEPS;
  534. /*
  535. * Ask the core to calculate the divisor for us.
  536. */
  537. baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16/2);
  538. quot = uart_get_divisor(port, baud);
  539. /* Set up FIFOs */
  540. /* TX Int by FIFO Empty, RX Int by Receiving 1 char. */
  541. fcr = TXX9_SIFCR_TDIL_MAX | TXX9_SIFCR_RDIL_1;
  542. /*
  543. * Ok, we're now changing the port state. Do it with
  544. * interrupts disabled.
  545. */
  546. spin_lock_irqsave(&up->port.lock, flags);
  547. /*
  548. * Update the per-port timeout.
  549. */
  550. uart_update_timeout(port, termios->c_cflag, baud);
  551. up->port.read_status_mask = TXX9_SIDISR_UOER |
  552. TXX9_SIDISR_TDIS | TXX9_SIDISR_RDIS;
  553. if (termios->c_iflag & INPCK)
  554. up->port.read_status_mask |= TXX9_SIDISR_UFER | TXX9_SIDISR_UPER;
  555. if (termios->c_iflag & (BRKINT | PARMRK))
  556. up->port.read_status_mask |= TXX9_SIDISR_UBRK;
  557. /*
  558. * Characteres to ignore
  559. */
  560. up->port.ignore_status_mask = 0;
  561. if (termios->c_iflag & IGNPAR)
  562. up->port.ignore_status_mask |= TXX9_SIDISR_UPER | TXX9_SIDISR_UFER;
  563. if (termios->c_iflag & IGNBRK) {
  564. up->port.ignore_status_mask |= TXX9_SIDISR_UBRK;
  565. /*
  566. * If we're ignoring parity and break indicators,
  567. * ignore overruns too (for real raw support).
  568. */
  569. if (termios->c_iflag & IGNPAR)
  570. up->port.ignore_status_mask |= TXX9_SIDISR_UOER;
  571. }
  572. /*
  573. * ignore all characters if CREAD is not set
  574. */
  575. if ((termios->c_cflag & CREAD) == 0)
  576. up->port.ignore_status_mask |= TXX9_SIDISR_RDIS;
  577. /* CTS flow control flag */
  578. if ((termios->c_cflag & CRTSCTS) &&
  579. (up->port.flags & UPF_TXX9_HAVE_CTS_LINE)) {
  580. sio_set(up, TXX9_SIFLCR,
  581. TXX9_SIFLCR_RCS | TXX9_SIFLCR_TES);
  582. } else {
  583. sio_mask(up, TXX9_SIFLCR,
  584. TXX9_SIFLCR_RCS | TXX9_SIFLCR_TES);
  585. }
  586. sio_out(up, TXX9_SILCR, cval);
  587. sio_quot_set(up, quot);
  588. sio_out(up, TXX9_SIFCR, fcr);
  589. serial_txx9_set_mctrl(&up->port, up->port.mctrl);
  590. spin_unlock_irqrestore(&up->port.lock, flags);
  591. }
  592. static void
  593. serial_txx9_pm(struct uart_port *port, unsigned int state,
  594. unsigned int oldstate)
  595. {
  596. struct uart_txx9_port *up = (struct uart_txx9_port *)port;
  597. if (state) {
  598. /* sleep */
  599. if (up->pm)
  600. up->pm(port, state, oldstate);
  601. } else {
  602. /* wake */
  603. if (up->pm)
  604. up->pm(port, state, oldstate);
  605. }
  606. }
  607. static int serial_txx9_request_resource(struct uart_txx9_port *up)
  608. {
  609. unsigned int size = TXX9_REGION_SIZE;
  610. int ret = 0;
  611. switch (up->port.iotype) {
  612. default:
  613. if (!up->port.mapbase)
  614. break;
  615. if (!request_mem_region(up->port.mapbase, size, "serial_txx9")) {
  616. ret = -EBUSY;
  617. break;
  618. }
  619. if (up->port.flags & UPF_IOREMAP) {
  620. up->port.membase = ioremap(up->port.mapbase, size);
  621. if (!up->port.membase) {
  622. release_mem_region(up->port.mapbase, size);
  623. ret = -ENOMEM;
  624. }
  625. }
  626. break;
  627. case UPIO_PORT:
  628. if (!request_region(up->port.iobase, size, "serial_txx9"))
  629. ret = -EBUSY;
  630. break;
  631. }
  632. return ret;
  633. }
  634. static void serial_txx9_release_resource(struct uart_txx9_port *up)
  635. {
  636. unsigned int size = TXX9_REGION_SIZE;
  637. switch (up->port.iotype) {
  638. default:
  639. if (!up->port.mapbase)
  640. break;
  641. if (up->port.flags & UPF_IOREMAP) {
  642. iounmap(up->port.membase);
  643. up->port.membase = NULL;
  644. }
  645. release_mem_region(up->port.mapbase, size);
  646. break;
  647. case UPIO_PORT:
  648. release_region(up->port.iobase, size);
  649. break;
  650. }
  651. }
  652. static void serial_txx9_release_port(struct uart_port *port)
  653. {
  654. struct uart_txx9_port *up = (struct uart_txx9_port *)port;
  655. serial_txx9_release_resource(up);
  656. }
  657. static int serial_txx9_request_port(struct uart_port *port)
  658. {
  659. struct uart_txx9_port *up = (struct uart_txx9_port *)port;
  660. return serial_txx9_request_resource(up);
  661. }
  662. static void serial_txx9_config_port(struct uart_port *port, int uflags)
  663. {
  664. struct uart_txx9_port *up = (struct uart_txx9_port *)port;
  665. unsigned long flags;
  666. int ret;
  667. /*
  668. * Find the region that we can probe for. This in turn
  669. * tells us whether we can probe for the type of port.
  670. */
  671. ret = serial_txx9_request_resource(up);
  672. if (ret < 0)
  673. return;
  674. port->type = PORT_TXX9;
  675. up->port.fifosize = TXX9_SIO_TX_FIFO;
  676. #ifdef CONFIG_SERIAL_TXX9_CONSOLE
  677. if (up->port.line == up->port.cons->index)
  678. return;
  679. #endif
  680. spin_lock_irqsave(&up->port.lock, flags);
  681. /*
  682. * Reset the UART.
  683. */
  684. sio_out(up, TXX9_SIFCR, TXX9_SIFCR_SWRST);
  685. #ifdef CONFIG_CPU_TX49XX
  686. /* TX4925 BUG WORKAROUND. Accessing SIOC register
  687. * immediately after soft reset causes bus error. */
  688. iob();
  689. udelay(1);
  690. #endif
  691. while (sio_in(up, TXX9_SIFCR) & TXX9_SIFCR_SWRST)
  692. ;
  693. /* TX Int by FIFO Empty, RX Int by Receiving 1 char. */
  694. sio_set(up, TXX9_SIFCR,
  695. TXX9_SIFCR_TDIL_MAX | TXX9_SIFCR_RDIL_1);
  696. /* initial settings */
  697. sio_out(up, TXX9_SILCR,
  698. TXX9_SILCR_UMODE_8BIT | TXX9_SILCR_USBL_1BIT |
  699. ((up->port.flags & UPF_TXX9_USE_SCLK) ?
  700. TXX9_SILCR_SCS_SCLK_BG : TXX9_SILCR_SCS_IMCLK_BG));
  701. sio_quot_set(up, uart_get_divisor(port, 9600));
  702. sio_out(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSTL_MAX /* 15 */);
  703. spin_unlock_irqrestore(&up->port.lock, flags);
  704. }
  705. static int
  706. serial_txx9_verify_port(struct uart_port *port, struct serial_struct *ser)
  707. {
  708. if (ser->irq < 0 ||
  709. ser->baud_base < 9600 || ser->type != PORT_TXX9)
  710. return -EINVAL;
  711. return 0;
  712. }
  713. static const char *
  714. serial_txx9_type(struct uart_port *port)
  715. {
  716. return "txx9";
  717. }
  718. static struct uart_ops serial_txx9_pops = {
  719. .tx_empty = serial_txx9_tx_empty,
  720. .set_mctrl = serial_txx9_set_mctrl,
  721. .get_mctrl = serial_txx9_get_mctrl,
  722. .stop_tx = serial_txx9_stop_tx,
  723. .start_tx = serial_txx9_start_tx,
  724. .stop_rx = serial_txx9_stop_rx,
  725. .enable_ms = serial_txx9_enable_ms,
  726. .break_ctl = serial_txx9_break_ctl,
  727. .startup = serial_txx9_startup,
  728. .shutdown = serial_txx9_shutdown,
  729. .set_termios = serial_txx9_set_termios,
  730. .pm = serial_txx9_pm,
  731. .type = serial_txx9_type,
  732. .release_port = serial_txx9_release_port,
  733. .request_port = serial_txx9_request_port,
  734. .config_port = serial_txx9_config_port,
  735. .verify_port = serial_txx9_verify_port,
  736. };
  737. static struct uart_txx9_port serial_txx9_ports[UART_NR];
  738. static void __init serial_txx9_register_ports(struct uart_driver *drv)
  739. {
  740. int i;
  741. for (i = 0; i < UART_NR; i++) {
  742. struct uart_txx9_port *up = &serial_txx9_ports[i];
  743. up->port.line = i;
  744. up->port.ops = &serial_txx9_pops;
  745. uart_add_one_port(drv, &up->port);
  746. }
  747. }
  748. #ifdef CONFIG_SERIAL_TXX9_CONSOLE
  749. /*
  750. * Wait for transmitter & holding register to empty
  751. */
  752. static inline void wait_for_xmitr(struct uart_txx9_port *up)
  753. {
  754. unsigned int tmout = 10000;
  755. /* Wait up to 10ms for the character(s) to be sent. */
  756. while (--tmout &&
  757. !(sio_in(up, TXX9_SICISR) & TXX9_SICISR_TXALS))
  758. udelay(1);
  759. /* Wait up to 1s for flow control if necessary */
  760. if (up->port.flags & UPF_CONS_FLOW) {
  761. tmout = 1000000;
  762. while (--tmout &&
  763. (sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS))
  764. udelay(1);
  765. }
  766. }
  767. /*
  768. * Print a string to the serial port trying not to disturb
  769. * any possible real use of the port...
  770. *
  771. * The console_lock must be held when we get here.
  772. */
  773. static void
  774. serial_txx9_console_write(struct console *co, const char *s, unsigned int count)
  775. {
  776. struct uart_txx9_port *up = &serial_txx9_ports[co->index];
  777. unsigned int ier, flcr;
  778. int i;
  779. /*
  780. * First save the UER then disable the interrupts
  781. */
  782. ier = sio_in(up, TXX9_SIDICR);
  783. sio_out(up, TXX9_SIDICR, 0);
  784. /*
  785. * Disable flow-control if enabled (and unnecessary)
  786. */
  787. flcr = sio_in(up, TXX9_SIFLCR);
  788. if (!(up->port.flags & UPF_CONS_FLOW) && (flcr & TXX9_SIFLCR_TES))
  789. sio_out(up, TXX9_SIFLCR, flcr & ~TXX9_SIFLCR_TES);
  790. /*
  791. * Now, do each character
  792. */
  793. for (i = 0; i < count; i++, s++) {
  794. wait_for_xmitr(up);
  795. /*
  796. * Send the character out.
  797. * If a LF, also do CR...
  798. */
  799. sio_out(up, TXX9_SITFIFO, *s);
  800. if (*s == 10) {
  801. wait_for_xmitr(up);
  802. sio_out(up, TXX9_SITFIFO, 13);
  803. }
  804. }
  805. /*
  806. * Finally, wait for transmitter to become empty
  807. * and restore the IER
  808. */
  809. wait_for_xmitr(up);
  810. sio_out(up, TXX9_SIFLCR, flcr);
  811. sio_out(up, TXX9_SIDICR, ier);
  812. }
  813. static int serial_txx9_console_setup(struct console *co, char *options)
  814. {
  815. struct uart_port *port;
  816. struct uart_txx9_port *up;
  817. int baud = 9600;
  818. int bits = 8;
  819. int parity = 'n';
  820. int flow = 'n';
  821. /*
  822. * Check whether an invalid uart number has been specified, and
  823. * if so, search for the first available port that does have
  824. * console support.
  825. */
  826. if (co->index >= UART_NR)
  827. co->index = 0;
  828. up = &serial_txx9_ports[co->index];
  829. port = &up->port;
  830. if (!port->ops)
  831. return -ENODEV;
  832. /*
  833. * Temporary fix.
  834. */
  835. spin_lock_init(&port->lock);
  836. /*
  837. * Disable UART interrupts, set DTR and RTS high
  838. * and set speed.
  839. */
  840. sio_out(up, TXX9_SIDICR, 0);
  841. /* initial settings */
  842. sio_out(up, TXX9_SILCR,
  843. TXX9_SILCR_UMODE_8BIT | TXX9_SILCR_USBL_1BIT |
  844. ((port->flags & UPF_TXX9_USE_SCLK) ?
  845. TXX9_SILCR_SCS_SCLK_BG : TXX9_SILCR_SCS_IMCLK_BG));
  846. sio_out(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSTL_MAX /* 15 */);
  847. if (options)
  848. uart_parse_options(options, &baud, &parity, &bits, &flow);
  849. return uart_set_options(port, co, baud, parity, bits, flow);
  850. }
  851. static struct uart_driver serial_txx9_reg;
  852. static struct console serial_txx9_console = {
  853. .name = TXX9_TTY_NAME,
  854. .write = serial_txx9_console_write,
  855. .device = uart_console_device,
  856. .setup = serial_txx9_console_setup,
  857. .flags = CON_PRINTBUFFER,
  858. .index = -1,
  859. .data = &serial_txx9_reg,
  860. };
  861. static int __init serial_txx9_console_init(void)
  862. {
  863. register_console(&serial_txx9_console);
  864. return 0;
  865. }
  866. console_initcall(serial_txx9_console_init);
  867. static int __init serial_txx9_late_console_init(void)
  868. {
  869. if (!(serial_txx9_console.flags & CON_ENABLED))
  870. register_console(&serial_txx9_console);
  871. return 0;
  872. }
  873. late_initcall(serial_txx9_late_console_init);
  874. #define SERIAL_TXX9_CONSOLE &serial_txx9_console
  875. #else
  876. #define SERIAL_TXX9_CONSOLE NULL
  877. #endif
  878. static struct uart_driver serial_txx9_reg = {
  879. .owner = THIS_MODULE,
  880. .driver_name = "serial_txx9",
  881. .devfs_name = TXX9_TTY_DEVFS_NAME,
  882. .dev_name = TXX9_TTY_NAME,
  883. .major = TXX9_TTY_MAJOR,
  884. .minor = TXX9_TTY_MINOR_START,
  885. .nr = UART_NR,
  886. .cons = SERIAL_TXX9_CONSOLE,
  887. };
  888. int __init early_serial_txx9_setup(struct uart_port *port)
  889. {
  890. if (port->line >= ARRAY_SIZE(serial_txx9_ports))
  891. return -ENODEV;
  892. serial_txx9_ports[port->line].port = *port;
  893. serial_txx9_ports[port->line].port.ops = &serial_txx9_pops;
  894. serial_txx9_ports[port->line].port.flags |= UPF_BOOT_AUTOCONF;
  895. return 0;
  896. }
  897. #ifdef ENABLE_SERIAL_TXX9_PCI
  898. /**
  899. * serial_txx9_suspend_port - suspend one serial port
  900. * @line: serial line number
  901. * @level: the level of port suspension, as per uart_suspend_port
  902. *
  903. * Suspend one serial port.
  904. */
  905. static void serial_txx9_suspend_port(int line)
  906. {
  907. uart_suspend_port(&serial_txx9_reg, &serial_txx9_ports[line].port);
  908. }
  909. /**
  910. * serial_txx9_resume_port - resume one serial port
  911. * @line: serial line number
  912. * @level: the level of port resumption, as per uart_resume_port
  913. *
  914. * Resume one serial port.
  915. */
  916. static void serial_txx9_resume_port(int line)
  917. {
  918. uart_resume_port(&serial_txx9_reg, &serial_txx9_ports[line].port);
  919. }
  920. /*
  921. * Probe one serial board. Unfortunately, there is no rhyme nor reason
  922. * to the arrangement of serial ports on a PCI card.
  923. */
  924. static int __devinit
  925. pciserial_txx9_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
  926. {
  927. struct uart_port port;
  928. int line;
  929. int rc;
  930. rc = pci_enable_device(dev);
  931. if (rc)
  932. return rc;
  933. memset(&port, 0, sizeof(port));
  934. port.ops = &serial_txx9_pops;
  935. port.flags |= UPF_BOOT_AUTOCONF; /* uart_ops.config_port will be called */
  936. port.flags |= UPF_TXX9_HAVE_CTS_LINE;
  937. port.uartclk = 66670000;
  938. port.irq = dev->irq;
  939. port.iotype = UPIO_PORT;
  940. port.iobase = pci_resource_start(dev, 1);
  941. line = uart_register_port(&serial_txx9_reg, &port);
  942. if (line < 0) {
  943. printk(KERN_WARNING "Couldn't register serial port %s: %d\n", pci_name(dev), line);
  944. }
  945. pci_set_drvdata(dev, (void *)(long)line);
  946. return 0;
  947. }
  948. static void __devexit pciserial_txx9_remove_one(struct pci_dev *dev)
  949. {
  950. int line = (int)(long)pci_get_drvdata(dev);
  951. pci_set_drvdata(dev, NULL);
  952. if (line) {
  953. uart_unregister_port(&serial_txx9_reg, line);
  954. pci_disable_device(dev);
  955. }
  956. }
  957. static int pciserial_txx9_suspend_one(struct pci_dev *dev, pm_message_t state)
  958. {
  959. int line = (int)(long)pci_get_drvdata(dev);
  960. if (line)
  961. serial_txx9_suspend_port(line);
  962. return 0;
  963. }
  964. static int pciserial_txx9_resume_one(struct pci_dev *dev)
  965. {
  966. int line = (int)(long)pci_get_drvdata(dev);
  967. if (line)
  968. serial_txx9_resume_port(line);
  969. return 0;
  970. }
  971. static struct pci_device_id serial_txx9_pci_tbl[] = {
  972. { PCI_VENDOR_ID_TOSHIBA_2, PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC,
  973. PCI_ANY_ID, PCI_ANY_ID,
  974. 0, 0, 0 },
  975. { 0, }
  976. };
  977. static struct pci_driver serial_txx9_pci_driver = {
  978. .name = "serial_txx9",
  979. .probe = pciserial_txx9_init_one,
  980. .remove = __devexit_p(pciserial_txx9_remove_one),
  981. .suspend = pciserial_txx9_suspend_one,
  982. .resume = pciserial_txx9_resume_one,
  983. .id_table = serial_txx9_pci_tbl,
  984. };
  985. MODULE_DEVICE_TABLE(pci, serial_txx9_pci_tbl);
  986. #endif /* ENABLE_SERIAL_TXX9_PCI */
  987. static int __init serial_txx9_init(void)
  988. {
  989. int ret;
  990. printk(KERN_INFO "%s version %s\n", serial_name, serial_version);
  991. ret = uart_register_driver(&serial_txx9_reg);
  992. if (ret >= 0) {
  993. serial_txx9_register_ports(&serial_txx9_reg);
  994. #ifdef ENABLE_SERIAL_TXX9_PCI
  995. ret = pci_module_init(&serial_txx9_pci_driver);
  996. #endif
  997. }
  998. return ret;
  999. }
  1000. static void __exit serial_txx9_exit(void)
  1001. {
  1002. int i;
  1003. #ifdef ENABLE_SERIAL_TXX9_PCI
  1004. pci_unregister_driver(&serial_txx9_pci_driver);
  1005. #endif
  1006. for (i = 0; i < UART_NR; i++)
  1007. uart_remove_one_port(&serial_txx9_reg, &serial_txx9_ports[i].port);
  1008. uart_unregister_driver(&serial_txx9_reg);
  1009. }
  1010. module_init(serial_txx9_init);
  1011. module_exit(serial_txx9_exit);
  1012. MODULE_LICENSE("GPL");
  1013. MODULE_DESCRIPTION("TX39/49 serial driver");
  1014. MODULE_ALIAS_CHARDEV_MAJOR(TXX9_TTY_MAJOR);