ip22zilog.c 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222
  1. /*
  2. * Driver for Zilog serial chips found on SGI workstations and
  3. * servers. This driver could actually be made more generic.
  4. *
  5. * This is based on the drivers/serial/sunzilog.c code as of 2.6.0-test7 and the
  6. * old drivers/sgi/char/sgiserial.c code which itself is based of the original
  7. * drivers/sbus/char/zs.c code. A lot of code has been simply moved over
  8. * directly from there but much has been rewritten. Credits therefore go out
  9. * to David S. Miller, Eddie C. Dost, Pete Zaitcev, Ted Ts'o and Alex Buell
  10. * for their work there.
  11. *
  12. * Copyright (C) 2002 Ralf Baechle (ralf@linux-mips.org)
  13. * Copyright (C) 2002 David S. Miller (davem@redhat.com)
  14. */
  15. #include <linux/module.h>
  16. #include <linux/kernel.h>
  17. #include <linux/errno.h>
  18. #include <linux/delay.h>
  19. #include <linux/tty.h>
  20. #include <linux/tty_flip.h>
  21. #include <linux/major.h>
  22. #include <linux/string.h>
  23. #include <linux/ptrace.h>
  24. #include <linux/ioport.h>
  25. #include <linux/slab.h>
  26. #include <linux/circ_buf.h>
  27. #include <linux/serial.h>
  28. #include <linux/sysrq.h>
  29. #include <linux/console.h>
  30. #include <linux/spinlock.h>
  31. #include <linux/init.h>
  32. #include <asm/io.h>
  33. #include <asm/irq.h>
  34. #include <asm/sgialib.h>
  35. #include <asm/sgi/ioc.h>
  36. #include <asm/sgi/hpc3.h>
  37. #include <asm/sgi/ip22.h>
  38. #if defined(CONFIG_SERIAL_IP22_ZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
  39. #define SUPPORT_SYSRQ
  40. #endif
  41. #include <linux/serial_core.h>
  42. #include "ip22zilog.h"
  43. /*
  44. * On IP22 we need to delay after register accesses but we do not need to
  45. * flush writes.
  46. */
  47. #define ZSDELAY() udelay(5)
  48. #define ZSDELAY_LONG() udelay(20)
  49. #define ZS_WSYNC(channel) do { } while (0)
  50. #define NUM_IP22ZILOG 1
  51. #define NUM_CHANNELS (NUM_IP22ZILOG * 2)
  52. #define ZS_CLOCK 3672000 /* Zilog input clock rate. */
  53. #define ZS_CLOCK_DIVISOR 16 /* Divisor this driver uses. */
  54. /*
  55. * We wrap our port structure around the generic uart_port.
  56. */
  57. struct uart_ip22zilog_port {
  58. struct uart_port port;
  59. /* IRQ servicing chain. */
  60. struct uart_ip22zilog_port *next;
  61. /* Current values of Zilog write registers. */
  62. unsigned char curregs[NUM_ZSREGS];
  63. unsigned int flags;
  64. #define IP22ZILOG_FLAG_IS_CONS 0x00000004
  65. #define IP22ZILOG_FLAG_IS_KGDB 0x00000008
  66. #define IP22ZILOG_FLAG_MODEM_STATUS 0x00000010
  67. #define IP22ZILOG_FLAG_IS_CHANNEL_A 0x00000020
  68. #define IP22ZILOG_FLAG_REGS_HELD 0x00000040
  69. #define IP22ZILOG_FLAG_TX_STOPPED 0x00000080
  70. #define IP22ZILOG_FLAG_TX_ACTIVE 0x00000100
  71. #define IP22ZILOG_FLAG_RESET_DONE 0x00000200
  72. unsigned int tty_break;
  73. unsigned char parity_mask;
  74. unsigned char prev_status;
  75. };
  76. #define ZILOG_CHANNEL_FROM_PORT(PORT) ((struct zilog_channel *)((PORT)->membase))
  77. #define UART_ZILOG(PORT) ((struct uart_ip22zilog_port *)(PORT))
  78. #define IP22ZILOG_GET_CURR_REG(PORT, REGNUM) \
  79. (UART_ZILOG(PORT)->curregs[REGNUM])
  80. #define IP22ZILOG_SET_CURR_REG(PORT, REGNUM, REGVAL) \
  81. ((UART_ZILOG(PORT)->curregs[REGNUM]) = (REGVAL))
  82. #define ZS_IS_CONS(UP) ((UP)->flags & IP22ZILOG_FLAG_IS_CONS)
  83. #define ZS_IS_KGDB(UP) ((UP)->flags & IP22ZILOG_FLAG_IS_KGDB)
  84. #define ZS_WANTS_MODEM_STATUS(UP) ((UP)->flags & IP22ZILOG_FLAG_MODEM_STATUS)
  85. #define ZS_IS_CHANNEL_A(UP) ((UP)->flags & IP22ZILOG_FLAG_IS_CHANNEL_A)
  86. #define ZS_REGS_HELD(UP) ((UP)->flags & IP22ZILOG_FLAG_REGS_HELD)
  87. #define ZS_TX_STOPPED(UP) ((UP)->flags & IP22ZILOG_FLAG_TX_STOPPED)
  88. #define ZS_TX_ACTIVE(UP) ((UP)->flags & IP22ZILOG_FLAG_TX_ACTIVE)
  89. /* Reading and writing Zilog8530 registers. The delays are to make this
  90. * driver work on the IP22 which needs a settling delay after each chip
  91. * register access, other machines handle this in hardware via auxiliary
  92. * flip-flops which implement the settle time we do in software.
  93. *
  94. * The port lock must be held and local IRQs must be disabled
  95. * when {read,write}_zsreg is invoked.
  96. */
  97. static unsigned char read_zsreg(struct zilog_channel *channel,
  98. unsigned char reg)
  99. {
  100. unsigned char retval;
  101. writeb(reg, &channel->control);
  102. ZSDELAY();
  103. retval = readb(&channel->control);
  104. ZSDELAY();
  105. return retval;
  106. }
  107. static void write_zsreg(struct zilog_channel *channel,
  108. unsigned char reg, unsigned char value)
  109. {
  110. writeb(reg, &channel->control);
  111. ZSDELAY();
  112. writeb(value, &channel->control);
  113. ZSDELAY();
  114. }
  115. static void ip22zilog_clear_fifo(struct zilog_channel *channel)
  116. {
  117. int i;
  118. for (i = 0; i < 32; i++) {
  119. unsigned char regval;
  120. regval = readb(&channel->control);
  121. ZSDELAY();
  122. if (regval & Rx_CH_AV)
  123. break;
  124. regval = read_zsreg(channel, R1);
  125. readb(&channel->data);
  126. ZSDELAY();
  127. if (regval & (PAR_ERR | Rx_OVR | CRC_ERR)) {
  128. writeb(ERR_RES, &channel->control);
  129. ZSDELAY();
  130. ZS_WSYNC(channel);
  131. }
  132. }
  133. }
  134. /* This function must only be called when the TX is not busy. The UART
  135. * port lock must be held and local interrupts disabled.
  136. */
  137. static void __load_zsregs(struct zilog_channel *channel, unsigned char *regs)
  138. {
  139. int i;
  140. /* Let pending transmits finish. */
  141. for (i = 0; i < 1000; i++) {
  142. unsigned char stat = read_zsreg(channel, R1);
  143. if (stat & ALL_SNT)
  144. break;
  145. udelay(100);
  146. }
  147. writeb(ERR_RES, &channel->control);
  148. ZSDELAY();
  149. ZS_WSYNC(channel);
  150. ip22zilog_clear_fifo(channel);
  151. /* Disable all interrupts. */
  152. write_zsreg(channel, R1,
  153. regs[R1] & ~(RxINT_MASK | TxINT_ENAB | EXT_INT_ENAB));
  154. /* Set parity, sync config, stop bits, and clock divisor. */
  155. write_zsreg(channel, R4, regs[R4]);
  156. /* Set misc. TX/RX control bits. */
  157. write_zsreg(channel, R10, regs[R10]);
  158. /* Set TX/RX controls sans the enable bits. */
  159. write_zsreg(channel, R3, regs[R3] & ~RxENAB);
  160. write_zsreg(channel, R5, regs[R5] & ~TxENAB);
  161. /* Synchronous mode config. */
  162. write_zsreg(channel, R6, regs[R6]);
  163. write_zsreg(channel, R7, regs[R7]);
  164. /* Don't mess with the interrupt vector (R2, unused by us) and
  165. * master interrupt control (R9). We make sure this is setup
  166. * properly at probe time then never touch it again.
  167. */
  168. /* Disable baud generator. */
  169. write_zsreg(channel, R14, regs[R14] & ~BRENAB);
  170. /* Clock mode control. */
  171. write_zsreg(channel, R11, regs[R11]);
  172. /* Lower and upper byte of baud rate generator divisor. */
  173. write_zsreg(channel, R12, regs[R12]);
  174. write_zsreg(channel, R13, regs[R13]);
  175. /* Now rewrite R14, with BRENAB (if set). */
  176. write_zsreg(channel, R14, regs[R14]);
  177. /* External status interrupt control. */
  178. write_zsreg(channel, R15, regs[R15]);
  179. /* Reset external status interrupts. */
  180. write_zsreg(channel, R0, RES_EXT_INT);
  181. write_zsreg(channel, R0, RES_EXT_INT);
  182. /* Rewrite R3/R5, this time without enables masked. */
  183. write_zsreg(channel, R3, regs[R3]);
  184. write_zsreg(channel, R5, regs[R5]);
  185. /* Rewrite R1, this time without IRQ enabled masked. */
  186. write_zsreg(channel, R1, regs[R1]);
  187. }
  188. /* Reprogram the Zilog channel HW registers with the copies found in the
  189. * software state struct. If the transmitter is busy, we defer this update
  190. * until the next TX complete interrupt. Else, we do it right now.
  191. *
  192. * The UART port lock must be held and local interrupts disabled.
  193. */
  194. static void ip22zilog_maybe_update_regs(struct uart_ip22zilog_port *up,
  195. struct zilog_channel *channel)
  196. {
  197. if (!ZS_REGS_HELD(up)) {
  198. if (ZS_TX_ACTIVE(up)) {
  199. up->flags |= IP22ZILOG_FLAG_REGS_HELD;
  200. } else {
  201. __load_zsregs(channel, up->curregs);
  202. }
  203. }
  204. }
  205. #define Rx_BRK 0x0100 /* BREAK event software flag. */
  206. #define Rx_SYS 0x0200 /* SysRq event software flag. */
  207. static struct tty_struct *ip22zilog_receive_chars(struct uart_ip22zilog_port *up,
  208. struct zilog_channel *channel)
  209. {
  210. struct tty_struct *tty;
  211. unsigned char ch, flag;
  212. unsigned int r1;
  213. tty = NULL;
  214. if (up->port.state != NULL &&
  215. up->port.state->port.tty != NULL)
  216. tty = up->port.state->port.tty;
  217. for (;;) {
  218. ch = readb(&channel->control);
  219. ZSDELAY();
  220. if (!(ch & Rx_CH_AV))
  221. break;
  222. r1 = read_zsreg(channel, R1);
  223. if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) {
  224. writeb(ERR_RES, &channel->control);
  225. ZSDELAY();
  226. ZS_WSYNC(channel);
  227. }
  228. ch = readb(&channel->data);
  229. ZSDELAY();
  230. ch &= up->parity_mask;
  231. /* Handle the null char got when BREAK is removed. */
  232. if (!ch)
  233. r1 |= up->tty_break;
  234. /* A real serial line, record the character and status. */
  235. flag = TTY_NORMAL;
  236. up->port.icount.rx++;
  237. if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR | Rx_SYS | Rx_BRK)) {
  238. up->tty_break = 0;
  239. if (r1 & (Rx_SYS | Rx_BRK)) {
  240. up->port.icount.brk++;
  241. if (r1 & Rx_SYS)
  242. continue;
  243. r1 &= ~(PAR_ERR | CRC_ERR);
  244. }
  245. else if (r1 & PAR_ERR)
  246. up->port.icount.parity++;
  247. else if (r1 & CRC_ERR)
  248. up->port.icount.frame++;
  249. if (r1 & Rx_OVR)
  250. up->port.icount.overrun++;
  251. r1 &= up->port.read_status_mask;
  252. if (r1 & Rx_BRK)
  253. flag = TTY_BREAK;
  254. else if (r1 & PAR_ERR)
  255. flag = TTY_PARITY;
  256. else if (r1 & CRC_ERR)
  257. flag = TTY_FRAME;
  258. }
  259. if (uart_handle_sysrq_char(&up->port, ch))
  260. continue;
  261. if (tty)
  262. uart_insert_char(&up->port, r1, Rx_OVR, ch, flag);
  263. }
  264. return tty;
  265. }
  266. static void ip22zilog_status_handle(struct uart_ip22zilog_port *up,
  267. struct zilog_channel *channel)
  268. {
  269. unsigned char status;
  270. status = readb(&channel->control);
  271. ZSDELAY();
  272. writeb(RES_EXT_INT, &channel->control);
  273. ZSDELAY();
  274. ZS_WSYNC(channel);
  275. if (up->curregs[R15] & BRKIE) {
  276. if ((status & BRK_ABRT) && !(up->prev_status & BRK_ABRT)) {
  277. if (uart_handle_break(&up->port))
  278. up->tty_break = Rx_SYS;
  279. else
  280. up->tty_break = Rx_BRK;
  281. }
  282. }
  283. if (ZS_WANTS_MODEM_STATUS(up)) {
  284. if (status & SYNC)
  285. up->port.icount.dsr++;
  286. /* The Zilog just gives us an interrupt when DCD/CTS/etc. change.
  287. * But it does not tell us which bit has changed, we have to keep
  288. * track of this ourselves.
  289. */
  290. if ((status ^ up->prev_status) ^ DCD)
  291. uart_handle_dcd_change(&up->port,
  292. (status & DCD));
  293. if ((status ^ up->prev_status) ^ CTS)
  294. uart_handle_cts_change(&up->port,
  295. (status & CTS));
  296. wake_up_interruptible(&up->port.state->port.delta_msr_wait);
  297. }
  298. up->prev_status = status;
  299. }
  300. static void ip22zilog_transmit_chars(struct uart_ip22zilog_port *up,
  301. struct zilog_channel *channel)
  302. {
  303. struct circ_buf *xmit;
  304. if (ZS_IS_CONS(up)) {
  305. unsigned char status = readb(&channel->control);
  306. ZSDELAY();
  307. /* TX still busy? Just wait for the next TX done interrupt.
  308. *
  309. * It can occur because of how we do serial console writes. It would
  310. * be nice to transmit console writes just like we normally would for
  311. * a TTY line. (ie. buffered and TX interrupt driven). That is not
  312. * easy because console writes cannot sleep. One solution might be
  313. * to poll on enough port->xmit space becoming free. -DaveM
  314. */
  315. if (!(status & Tx_BUF_EMP))
  316. return;
  317. }
  318. up->flags &= ~IP22ZILOG_FLAG_TX_ACTIVE;
  319. if (ZS_REGS_HELD(up)) {
  320. __load_zsregs(channel, up->curregs);
  321. up->flags &= ~IP22ZILOG_FLAG_REGS_HELD;
  322. }
  323. if (ZS_TX_STOPPED(up)) {
  324. up->flags &= ~IP22ZILOG_FLAG_TX_STOPPED;
  325. goto ack_tx_int;
  326. }
  327. if (up->port.x_char) {
  328. up->flags |= IP22ZILOG_FLAG_TX_ACTIVE;
  329. writeb(up->port.x_char, &channel->data);
  330. ZSDELAY();
  331. ZS_WSYNC(channel);
  332. up->port.icount.tx++;
  333. up->port.x_char = 0;
  334. return;
  335. }
  336. if (up->port.state == NULL)
  337. goto ack_tx_int;
  338. xmit = &up->port.state->xmit;
  339. if (uart_circ_empty(xmit))
  340. goto ack_tx_int;
  341. if (uart_tx_stopped(&up->port))
  342. goto ack_tx_int;
  343. up->flags |= IP22ZILOG_FLAG_TX_ACTIVE;
  344. writeb(xmit->buf[xmit->tail], &channel->data);
  345. ZSDELAY();
  346. ZS_WSYNC(channel);
  347. xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
  348. up->port.icount.tx++;
  349. if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
  350. uart_write_wakeup(&up->port);
  351. return;
  352. ack_tx_int:
  353. writeb(RES_Tx_P, &channel->control);
  354. ZSDELAY();
  355. ZS_WSYNC(channel);
  356. }
  357. static irqreturn_t ip22zilog_interrupt(int irq, void *dev_id)
  358. {
  359. struct uart_ip22zilog_port *up = dev_id;
  360. while (up) {
  361. struct zilog_channel *channel
  362. = ZILOG_CHANNEL_FROM_PORT(&up->port);
  363. struct tty_struct *tty;
  364. unsigned char r3;
  365. spin_lock(&up->port.lock);
  366. r3 = read_zsreg(channel, R3);
  367. /* Channel A */
  368. tty = NULL;
  369. if (r3 & (CHAEXT | CHATxIP | CHARxIP)) {
  370. writeb(RES_H_IUS, &channel->control);
  371. ZSDELAY();
  372. ZS_WSYNC(channel);
  373. if (r3 & CHARxIP)
  374. tty = ip22zilog_receive_chars(up, channel);
  375. if (r3 & CHAEXT)
  376. ip22zilog_status_handle(up, channel);
  377. if (r3 & CHATxIP)
  378. ip22zilog_transmit_chars(up, channel);
  379. }
  380. spin_unlock(&up->port.lock);
  381. if (tty)
  382. tty_flip_buffer_push(tty);
  383. /* Channel B */
  384. up = up->next;
  385. channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
  386. spin_lock(&up->port.lock);
  387. tty = NULL;
  388. if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) {
  389. writeb(RES_H_IUS, &channel->control);
  390. ZSDELAY();
  391. ZS_WSYNC(channel);
  392. if (r3 & CHBRxIP)
  393. tty = ip22zilog_receive_chars(up, channel);
  394. if (r3 & CHBEXT)
  395. ip22zilog_status_handle(up, channel);
  396. if (r3 & CHBTxIP)
  397. ip22zilog_transmit_chars(up, channel);
  398. }
  399. spin_unlock(&up->port.lock);
  400. if (tty)
  401. tty_flip_buffer_push(tty);
  402. up = up->next;
  403. }
  404. return IRQ_HANDLED;
  405. }
  406. /* A convenient way to quickly get R0 status. The caller must _not_ hold the
  407. * port lock, it is acquired here.
  408. */
  409. static __inline__ unsigned char ip22zilog_read_channel_status(struct uart_port *port)
  410. {
  411. struct zilog_channel *channel;
  412. unsigned char status;
  413. channel = ZILOG_CHANNEL_FROM_PORT(port);
  414. status = readb(&channel->control);
  415. ZSDELAY();
  416. return status;
  417. }
  418. /* The port lock is not held. */
  419. static unsigned int ip22zilog_tx_empty(struct uart_port *port)
  420. {
  421. unsigned long flags;
  422. unsigned char status;
  423. unsigned int ret;
  424. spin_lock_irqsave(&port->lock, flags);
  425. status = ip22zilog_read_channel_status(port);
  426. spin_unlock_irqrestore(&port->lock, flags);
  427. if (status & Tx_BUF_EMP)
  428. ret = TIOCSER_TEMT;
  429. else
  430. ret = 0;
  431. return ret;
  432. }
  433. /* The port lock is held and interrupts are disabled. */
  434. static unsigned int ip22zilog_get_mctrl(struct uart_port *port)
  435. {
  436. unsigned char status;
  437. unsigned int ret;
  438. status = ip22zilog_read_channel_status(port);
  439. ret = 0;
  440. if (status & DCD)
  441. ret |= TIOCM_CAR;
  442. if (status & SYNC)
  443. ret |= TIOCM_DSR;
  444. if (status & CTS)
  445. ret |= TIOCM_CTS;
  446. return ret;
  447. }
  448. /* The port lock is held and interrupts are disabled. */
  449. static void ip22zilog_set_mctrl(struct uart_port *port, unsigned int mctrl)
  450. {
  451. struct uart_ip22zilog_port *up = (struct uart_ip22zilog_port *) port;
  452. struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port);
  453. unsigned char set_bits, clear_bits;
  454. set_bits = clear_bits = 0;
  455. if (mctrl & TIOCM_RTS)
  456. set_bits |= RTS;
  457. else
  458. clear_bits |= RTS;
  459. if (mctrl & TIOCM_DTR)
  460. set_bits |= DTR;
  461. else
  462. clear_bits |= DTR;
  463. /* NOTE: Not subject to 'transmitter active' rule. */
  464. up->curregs[R5] |= set_bits;
  465. up->curregs[R5] &= ~clear_bits;
  466. write_zsreg(channel, R5, up->curregs[R5]);
  467. }
  468. /* The port lock is held and interrupts are disabled. */
  469. static void ip22zilog_stop_tx(struct uart_port *port)
  470. {
  471. struct uart_ip22zilog_port *up = (struct uart_ip22zilog_port *) port;
  472. up->flags |= IP22ZILOG_FLAG_TX_STOPPED;
  473. }
  474. /* The port lock is held and interrupts are disabled. */
  475. static void ip22zilog_start_tx(struct uart_port *port)
  476. {
  477. struct uart_ip22zilog_port *up = (struct uart_ip22zilog_port *) port;
  478. struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port);
  479. unsigned char status;
  480. up->flags |= IP22ZILOG_FLAG_TX_ACTIVE;
  481. up->flags &= ~IP22ZILOG_FLAG_TX_STOPPED;
  482. status = readb(&channel->control);
  483. ZSDELAY();
  484. /* TX busy? Just wait for the TX done interrupt. */
  485. if (!(status & Tx_BUF_EMP))
  486. return;
  487. /* Send the first character to jump-start the TX done
  488. * IRQ sending engine.
  489. */
  490. if (port->x_char) {
  491. writeb(port->x_char, &channel->data);
  492. ZSDELAY();
  493. ZS_WSYNC(channel);
  494. port->icount.tx++;
  495. port->x_char = 0;
  496. } else {
  497. struct circ_buf *xmit = &port->state->xmit;
  498. writeb(xmit->buf[xmit->tail], &channel->data);
  499. ZSDELAY();
  500. ZS_WSYNC(channel);
  501. xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
  502. port->icount.tx++;
  503. if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
  504. uart_write_wakeup(&up->port);
  505. }
  506. }
  507. /* The port lock is held and interrupts are disabled. */
  508. static void ip22zilog_stop_rx(struct uart_port *port)
  509. {
  510. struct uart_ip22zilog_port *up = UART_ZILOG(port);
  511. struct zilog_channel *channel;
  512. if (ZS_IS_CONS(up))
  513. return;
  514. channel = ZILOG_CHANNEL_FROM_PORT(port);
  515. /* Disable all RX interrupts. */
  516. up->curregs[R1] &= ~RxINT_MASK;
  517. ip22zilog_maybe_update_regs(up, channel);
  518. }
  519. /* The port lock is held. */
  520. static void ip22zilog_enable_ms(struct uart_port *port)
  521. {
  522. struct uart_ip22zilog_port *up = (struct uart_ip22zilog_port *) port;
  523. struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port);
  524. unsigned char new_reg;
  525. new_reg = up->curregs[R15] | (DCDIE | SYNCIE | CTSIE);
  526. if (new_reg != up->curregs[R15]) {
  527. up->curregs[R15] = new_reg;
  528. /* NOTE: Not subject to 'transmitter active' rule. */
  529. write_zsreg(channel, R15, up->curregs[R15]);
  530. }
  531. }
  532. /* The port lock is not held. */
  533. static void ip22zilog_break_ctl(struct uart_port *port, int break_state)
  534. {
  535. struct uart_ip22zilog_port *up = (struct uart_ip22zilog_port *) port;
  536. struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port);
  537. unsigned char set_bits, clear_bits, new_reg;
  538. unsigned long flags;
  539. set_bits = clear_bits = 0;
  540. if (break_state)
  541. set_bits |= SND_BRK;
  542. else
  543. clear_bits |= SND_BRK;
  544. spin_lock_irqsave(&port->lock, flags);
  545. new_reg = (up->curregs[R5] | set_bits) & ~clear_bits;
  546. if (new_reg != up->curregs[R5]) {
  547. up->curregs[R5] = new_reg;
  548. /* NOTE: Not subject to 'transmitter active' rule. */
  549. write_zsreg(channel, R5, up->curregs[R5]);
  550. }
  551. spin_unlock_irqrestore(&port->lock, flags);
  552. }
  553. static void __ip22zilog_reset(struct uart_ip22zilog_port *up)
  554. {
  555. struct zilog_channel *channel;
  556. int i;
  557. if (up->flags & IP22ZILOG_FLAG_RESET_DONE)
  558. return;
  559. /* Let pending transmits finish. */
  560. channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
  561. for (i = 0; i < 1000; i++) {
  562. unsigned char stat = read_zsreg(channel, R1);
  563. if (stat & ALL_SNT)
  564. break;
  565. udelay(100);
  566. }
  567. if (!ZS_IS_CHANNEL_A(up)) {
  568. up++;
  569. channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
  570. }
  571. write_zsreg(channel, R9, FHWRES);
  572. ZSDELAY_LONG();
  573. (void) read_zsreg(channel, R0);
  574. up->flags |= IP22ZILOG_FLAG_RESET_DONE;
  575. up->next->flags |= IP22ZILOG_FLAG_RESET_DONE;
  576. }
  577. static void __ip22zilog_startup(struct uart_ip22zilog_port *up)
  578. {
  579. struct zilog_channel *channel;
  580. channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
  581. __ip22zilog_reset(up);
  582. __load_zsregs(channel, up->curregs);
  583. /* set master interrupt enable */
  584. write_zsreg(channel, R9, up->curregs[R9]);
  585. up->prev_status = readb(&channel->control);
  586. /* Enable receiver and transmitter. */
  587. up->curregs[R3] |= RxENAB;
  588. up->curregs[R5] |= TxENAB;
  589. up->curregs[R1] |= EXT_INT_ENAB | INT_ALL_Rx | TxINT_ENAB;
  590. ip22zilog_maybe_update_regs(up, channel);
  591. }
  592. static int ip22zilog_startup(struct uart_port *port)
  593. {
  594. struct uart_ip22zilog_port *up = UART_ZILOG(port);
  595. unsigned long flags;
  596. if (ZS_IS_CONS(up))
  597. return 0;
  598. spin_lock_irqsave(&port->lock, flags);
  599. __ip22zilog_startup(up);
  600. spin_unlock_irqrestore(&port->lock, flags);
  601. return 0;
  602. }
  603. /*
  604. * The test for ZS_IS_CONS is explained by the following e-mail:
  605. *****
  606. * From: Russell King <rmk@arm.linux.org.uk>
  607. * Date: Sun, 8 Dec 2002 10:18:38 +0000
  608. *
  609. * On Sun, Dec 08, 2002 at 02:43:36AM -0500, Pete Zaitcev wrote:
  610. * > I boot my 2.5 boxes using "console=ttyS0,9600" argument,
  611. * > and I noticed that something is not right with reference
  612. * > counting in this case. It seems that when the console
  613. * > is open by kernel initially, this is not accounted
  614. * > as an open, and uart_startup is not called.
  615. *
  616. * That is correct. We are unable to call uart_startup when the serial
  617. * console is initialised because it may need to allocate memory (as
  618. * request_irq does) and the memory allocators may not have been
  619. * initialised.
  620. *
  621. * 1. initialise the port into a state where it can send characters in the
  622. * console write method.
  623. *
  624. * 2. don't do the actual hardware shutdown in your shutdown() method (but
  625. * do the normal software shutdown - ie, free irqs etc)
  626. *****
  627. */
  628. static void ip22zilog_shutdown(struct uart_port *port)
  629. {
  630. struct uart_ip22zilog_port *up = UART_ZILOG(port);
  631. struct zilog_channel *channel;
  632. unsigned long flags;
  633. if (ZS_IS_CONS(up))
  634. return;
  635. spin_lock_irqsave(&port->lock, flags);
  636. channel = ZILOG_CHANNEL_FROM_PORT(port);
  637. /* Disable receiver and transmitter. */
  638. up->curregs[R3] &= ~RxENAB;
  639. up->curregs[R5] &= ~TxENAB;
  640. /* Disable all interrupts and BRK assertion. */
  641. up->curregs[R1] &= ~(EXT_INT_ENAB | TxINT_ENAB | RxINT_MASK);
  642. up->curregs[R5] &= ~SND_BRK;
  643. ip22zilog_maybe_update_regs(up, channel);
  644. spin_unlock_irqrestore(&port->lock, flags);
  645. }
  646. /* Shared by TTY driver and serial console setup. The port lock is held
  647. * and local interrupts are disabled.
  648. */
  649. static void
  650. ip22zilog_convert_to_zs(struct uart_ip22zilog_port *up, unsigned int cflag,
  651. unsigned int iflag, int brg)
  652. {
  653. up->curregs[R10] = NRZ;
  654. up->curregs[R11] = TCBR | RCBR;
  655. /* Program BAUD and clock source. */
  656. up->curregs[R4] &= ~XCLK_MASK;
  657. up->curregs[R4] |= X16CLK;
  658. up->curregs[R12] = brg & 0xff;
  659. up->curregs[R13] = (brg >> 8) & 0xff;
  660. up->curregs[R14] = BRENAB;
  661. /* Character size, stop bits, and parity. */
  662. up->curregs[3] &= ~RxN_MASK;
  663. up->curregs[5] &= ~TxN_MASK;
  664. switch (cflag & CSIZE) {
  665. case CS5:
  666. up->curregs[3] |= Rx5;
  667. up->curregs[5] |= Tx5;
  668. up->parity_mask = 0x1f;
  669. break;
  670. case CS6:
  671. up->curregs[3] |= Rx6;
  672. up->curregs[5] |= Tx6;
  673. up->parity_mask = 0x3f;
  674. break;
  675. case CS7:
  676. up->curregs[3] |= Rx7;
  677. up->curregs[5] |= Tx7;
  678. up->parity_mask = 0x7f;
  679. break;
  680. case CS8:
  681. default:
  682. up->curregs[3] |= Rx8;
  683. up->curregs[5] |= Tx8;
  684. up->parity_mask = 0xff;
  685. break;
  686. };
  687. up->curregs[4] &= ~0x0c;
  688. if (cflag & CSTOPB)
  689. up->curregs[4] |= SB2;
  690. else
  691. up->curregs[4] |= SB1;
  692. if (cflag & PARENB)
  693. up->curregs[4] |= PAR_ENAB;
  694. else
  695. up->curregs[4] &= ~PAR_ENAB;
  696. if (!(cflag & PARODD))
  697. up->curregs[4] |= PAR_EVEN;
  698. else
  699. up->curregs[4] &= ~PAR_EVEN;
  700. up->port.read_status_mask = Rx_OVR;
  701. if (iflag & INPCK)
  702. up->port.read_status_mask |= CRC_ERR | PAR_ERR;
  703. if (iflag & (BRKINT | PARMRK))
  704. up->port.read_status_mask |= BRK_ABRT;
  705. up->port.ignore_status_mask = 0;
  706. if (iflag & IGNPAR)
  707. up->port.ignore_status_mask |= CRC_ERR | PAR_ERR;
  708. if (iflag & IGNBRK) {
  709. up->port.ignore_status_mask |= BRK_ABRT;
  710. if (iflag & IGNPAR)
  711. up->port.ignore_status_mask |= Rx_OVR;
  712. }
  713. if ((cflag & CREAD) == 0)
  714. up->port.ignore_status_mask = 0xff;
  715. }
  716. /* The port lock is not held. */
  717. static void
  718. ip22zilog_set_termios(struct uart_port *port, struct ktermios *termios,
  719. struct ktermios *old)
  720. {
  721. struct uart_ip22zilog_port *up = (struct uart_ip22zilog_port *) port;
  722. unsigned long flags;
  723. int baud, brg;
  724. baud = uart_get_baud_rate(port, termios, old, 1200, 76800);
  725. spin_lock_irqsave(&up->port.lock, flags);
  726. brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR);
  727. ip22zilog_convert_to_zs(up, termios->c_cflag, termios->c_iflag, brg);
  728. if (UART_ENABLE_MS(&up->port, termios->c_cflag))
  729. up->flags |= IP22ZILOG_FLAG_MODEM_STATUS;
  730. else
  731. up->flags &= ~IP22ZILOG_FLAG_MODEM_STATUS;
  732. ip22zilog_maybe_update_regs(up, ZILOG_CHANNEL_FROM_PORT(port));
  733. uart_update_timeout(port, termios->c_cflag, baud);
  734. spin_unlock_irqrestore(&up->port.lock, flags);
  735. }
  736. static const char *ip22zilog_type(struct uart_port *port)
  737. {
  738. return "IP22-Zilog";
  739. }
  740. /* We do not request/release mappings of the registers here, this
  741. * happens at early serial probe time.
  742. */
  743. static void ip22zilog_release_port(struct uart_port *port)
  744. {
  745. }
  746. static int ip22zilog_request_port(struct uart_port *port)
  747. {
  748. return 0;
  749. }
  750. /* These do not need to do anything interesting either. */
  751. static void ip22zilog_config_port(struct uart_port *port, int flags)
  752. {
  753. }
  754. /* We do not support letting the user mess with the divisor, IRQ, etc. */
  755. static int ip22zilog_verify_port(struct uart_port *port, struct serial_struct *ser)
  756. {
  757. return -EINVAL;
  758. }
  759. static struct uart_ops ip22zilog_pops = {
  760. .tx_empty = ip22zilog_tx_empty,
  761. .set_mctrl = ip22zilog_set_mctrl,
  762. .get_mctrl = ip22zilog_get_mctrl,
  763. .stop_tx = ip22zilog_stop_tx,
  764. .start_tx = ip22zilog_start_tx,
  765. .stop_rx = ip22zilog_stop_rx,
  766. .enable_ms = ip22zilog_enable_ms,
  767. .break_ctl = ip22zilog_break_ctl,
  768. .startup = ip22zilog_startup,
  769. .shutdown = ip22zilog_shutdown,
  770. .set_termios = ip22zilog_set_termios,
  771. .type = ip22zilog_type,
  772. .release_port = ip22zilog_release_port,
  773. .request_port = ip22zilog_request_port,
  774. .config_port = ip22zilog_config_port,
  775. .verify_port = ip22zilog_verify_port,
  776. };
  777. static struct uart_ip22zilog_port *ip22zilog_port_table;
  778. static struct zilog_layout **ip22zilog_chip_regs;
  779. static struct uart_ip22zilog_port *ip22zilog_irq_chain;
  780. static int zilog_irq = -1;
  781. static void * __init alloc_one_table(unsigned long size)
  782. {
  783. return kzalloc(size, GFP_KERNEL);
  784. }
  785. static void __init ip22zilog_alloc_tables(void)
  786. {
  787. ip22zilog_port_table = (struct uart_ip22zilog_port *)
  788. alloc_one_table(NUM_CHANNELS * sizeof(struct uart_ip22zilog_port));
  789. ip22zilog_chip_regs = (struct zilog_layout **)
  790. alloc_one_table(NUM_IP22ZILOG * sizeof(struct zilog_layout *));
  791. if (ip22zilog_port_table == NULL || ip22zilog_chip_regs == NULL) {
  792. panic("IP22-Zilog: Cannot allocate IP22-Zilog tables.");
  793. }
  794. }
  795. /* Get the address of the registers for IP22-Zilog instance CHIP. */
  796. static struct zilog_layout * __init get_zs(int chip)
  797. {
  798. unsigned long base;
  799. if (chip < 0 || chip >= NUM_IP22ZILOG) {
  800. panic("IP22-Zilog: Illegal chip number %d in get_zs.", chip);
  801. }
  802. /* Not probe-able, hard code it. */
  803. base = (unsigned long) &sgioc->uart;
  804. zilog_irq = SGI_SERIAL_IRQ;
  805. request_mem_region(base, 8, "IP22-Zilog");
  806. return (struct zilog_layout *) base;
  807. }
  808. #define ZS_PUT_CHAR_MAX_DELAY 2000 /* 10 ms */
  809. #ifdef CONFIG_SERIAL_IP22_ZILOG_CONSOLE
  810. static void ip22zilog_put_char(struct uart_port *port, int ch)
  811. {
  812. struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port);
  813. int loops = ZS_PUT_CHAR_MAX_DELAY;
  814. /* This is a timed polling loop so do not switch the explicit
  815. * udelay with ZSDELAY as that is a NOP on some platforms. -DaveM
  816. */
  817. do {
  818. unsigned char val = readb(&channel->control);
  819. if (val & Tx_BUF_EMP) {
  820. ZSDELAY();
  821. break;
  822. }
  823. udelay(5);
  824. } while (--loops);
  825. writeb(ch, &channel->data);
  826. ZSDELAY();
  827. ZS_WSYNC(channel);
  828. }
  829. static void
  830. ip22zilog_console_write(struct console *con, const char *s, unsigned int count)
  831. {
  832. struct uart_ip22zilog_port *up = &ip22zilog_port_table[con->index];
  833. unsigned long flags;
  834. spin_lock_irqsave(&up->port.lock, flags);
  835. uart_console_write(&up->port, s, count, ip22zilog_put_char);
  836. udelay(2);
  837. spin_unlock_irqrestore(&up->port.lock, flags);
  838. }
  839. static int __init ip22zilog_console_setup(struct console *con, char *options)
  840. {
  841. struct uart_ip22zilog_port *up = &ip22zilog_port_table[con->index];
  842. unsigned long flags;
  843. int baud = 9600, bits = 8;
  844. int parity = 'n';
  845. int flow = 'n';
  846. up->flags |= IP22ZILOG_FLAG_IS_CONS;
  847. printk(KERN_INFO "Console: ttyS%d (IP22-Zilog)\n", con->index);
  848. spin_lock_irqsave(&up->port.lock, flags);
  849. up->curregs[R15] |= BRKIE;
  850. __ip22zilog_startup(up);
  851. spin_unlock_irqrestore(&up->port.lock, flags);
  852. if (options)
  853. uart_parse_options(options, &baud, &parity, &bits, &flow);
  854. return uart_set_options(&up->port, con, baud, parity, bits, flow);
  855. }
  856. static struct uart_driver ip22zilog_reg;
  857. static struct console ip22zilog_console = {
  858. .name = "ttyS",
  859. .write = ip22zilog_console_write,
  860. .device = uart_console_device,
  861. .setup = ip22zilog_console_setup,
  862. .flags = CON_PRINTBUFFER,
  863. .index = -1,
  864. .data = &ip22zilog_reg,
  865. };
  866. #endif /* CONFIG_SERIAL_IP22_ZILOG_CONSOLE */
  867. static struct uart_driver ip22zilog_reg = {
  868. .owner = THIS_MODULE,
  869. .driver_name = "serial",
  870. .dev_name = "ttyS",
  871. .major = TTY_MAJOR,
  872. .minor = 64,
  873. .nr = NUM_CHANNELS,
  874. #ifdef CONFIG_SERIAL_IP22_ZILOG_CONSOLE
  875. .cons = &ip22zilog_console,
  876. #endif
  877. };
  878. static void __init ip22zilog_prepare(void)
  879. {
  880. struct uart_ip22zilog_port *up;
  881. struct zilog_layout *rp;
  882. int channel, chip;
  883. /*
  884. * Temporary fix.
  885. */
  886. for (channel = 0; channel < NUM_CHANNELS; channel++)
  887. spin_lock_init(&ip22zilog_port_table[channel].port.lock);
  888. ip22zilog_irq_chain = &ip22zilog_port_table[NUM_CHANNELS - 1];
  889. up = &ip22zilog_port_table[0];
  890. for (channel = NUM_CHANNELS - 1 ; channel > 0; channel--)
  891. up[channel].next = &up[channel - 1];
  892. up[channel].next = NULL;
  893. for (chip = 0; chip < NUM_IP22ZILOG; chip++) {
  894. if (!ip22zilog_chip_regs[chip]) {
  895. ip22zilog_chip_regs[chip] = rp = get_zs(chip);
  896. up[(chip * 2) + 0].port.membase = (char *) &rp->channelB;
  897. up[(chip * 2) + 1].port.membase = (char *) &rp->channelA;
  898. /* In theory mapbase is the physical address ... */
  899. up[(chip * 2) + 0].port.mapbase =
  900. (unsigned long) ioremap((unsigned long) &rp->channelB, 8);
  901. up[(chip * 2) + 1].port.mapbase =
  902. (unsigned long) ioremap((unsigned long) &rp->channelA, 8);
  903. }
  904. /* Channel A */
  905. up[(chip * 2) + 0].port.iotype = UPIO_MEM;
  906. up[(chip * 2) + 0].port.irq = zilog_irq;
  907. up[(chip * 2) + 0].port.uartclk = ZS_CLOCK;
  908. up[(chip * 2) + 0].port.fifosize = 1;
  909. up[(chip * 2) + 0].port.ops = &ip22zilog_pops;
  910. up[(chip * 2) + 0].port.type = PORT_IP22ZILOG;
  911. up[(chip * 2) + 0].port.flags = 0;
  912. up[(chip * 2) + 0].port.line = (chip * 2) + 0;
  913. up[(chip * 2) + 0].flags = 0;
  914. /* Channel B */
  915. up[(chip * 2) + 1].port.iotype = UPIO_MEM;
  916. up[(chip * 2) + 1].port.irq = zilog_irq;
  917. up[(chip * 2) + 1].port.uartclk = ZS_CLOCK;
  918. up[(chip * 2) + 1].port.fifosize = 1;
  919. up[(chip * 2) + 1].port.ops = &ip22zilog_pops;
  920. up[(chip * 2) + 1].port.type = PORT_IP22ZILOG;
  921. up[(chip * 2) + 1].port.line = (chip * 2) + 1;
  922. up[(chip * 2) + 1].flags |= IP22ZILOG_FLAG_IS_CHANNEL_A;
  923. }
  924. for (channel = 0; channel < NUM_CHANNELS; channel++) {
  925. struct uart_ip22zilog_port *up = &ip22zilog_port_table[channel];
  926. int brg;
  927. /* Normal serial TTY. */
  928. up->parity_mask = 0xff;
  929. up->curregs[R1] = EXT_INT_ENAB | INT_ALL_Rx | TxINT_ENAB;
  930. up->curregs[R4] = PAR_EVEN | X16CLK | SB1;
  931. up->curregs[R3] = RxENAB | Rx8;
  932. up->curregs[R5] = TxENAB | Tx8;
  933. up->curregs[R9] = NV | MIE;
  934. up->curregs[R10] = NRZ;
  935. up->curregs[R11] = TCBR | RCBR;
  936. brg = BPS_TO_BRG(9600, ZS_CLOCK / ZS_CLOCK_DIVISOR);
  937. up->curregs[R12] = (brg & 0xff);
  938. up->curregs[R13] = (brg >> 8) & 0xff;
  939. up->curregs[R14] = BRENAB;
  940. }
  941. }
  942. static int __init ip22zilog_ports_init(void)
  943. {
  944. int ret;
  945. printk(KERN_INFO "Serial: IP22 Zilog driver (%d chips).\n", NUM_IP22ZILOG);
  946. ip22zilog_prepare();
  947. if (request_irq(zilog_irq, ip22zilog_interrupt, 0,
  948. "IP22-Zilog", ip22zilog_irq_chain)) {
  949. panic("IP22-Zilog: Unable to register zs interrupt handler.\n");
  950. }
  951. ret = uart_register_driver(&ip22zilog_reg);
  952. if (ret == 0) {
  953. int i;
  954. for (i = 0; i < NUM_CHANNELS; i++) {
  955. struct uart_ip22zilog_port *up = &ip22zilog_port_table[i];
  956. uart_add_one_port(&ip22zilog_reg, &up->port);
  957. }
  958. }
  959. return ret;
  960. }
  961. static int __init ip22zilog_init(void)
  962. {
  963. /* IP22 Zilog setup is hard coded, no probing to do. */
  964. ip22zilog_alloc_tables();
  965. ip22zilog_ports_init();
  966. return 0;
  967. }
  968. static void __exit ip22zilog_exit(void)
  969. {
  970. int i;
  971. struct uart_ip22zilog_port *up;
  972. for (i = 0; i < NUM_CHANNELS; i++) {
  973. up = &ip22zilog_port_table[i];
  974. uart_remove_one_port(&ip22zilog_reg, &up->port);
  975. }
  976. /* Free IO mem */
  977. up = &ip22zilog_port_table[0];
  978. for (i = 0; i < NUM_IP22ZILOG; i++) {
  979. if (up[(i * 2) + 0].port.mapbase) {
  980. iounmap((void*)up[(i * 2) + 0].port.mapbase);
  981. up[(i * 2) + 0].port.mapbase = 0;
  982. }
  983. if (up[(i * 2) + 1].port.mapbase) {
  984. iounmap((void*)up[(i * 2) + 1].port.mapbase);
  985. up[(i * 2) + 1].port.mapbase = 0;
  986. }
  987. }
  988. uart_unregister_driver(&ip22zilog_reg);
  989. }
  990. module_init(ip22zilog_init);
  991. module_exit(ip22zilog_exit);
  992. /* David wrote it but I'm to blame for the bugs ... */
  993. MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
  994. MODULE_DESCRIPTION("SGI Zilog serial port driver");
  995. MODULE_LICENSE("GPL");