ip22zilog.c 31 KB

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