ip22zilog.c 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223
  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 ([email protected])
  14. * Copyright (C) 2002 David S. Miller ([email protected])
  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 <linux/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. #include <linux/serial_core.h>
  40. #include "ip22zilog.h"
  41. /*
  42. * On IP22 we need to delay after register accesses but we do not need to
  43. * flush writes.
  44. */
  45. #define ZSDELAY() udelay(5)
  46. #define ZSDELAY_LONG() udelay(20)
  47. #define ZS_WSYNC(channel) do { } while (0)
  48. #define NUM_IP22ZILOG 1
  49. #define NUM_CHANNELS (NUM_IP22ZILOG * 2)
  50. #define ZS_CLOCK 3672000 /* Zilog input clock rate. */
  51. #define ZS_CLOCK_DIVISOR 16 /* Divisor this driver uses. */
  52. /*
  53. * We wrap our port structure around the generic uart_port.
  54. */
  55. struct uart_ip22zilog_port {
  56. struct uart_port port;
  57. /* IRQ servicing chain. */
  58. struct uart_ip22zilog_port *next;
  59. /* Current values of Zilog write registers. */
  60. unsigned char curregs[NUM_ZSREGS];
  61. unsigned int flags;
  62. #define IP22ZILOG_FLAG_IS_CONS 0x00000004
  63. #define IP22ZILOG_FLAG_IS_KGDB 0x00000008
  64. #define IP22ZILOG_FLAG_MODEM_STATUS 0x00000010
  65. #define IP22ZILOG_FLAG_IS_CHANNEL_A 0x00000020
  66. #define IP22ZILOG_FLAG_REGS_HELD 0x00000040
  67. #define IP22ZILOG_FLAG_TX_STOPPED 0x00000080
  68. #define IP22ZILOG_FLAG_TX_ACTIVE 0x00000100
  69. #define IP22ZILOG_FLAG_RESET_DONE 0x00000200
  70. unsigned int tty_break;
  71. unsigned char parity_mask;
  72. unsigned char prev_status;
  73. };
  74. #define ZILOG_CHANNEL_FROM_PORT(PORT) ((struct zilog_channel *)((PORT)->membase))
  75. #define UART_ZILOG(PORT) ((struct uart_ip22zilog_port *)(PORT))
  76. #define IP22ZILOG_GET_CURR_REG(PORT, REGNUM) \
  77. (UART_ZILOG(PORT)->curregs[REGNUM])
  78. #define IP22ZILOG_SET_CURR_REG(PORT, REGNUM, REGVAL) \
  79. ((UART_ZILOG(PORT)->curregs[REGNUM]) = (REGVAL))
  80. #define ZS_IS_CONS(UP) ((UP)->flags & IP22ZILOG_FLAG_IS_CONS)
  81. #define ZS_IS_KGDB(UP) ((UP)->flags & IP22ZILOG_FLAG_IS_KGDB)
  82. #define ZS_WANTS_MODEM_STATUS(UP) ((UP)->flags & IP22ZILOG_FLAG_MODEM_STATUS)
  83. #define ZS_IS_CHANNEL_A(UP) ((UP)->flags & IP22ZILOG_FLAG_IS_CHANNEL_A)
  84. #define ZS_REGS_HELD(UP) ((UP)->flags & IP22ZILOG_FLAG_REGS_HELD)
  85. #define ZS_TX_STOPPED(UP) ((UP)->flags & IP22ZILOG_FLAG_TX_STOPPED)
  86. #define ZS_TX_ACTIVE(UP) ((UP)->flags & IP22ZILOG_FLAG_TX_ACTIVE)
  87. /* Reading and writing Zilog8530 registers. The delays are to make this
  88. * driver work on the IP22 which needs a settling delay after each chip
  89. * register access, other machines handle this in hardware via auxiliary
  90. * flip-flops which implement the settle time we do in software.
  91. *
  92. * The port lock must be held and local IRQs must be disabled
  93. * when {read,write}_zsreg is invoked.
  94. */
  95. static unsigned char read_zsreg(struct zilog_channel *channel,
  96. unsigned char reg)
  97. {
  98. unsigned char retval;
  99. writeb(reg, &channel->control);
  100. ZSDELAY();
  101. retval = readb(&channel->control);
  102. ZSDELAY();
  103. return retval;
  104. }
  105. static void write_zsreg(struct zilog_channel *channel,
  106. unsigned char reg, unsigned char value)
  107. {
  108. writeb(reg, &channel->control);
  109. ZSDELAY();
  110. writeb(value, &channel->control);
  111. ZSDELAY();
  112. }
  113. static void ip22zilog_clear_fifo(struct zilog_channel *channel)
  114. {
  115. int i;
  116. for (i = 0; i < 32; i++) {
  117. unsigned char regval;
  118. regval = readb(&channel->control);
  119. ZSDELAY();
  120. if (regval & Rx_CH_AV)
  121. break;
  122. regval = read_zsreg(channel, R1);
  123. readb(&channel->data);
  124. ZSDELAY();
  125. if (regval & (PAR_ERR | Rx_OVR | CRC_ERR)) {
  126. writeb(ERR_RES, &channel->control);
  127. ZSDELAY();
  128. ZS_WSYNC(channel);
  129. }
  130. }
  131. }
  132. /* This function must only be called when the TX is not busy. The UART
  133. * port lock must be held and local interrupts disabled.
  134. */
  135. static void __load_zsregs(struct zilog_channel *channel, unsigned char *regs)
  136. {
  137. int i;
  138. /* Let pending transmits finish. */
  139. for (i = 0; i < 1000; i++) {
  140. unsigned char stat = read_zsreg(channel, R1);
  141. if (stat & ALL_SNT)
  142. break;
  143. udelay(100);
  144. }
  145. writeb(ERR_RES, &channel->control);
  146. ZSDELAY();
  147. ZS_WSYNC(channel);
  148. ip22zilog_clear_fifo(channel);
  149. /* Disable all interrupts. */
  150. write_zsreg(channel, R1,
  151. regs[R1] & ~(RxINT_MASK | TxINT_ENAB | EXT_INT_ENAB));
  152. /* Set parity, sync config, stop bits, and clock divisor. */
  153. write_zsreg(channel, R4, regs[R4]);
  154. /* Set misc. TX/RX control bits. */
  155. write_zsreg(channel, R10, regs[R10]);
  156. /* Set TX/RX controls sans the enable bits. */
  157. write_zsreg(channel, R3, regs[R3] & ~RxENAB);
  158. write_zsreg(channel, R5, regs[R5] & ~TxENAB);
  159. /* Synchronous mode config. */
  160. write_zsreg(channel, R6, regs[R6]);
  161. write_zsreg(channel, R7, regs[R7]);
  162. /* Don't mess with the interrupt vector (R2, unused by us) and
  163. * master interrupt control (R9). We make sure this is setup
  164. * properly at probe time then never touch it again.
  165. */
  166. /* Disable baud generator. */
  167. write_zsreg(channel, R14, regs[R14] & ~BRENAB);
  168. /* Clock mode control. */
  169. write_zsreg(channel, R11, regs[R11]);
  170. /* Lower and upper byte of baud rate generator divisor. */
  171. write_zsreg(channel, R12, regs[R12]);
  172. write_zsreg(channel, R13, regs[R13]);
  173. /* Now rewrite R14, with BRENAB (if set). */
  174. write_zsreg(channel, R14, regs[R14]);
  175. /* External status interrupt control. */
  176. write_zsreg(channel, R15, regs[R15]);
  177. /* Reset external status interrupts. */
  178. write_zsreg(channel, R0, RES_EXT_INT);
  179. write_zsreg(channel, R0, RES_EXT_INT);
  180. /* Rewrite R3/R5, this time without enables masked. */
  181. write_zsreg(channel, R3, regs[R3]);
  182. write_zsreg(channel, R5, regs[R5]);
  183. /* Rewrite R1, this time without IRQ enabled masked. */
  184. write_zsreg(channel, R1, regs[R1]);
  185. }
  186. /* Reprogram the Zilog channel HW registers with the copies found in the
  187. * software state struct. If the transmitter is busy, we defer this update
  188. * until the next TX complete interrupt. Else, we do it right now.
  189. *
  190. * The UART port lock must be held and local interrupts disabled.
  191. */
  192. static void ip22zilog_maybe_update_regs(struct uart_ip22zilog_port *up,
  193. struct zilog_channel *channel)
  194. {
  195. if (!ZS_REGS_HELD(up)) {
  196. if (ZS_TX_ACTIVE(up)) {
  197. up->flags |= IP22ZILOG_FLAG_REGS_HELD;
  198. } else {
  199. __load_zsregs(channel, up->curregs);
  200. }
  201. }
  202. }
  203. #define Rx_BRK 0x0100 /* BREAK event software flag. */
  204. #define Rx_SYS 0x0200 /* SysRq event software flag. */
  205. static bool ip22zilog_receive_chars(struct uart_ip22zilog_port *up,
  206. struct zilog_channel *channel)
  207. {
  208. unsigned char ch, flag;
  209. unsigned int r1;
  210. bool push = up->port.state != NULL;
  211. for (;;) {
  212. ch = readb(&channel->control);
  213. ZSDELAY();
  214. if (!(ch & Rx_CH_AV))
  215. break;
  216. r1 = read_zsreg(channel, R1);
  217. if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) {
  218. writeb(ERR_RES, &channel->control);
  219. ZSDELAY();
  220. ZS_WSYNC(channel);
  221. }
  222. ch = readb(&channel->data);
  223. ZSDELAY();
  224. ch &= up->parity_mask;
  225. /* Handle the null char got when BREAK is removed. */
  226. if (!ch)
  227. r1 |= up->tty_break;
  228. /* A real serial line, record the character and status. */
  229. flag = TTY_NORMAL;
  230. up->port.icount.rx++;
  231. if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR | Rx_SYS | Rx_BRK)) {
  232. up->tty_break = 0;
  233. if (r1 & (Rx_SYS | Rx_BRK)) {
  234. up->port.icount.brk++;
  235. if (r1 & Rx_SYS)
  236. continue;
  237. r1 &= ~(PAR_ERR | CRC_ERR);
  238. }
  239. else if (r1 & PAR_ERR)
  240. up->port.icount.parity++;
  241. else if (r1 & CRC_ERR)
  242. up->port.icount.frame++;
  243. if (r1 & Rx_OVR)
  244. up->port.icount.overrun++;
  245. r1 &= up->port.read_status_mask;
  246. if (r1 & Rx_BRK)
  247. flag = TTY_BREAK;
  248. else if (r1 & PAR_ERR)
  249. flag = TTY_PARITY;
  250. else if (r1 & CRC_ERR)
  251. flag = TTY_FRAME;
  252. }
  253. if (uart_handle_sysrq_char(&up->port, ch))
  254. continue;
  255. if (push)
  256. uart_insert_char(&up->port, r1, Rx_OVR, ch, flag);
  257. }
  258. return push;
  259. }
  260. static void ip22zilog_status_handle(struct uart_ip22zilog_port *up,
  261. struct zilog_channel *channel)
  262. {
  263. unsigned char status;
  264. status = readb(&channel->control);
  265. ZSDELAY();
  266. writeb(RES_EXT_INT, &channel->control);
  267. ZSDELAY();
  268. ZS_WSYNC(channel);
  269. if (up->curregs[R15] & BRKIE) {
  270. if ((status & BRK_ABRT) && !(up->prev_status & BRK_ABRT)) {
  271. if (uart_handle_break(&up->port))
  272. up->tty_break = Rx_SYS;
  273. else
  274. up->tty_break = Rx_BRK;
  275. }
  276. }
  277. if (ZS_WANTS_MODEM_STATUS(up)) {
  278. if (status & SYNC)
  279. up->port.icount.dsr++;
  280. /* The Zilog just gives us an interrupt when DCD/CTS/etc. change.
  281. * But it does not tell us which bit has changed, we have to keep
  282. * track of this ourselves.
  283. */
  284. if ((status ^ up->prev_status) ^ DCD)
  285. uart_handle_dcd_change(&up->port,
  286. (status & DCD));
  287. if ((status ^ up->prev_status) ^ CTS)
  288. uart_handle_cts_change(&up->port,
  289. (status & CTS));
  290. wake_up_interruptible(&up->port.state->port.delta_msr_wait);
  291. }
  292. up->prev_status = status;
  293. }
  294. static void ip22zilog_transmit_chars(struct uart_ip22zilog_port *up,
  295. struct zilog_channel *channel)
  296. {
  297. struct circ_buf *xmit;
  298. if (ZS_IS_CONS(up)) {
  299. unsigned char status = readb(&channel->control);
  300. ZSDELAY();
  301. /* TX still busy? Just wait for the next TX done interrupt.
  302. *
  303. * It can occur because of how we do serial console writes. It would
  304. * be nice to transmit console writes just like we normally would for
  305. * a TTY line. (ie. buffered and TX interrupt driven). That is not
  306. * easy because console writes cannot sleep. One solution might be
  307. * to poll on enough port->xmit space becoming free. -DaveM
  308. */
  309. if (!(status & Tx_BUF_EMP))
  310. return;
  311. }
  312. up->flags &= ~IP22ZILOG_FLAG_TX_ACTIVE;
  313. if (ZS_REGS_HELD(up)) {
  314. __load_zsregs(channel, up->curregs);
  315. up->flags &= ~IP22ZILOG_FLAG_REGS_HELD;
  316. }
  317. if (ZS_TX_STOPPED(up)) {
  318. up->flags &= ~IP22ZILOG_FLAG_TX_STOPPED;
  319. goto ack_tx_int;
  320. }
  321. if (up->port.x_char) {
  322. up->flags |= IP22ZILOG_FLAG_TX_ACTIVE;
  323. writeb(up->port.x_char, &channel->data);
  324. ZSDELAY();
  325. ZS_WSYNC(channel);
  326. up->port.icount.tx++;
  327. up->port.x_char = 0;
  328. return;
  329. }
  330. if (up->port.state == NULL)
  331. goto ack_tx_int;
  332. xmit = &up->port.state->xmit;
  333. if (uart_circ_empty(xmit))
  334. goto ack_tx_int;
  335. if (uart_tx_stopped(&up->port))
  336. goto ack_tx_int;
  337. up->flags |= IP22ZILOG_FLAG_TX_ACTIVE;
  338. writeb(xmit->buf[xmit->tail], &channel->data);
  339. ZSDELAY();
  340. ZS_WSYNC(channel);
  341. xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
  342. up->port.icount.tx++;
  343. if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
  344. uart_write_wakeup(&up->port);
  345. return;
  346. ack_tx_int:
  347. writeb(RES_Tx_P, &channel->control);
  348. ZSDELAY();
  349. ZS_WSYNC(channel);
  350. }
  351. static irqreturn_t ip22zilog_interrupt(int irq, void *dev_id)
  352. {
  353. struct uart_ip22zilog_port *up = dev_id;
  354. while (up) {
  355. struct zilog_channel *channel
  356. = ZILOG_CHANNEL_FROM_PORT(&up->port);
  357. unsigned char r3;
  358. bool push = false;
  359. spin_lock(&up->port.lock);
  360. r3 = read_zsreg(channel, R3);
  361. /* Channel A */
  362. if (r3 & (CHAEXT | CHATxIP | CHARxIP)) {
  363. writeb(RES_H_IUS, &channel->control);
  364. ZSDELAY();
  365. ZS_WSYNC(channel);
  366. if (r3 & CHARxIP)
  367. push = ip22zilog_receive_chars(up, channel);
  368. if (r3 & CHAEXT)
  369. ip22zilog_status_handle(up, channel);
  370. if (r3 & CHATxIP)
  371. ip22zilog_transmit_chars(up, channel);
  372. }
  373. spin_unlock(&up->port.lock);
  374. if (push)
  375. tty_flip_buffer_push(&up->port.state->port);
  376. /* Channel B */
  377. up = up->next;
  378. channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
  379. push = false;
  380. spin_lock(&up->port.lock);
  381. if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) {
  382. writeb(RES_H_IUS, &channel->control);
  383. ZSDELAY();
  384. ZS_WSYNC(channel);
  385. if (r3 & CHBRxIP)
  386. push = ip22zilog_receive_chars(up, channel);
  387. if (r3 & CHBEXT)
  388. ip22zilog_status_handle(up, channel);
  389. if (r3 & CHBTxIP)
  390. ip22zilog_transmit_chars(up, channel);
  391. }
  392. spin_unlock(&up->port.lock);
  393. if (push)
  394. tty_flip_buffer_push(&up->port.state->port);
  395. up = up->next;
  396. }
  397. return IRQ_HANDLED;
  398. }
  399. /* A convenient way to quickly get R0 status. The caller must _not_ hold the
  400. * port lock, it is acquired here.
  401. */
  402. static __inline__ unsigned char ip22zilog_read_channel_status(struct uart_port *port)
  403. {
  404. struct zilog_channel *channel;
  405. unsigned char status;
  406. channel = ZILOG_CHANNEL_FROM_PORT(port);
  407. status = readb(&channel->control);
  408. ZSDELAY();
  409. return status;
  410. }
  411. /* The port lock is not held. */
  412. static unsigned int ip22zilog_tx_empty(struct uart_port *port)
  413. {
  414. unsigned long flags;
  415. unsigned char status;
  416. unsigned int ret;
  417. spin_lock_irqsave(&port->lock, flags);
  418. status = ip22zilog_read_channel_status(port);
  419. spin_unlock_irqrestore(&port->lock, flags);
  420. if (status & Tx_BUF_EMP)
  421. ret = TIOCSER_TEMT;
  422. else
  423. ret = 0;
  424. return ret;
  425. }
  426. /* The port lock is held and interrupts are disabled. */
  427. static unsigned int ip22zilog_get_mctrl(struct uart_port *port)
  428. {
  429. unsigned char status;
  430. unsigned int ret;
  431. status = ip22zilog_read_channel_status(port);
  432. ret = 0;
  433. if (status & DCD)
  434. ret |= TIOCM_CAR;
  435. if (status & SYNC)
  436. ret |= TIOCM_DSR;
  437. if (status & CTS)
  438. ret |= TIOCM_CTS;
  439. return ret;
  440. }
  441. /* The port lock is held and interrupts are disabled. */
  442. static void ip22zilog_set_mctrl(struct uart_port *port, unsigned int mctrl)
  443. {
  444. struct uart_ip22zilog_port *up =
  445. container_of(port, struct uart_ip22zilog_port, port);
  446. struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port);
  447. unsigned char set_bits, clear_bits;
  448. set_bits = clear_bits = 0;
  449. if (mctrl & TIOCM_RTS)
  450. set_bits |= RTS;
  451. else
  452. clear_bits |= RTS;
  453. if (mctrl & TIOCM_DTR)
  454. set_bits |= DTR;
  455. else
  456. clear_bits |= DTR;
  457. /* NOTE: Not subject to 'transmitter active' rule. */
  458. up->curregs[R5] |= set_bits;
  459. up->curregs[R5] &= ~clear_bits;
  460. write_zsreg(channel, R5, up->curregs[R5]);
  461. }
  462. /* The port lock is held and interrupts are disabled. */
  463. static void ip22zilog_stop_tx(struct uart_port *port)
  464. {
  465. struct uart_ip22zilog_port *up =
  466. container_of(port, struct uart_ip22zilog_port, port);
  467. up->flags |= IP22ZILOG_FLAG_TX_STOPPED;
  468. }
  469. /* The port lock is held and interrupts are disabled. */
  470. static void ip22zilog_start_tx(struct uart_port *port)
  471. {
  472. struct uart_ip22zilog_port *up =
  473. container_of(port, struct uart_ip22zilog_port, port);
  474. struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port);
  475. unsigned char status;
  476. up->flags |= IP22ZILOG_FLAG_TX_ACTIVE;
  477. up->flags &= ~IP22ZILOG_FLAG_TX_STOPPED;
  478. status = readb(&channel->control);
  479. ZSDELAY();
  480. /* TX busy? Just wait for the TX done interrupt. */
  481. if (!(status & Tx_BUF_EMP))
  482. return;
  483. /* Send the first character to jump-start the TX done
  484. * IRQ sending engine.
  485. */
  486. if (port->x_char) {
  487. writeb(port->x_char, &channel->data);
  488. ZSDELAY();
  489. ZS_WSYNC(channel);
  490. port->icount.tx++;
  491. port->x_char = 0;
  492. } else {
  493. struct circ_buf *xmit = &port->state->xmit;
  494. if (uart_circ_empty(xmit))
  495. return;
  496. writeb(xmit->buf[xmit->tail], &channel->data);
  497. ZSDELAY();
  498. ZS_WSYNC(channel);
  499. xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
  500. port->icount.tx++;
  501. if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
  502. uart_write_wakeup(&up->port);
  503. }
  504. }
  505. /* The port lock is held and interrupts are disabled. */
  506. static void ip22zilog_stop_rx(struct uart_port *port)
  507. {
  508. struct uart_ip22zilog_port *up = UART_ZILOG(port);
  509. struct zilog_channel *channel;
  510. if (ZS_IS_CONS(up))
  511. return;
  512. channel = ZILOG_CHANNEL_FROM_PORT(port);
  513. /* Disable all RX interrupts. */
  514. up->curregs[R1] &= ~RxINT_MASK;
  515. ip22zilog_maybe_update_regs(up, channel);
  516. }
  517. /* The port lock is held. */
  518. static void ip22zilog_enable_ms(struct uart_port *port)
  519. {
  520. struct uart_ip22zilog_port *up =
  521. container_of(port, struct uart_ip22zilog_port, port);
  522. struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port);
  523. unsigned char new_reg;
  524. new_reg = up->curregs[R15] | (DCDIE | SYNCIE | CTSIE);
  525. if (new_reg != up->curregs[R15]) {
  526. up->curregs[R15] = new_reg;
  527. /* NOTE: Not subject to 'transmitter active' rule. */
  528. write_zsreg(channel, R15, up->curregs[R15]);
  529. }
  530. }
  531. /* The port lock is not held. */
  532. static void ip22zilog_break_ctl(struct uart_port *port, int break_state)
  533. {
  534. struct uart_ip22zilog_port *up =
  535. container_of(port, 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 <[email protected]>
  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 & (IGNBRK | 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. const struct ktermios *old)
  720. {
  721. struct uart_ip22zilog_port *up =
  722. container_of(port, struct uart_ip22zilog_port, port);
  723. unsigned long flags;
  724. int baud, brg;
  725. baud = uart_get_baud_rate(port, termios, old, 1200, 76800);
  726. spin_lock_irqsave(&up->port.lock, flags);
  727. brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR);
  728. ip22zilog_convert_to_zs(up, termios->c_cflag, termios->c_iflag, brg);
  729. if (UART_ENABLE_MS(&up->port, termios->c_cflag))
  730. up->flags |= IP22ZILOG_FLAG_MODEM_STATUS;
  731. else
  732. up->flags &= ~IP22ZILOG_FLAG_MODEM_STATUS;
  733. ip22zilog_maybe_update_regs(up, ZILOG_CHANNEL_FROM_PORT(port));
  734. uart_update_timeout(port, termios->c_cflag, baud);
  735. spin_unlock_irqrestore(&up->port.lock, flags);
  736. }
  737. static const char *ip22zilog_type(struct uart_port *port)
  738. {
  739. return "IP22-Zilog";
  740. }
  741. /* We do not request/release mappings of the registers here, this
  742. * happens at early serial probe time.
  743. */
  744. static void ip22zilog_release_port(struct uart_port *port)
  745. {
  746. }
  747. static int ip22zilog_request_port(struct uart_port *port)
  748. {
  749. return 0;
  750. }
  751. /* These do not need to do anything interesting either. */
  752. static void ip22zilog_config_port(struct uart_port *port, int flags)
  753. {
  754. }
  755. /* We do not support letting the user mess with the divisor, IRQ, etc. */
  756. static int ip22zilog_verify_port(struct uart_port *port, struct serial_struct *ser)
  757. {
  758. return -EINVAL;
  759. }
  760. static const struct uart_ops ip22zilog_pops = {
  761. .tx_empty = ip22zilog_tx_empty,
  762. .set_mctrl = ip22zilog_set_mctrl,
  763. .get_mctrl = ip22zilog_get_mctrl,
  764. .stop_tx = ip22zilog_stop_tx,
  765. .start_tx = ip22zilog_start_tx,
  766. .stop_rx = ip22zilog_stop_rx,
  767. .enable_ms = ip22zilog_enable_ms,
  768. .break_ctl = ip22zilog_break_ctl,
  769. .startup = ip22zilog_startup,
  770. .shutdown = ip22zilog_shutdown,
  771. .set_termios = ip22zilog_set_termios,
  772. .type = ip22zilog_type,
  773. .release_port = ip22zilog_release_port,
  774. .request_port = ip22zilog_request_port,
  775. .config_port = ip22zilog_config_port,
  776. .verify_port = ip22zilog_verify_port,
  777. };
  778. static struct uart_ip22zilog_port *ip22zilog_port_table;
  779. static struct zilog_layout **ip22zilog_chip_regs;
  780. static struct uart_ip22zilog_port *ip22zilog_irq_chain;
  781. static int zilog_irq = -1;
  782. static void * __init alloc_one_table(unsigned long size)
  783. {
  784. return kzalloc(size, GFP_KERNEL);
  785. }
  786. static void __init ip22zilog_alloc_tables(void)
  787. {
  788. ip22zilog_port_table = (struct uart_ip22zilog_port *)
  789. alloc_one_table(NUM_CHANNELS * sizeof(struct uart_ip22zilog_port));
  790. ip22zilog_chip_regs = (struct zilog_layout **)
  791. alloc_one_table(NUM_IP22ZILOG * sizeof(struct zilog_layout *));
  792. if (ip22zilog_port_table == NULL || ip22zilog_chip_regs == NULL) {
  793. panic("IP22-Zilog: Cannot allocate IP22-Zilog tables.");
  794. }
  795. }
  796. /* Get the address of the registers for IP22-Zilog instance CHIP. */
  797. static struct zilog_layout * __init get_zs(int chip)
  798. {
  799. unsigned long base;
  800. if (chip < 0 || chip >= NUM_IP22ZILOG) {
  801. panic("IP22-Zilog: Illegal chip number %d in get_zs.", chip);
  802. }
  803. /* Not probe-able, hard code it. */
  804. base = (unsigned long) &sgioc->uart;
  805. zilog_irq = SGI_SERIAL_IRQ;
  806. request_mem_region(base, 8, "IP22-Zilog");
  807. return (struct zilog_layout *) base;
  808. }
  809. #define ZS_PUT_CHAR_MAX_DELAY 2000 /* 10 ms */
  810. #ifdef CONFIG_SERIAL_IP22_ZILOG_CONSOLE
  811. static void ip22zilog_put_char(struct uart_port *port, unsigned char ch)
  812. {
  813. struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port);
  814. int loops = ZS_PUT_CHAR_MAX_DELAY;
  815. /* This is a timed polling loop so do not switch the explicit
  816. * udelay with ZSDELAY as that is a NOP on some platforms. -DaveM
  817. */
  818. do {
  819. unsigned char val = readb(&channel->control);
  820. if (val & Tx_BUF_EMP) {
  821. ZSDELAY();
  822. break;
  823. }
  824. udelay(5);
  825. } while (--loops);
  826. writeb(ch, &channel->data);
  827. ZSDELAY();
  828. ZS_WSYNC(channel);
  829. }
  830. static void
  831. ip22zilog_console_write(struct console *con, const char *s, unsigned int count)
  832. {
  833. struct uart_ip22zilog_port *up = &ip22zilog_port_table[con->index];
  834. unsigned long flags;
  835. spin_lock_irqsave(&up->port.lock, flags);
  836. uart_console_write(&up->port, s, count, ip22zilog_put_char);
  837. udelay(2);
  838. spin_unlock_irqrestore(&up->port.lock, flags);
  839. }
  840. static int __init ip22zilog_console_setup(struct console *con, char *options)
  841. {
  842. struct uart_ip22zilog_port *up = &ip22zilog_port_table[con->index];
  843. unsigned long flags;
  844. int baud = 9600, bits = 8;
  845. int parity = 'n';
  846. int flow = 'n';
  847. up->flags |= IP22ZILOG_FLAG_IS_CONS;
  848. printk(KERN_INFO "Console: ttyS%d (IP22-Zilog)\n", con->index);
  849. spin_lock_irqsave(&up->port.lock, flags);
  850. up->curregs[R15] |= BRKIE;
  851. __ip22zilog_startup(up);
  852. spin_unlock_irqrestore(&up->port.lock, flags);
  853. if (options)
  854. uart_parse_options(options, &baud, &parity, &bits, &flow);
  855. return uart_set_options(&up->port, con, baud, parity, bits, flow);
  856. }
  857. static struct uart_driver ip22zilog_reg;
  858. static struct console ip22zilog_console = {
  859. .name = "ttyS",
  860. .write = ip22zilog_console_write,
  861. .device = uart_console_device,
  862. .setup = ip22zilog_console_setup,
  863. .flags = CON_PRINTBUFFER,
  864. .index = -1,
  865. .data = &ip22zilog_reg,
  866. };
  867. #endif /* CONFIG_SERIAL_IP22_ZILOG_CONSOLE */
  868. static struct uart_driver ip22zilog_reg = {
  869. .owner = THIS_MODULE,
  870. .driver_name = "serial",
  871. .dev_name = "ttyS",
  872. .major = TTY_MAJOR,
  873. .minor = 64,
  874. .nr = NUM_CHANNELS,
  875. #ifdef CONFIG_SERIAL_IP22_ZILOG_CONSOLE
  876. .cons = &ip22zilog_console,
  877. #endif
  878. };
  879. static void __init ip22zilog_prepare(void)
  880. {
  881. unsigned char sysrq_on = IS_ENABLED(CONFIG_SERIAL_IP22_ZILOG_CONSOLE);
  882. struct uart_ip22zilog_port *up;
  883. struct zilog_layout *rp;
  884. int channel, chip;
  885. /*
  886. * Temporary fix.
  887. */
  888. for (channel = 0; channel < NUM_CHANNELS; channel++)
  889. spin_lock_init(&ip22zilog_port_table[channel].port.lock);
  890. ip22zilog_irq_chain = &ip22zilog_port_table[NUM_CHANNELS - 1];
  891. up = &ip22zilog_port_table[0];
  892. for (channel = NUM_CHANNELS - 1 ; channel > 0; channel--)
  893. up[channel].next = &up[channel - 1];
  894. up[channel].next = NULL;
  895. for (chip = 0; chip < NUM_IP22ZILOG; chip++) {
  896. if (!ip22zilog_chip_regs[chip]) {
  897. ip22zilog_chip_regs[chip] = rp = get_zs(chip);
  898. up[(chip * 2) + 0].port.membase = (char *) &rp->channelB;
  899. up[(chip * 2) + 1].port.membase = (char *) &rp->channelA;
  900. /* In theory mapbase is the physical address ... */
  901. up[(chip * 2) + 0].port.mapbase =
  902. (unsigned long) ioremap((unsigned long) &rp->channelB, 8);
  903. up[(chip * 2) + 1].port.mapbase =
  904. (unsigned long) ioremap((unsigned long) &rp->channelA, 8);
  905. }
  906. /* Channel A */
  907. up[(chip * 2) + 0].port.iotype = UPIO_MEM;
  908. up[(chip * 2) + 0].port.irq = zilog_irq;
  909. up[(chip * 2) + 0].port.uartclk = ZS_CLOCK;
  910. up[(chip * 2) + 0].port.fifosize = 1;
  911. up[(chip * 2) + 0].port.has_sysrq = sysrq_on;
  912. up[(chip * 2) + 0].port.ops = &ip22zilog_pops;
  913. up[(chip * 2) + 0].port.type = PORT_IP22ZILOG;
  914. up[(chip * 2) + 0].port.flags = 0;
  915. up[(chip * 2) + 0].port.line = (chip * 2) + 0;
  916. up[(chip * 2) + 0].flags = 0;
  917. /* Channel B */
  918. up[(chip * 2) + 1].port.iotype = UPIO_MEM;
  919. up[(chip * 2) + 1].port.irq = zilog_irq;
  920. up[(chip * 2) + 1].port.uartclk = ZS_CLOCK;
  921. up[(chip * 2) + 1].port.fifosize = 1;
  922. up[(chip * 2) + 1].port.has_sysrq = sysrq_on;
  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 <[email protected]>");
  998. MODULE_DESCRIPTION("SGI Zilog serial port driver");
  999. MODULE_LICENSE("GPL");