ip22zilog.c 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223
  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 bool ip22zilog_receive_chars(struct uart_ip22zilog_port *up,
  208. struct zilog_channel *channel)
  209. {
  210. unsigned char ch, flag;
  211. unsigned int r1;
  212. bool push = up->port.state != NULL;
  213. for (;;) {
  214. ch = readb(&channel->control);
  215. ZSDELAY();
  216. if (!(ch & Rx_CH_AV))
  217. break;
  218. r1 = read_zsreg(channel, R1);
  219. if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) {
  220. writeb(ERR_RES, &channel->control);
  221. ZSDELAY();
  222. ZS_WSYNC(channel);
  223. }
  224. ch = readb(&channel->data);
  225. ZSDELAY();
  226. ch &= up->parity_mask;
  227. /* Handle the null char got when BREAK is removed. */
  228. if (!ch)
  229. r1 |= up->tty_break;
  230. /* A real serial line, record the character and status. */
  231. flag = TTY_NORMAL;
  232. up->port.icount.rx++;
  233. if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR | Rx_SYS | Rx_BRK)) {
  234. up->tty_break = 0;
  235. if (r1 & (Rx_SYS | Rx_BRK)) {
  236. up->port.icount.brk++;
  237. if (r1 & Rx_SYS)
  238. continue;
  239. r1 &= ~(PAR_ERR | CRC_ERR);
  240. }
  241. else if (r1 & PAR_ERR)
  242. up->port.icount.parity++;
  243. else if (r1 & CRC_ERR)
  244. up->port.icount.frame++;
  245. if (r1 & Rx_OVR)
  246. up->port.icount.overrun++;
  247. r1 &= up->port.read_status_mask;
  248. if (r1 & Rx_BRK)
  249. flag = TTY_BREAK;
  250. else if (r1 & PAR_ERR)
  251. flag = TTY_PARITY;
  252. else if (r1 & CRC_ERR)
  253. flag = TTY_FRAME;
  254. }
  255. if (uart_handle_sysrq_char(&up->port, ch))
  256. continue;
  257. if (push)
  258. uart_insert_char(&up->port, r1, Rx_OVR, ch, flag);
  259. }
  260. return push;
  261. }
  262. static void ip22zilog_status_handle(struct uart_ip22zilog_port *up,
  263. struct zilog_channel *channel)
  264. {
  265. unsigned char status;
  266. status = readb(&channel->control);
  267. ZSDELAY();
  268. writeb(RES_EXT_INT, &channel->control);
  269. ZSDELAY();
  270. ZS_WSYNC(channel);
  271. if (up->curregs[R15] & BRKIE) {
  272. if ((status & BRK_ABRT) && !(up->prev_status & BRK_ABRT)) {
  273. if (uart_handle_break(&up->port))
  274. up->tty_break = Rx_SYS;
  275. else
  276. up->tty_break = Rx_BRK;
  277. }
  278. }
  279. if (ZS_WANTS_MODEM_STATUS(up)) {
  280. if (status & SYNC)
  281. up->port.icount.dsr++;
  282. /* The Zilog just gives us an interrupt when DCD/CTS/etc. change.
  283. * But it does not tell us which bit has changed, we have to keep
  284. * track of this ourselves.
  285. */
  286. if ((status ^ up->prev_status) ^ DCD)
  287. uart_handle_dcd_change(&up->port,
  288. (status & DCD));
  289. if ((status ^ up->prev_status) ^ CTS)
  290. uart_handle_cts_change(&up->port,
  291. (status & CTS));
  292. wake_up_interruptible(&up->port.state->port.delta_msr_wait);
  293. }
  294. up->prev_status = status;
  295. }
  296. static void ip22zilog_transmit_chars(struct uart_ip22zilog_port *up,
  297. struct zilog_channel *channel)
  298. {
  299. struct circ_buf *xmit;
  300. if (ZS_IS_CONS(up)) {
  301. unsigned char status = readb(&channel->control);
  302. ZSDELAY();
  303. /* TX still busy? Just wait for the next TX done interrupt.
  304. *
  305. * It can occur because of how we do serial console writes. It would
  306. * be nice to transmit console writes just like we normally would for
  307. * a TTY line. (ie. buffered and TX interrupt driven). That is not
  308. * easy because console writes cannot sleep. One solution might be
  309. * to poll on enough port->xmit space becoming free. -DaveM
  310. */
  311. if (!(status & Tx_BUF_EMP))
  312. return;
  313. }
  314. up->flags &= ~IP22ZILOG_FLAG_TX_ACTIVE;
  315. if (ZS_REGS_HELD(up)) {
  316. __load_zsregs(channel, up->curregs);
  317. up->flags &= ~IP22ZILOG_FLAG_REGS_HELD;
  318. }
  319. if (ZS_TX_STOPPED(up)) {
  320. up->flags &= ~IP22ZILOG_FLAG_TX_STOPPED;
  321. goto ack_tx_int;
  322. }
  323. if (up->port.x_char) {
  324. up->flags |= IP22ZILOG_FLAG_TX_ACTIVE;
  325. writeb(up->port.x_char, &channel->data);
  326. ZSDELAY();
  327. ZS_WSYNC(channel);
  328. up->port.icount.tx++;
  329. up->port.x_char = 0;
  330. return;
  331. }
  332. if (up->port.state == NULL)
  333. goto ack_tx_int;
  334. xmit = &up->port.state->xmit;
  335. if (uart_circ_empty(xmit))
  336. goto ack_tx_int;
  337. if (uart_tx_stopped(&up->port))
  338. goto ack_tx_int;
  339. up->flags |= IP22ZILOG_FLAG_TX_ACTIVE;
  340. writeb(xmit->buf[xmit->tail], &channel->data);
  341. ZSDELAY();
  342. ZS_WSYNC(channel);
  343. xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
  344. up->port.icount.tx++;
  345. if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
  346. uart_write_wakeup(&up->port);
  347. return;
  348. ack_tx_int:
  349. writeb(RES_Tx_P, &channel->control);
  350. ZSDELAY();
  351. ZS_WSYNC(channel);
  352. }
  353. static irqreturn_t ip22zilog_interrupt(int irq, void *dev_id)
  354. {
  355. struct uart_ip22zilog_port *up = dev_id;
  356. while (up) {
  357. struct zilog_channel *channel
  358. = ZILOG_CHANNEL_FROM_PORT(&up->port);
  359. unsigned char r3;
  360. bool push = false;
  361. spin_lock(&up->port.lock);
  362. r3 = read_zsreg(channel, R3);
  363. /* Channel A */
  364. if (r3 & (CHAEXT | CHATxIP | CHARxIP)) {
  365. writeb(RES_H_IUS, &channel->control);
  366. ZSDELAY();
  367. ZS_WSYNC(channel);
  368. if (r3 & CHARxIP)
  369. push = ip22zilog_receive_chars(up, channel);
  370. if (r3 & CHAEXT)
  371. ip22zilog_status_handle(up, channel);
  372. if (r3 & CHATxIP)
  373. ip22zilog_transmit_chars(up, channel);
  374. }
  375. spin_unlock(&up->port.lock);
  376. if (push)
  377. tty_flip_buffer_push(&up->port.state->port);
  378. /* Channel B */
  379. up = up->next;
  380. channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
  381. push = false;
  382. spin_lock(&up->port.lock);
  383. if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) {
  384. writeb(RES_H_IUS, &channel->control);
  385. ZSDELAY();
  386. ZS_WSYNC(channel);
  387. if (r3 & CHBRxIP)
  388. push = ip22zilog_receive_chars(up, channel);
  389. if (r3 & CHBEXT)
  390. ip22zilog_status_handle(up, channel);
  391. if (r3 & CHBTxIP)
  392. ip22zilog_transmit_chars(up, channel);
  393. }
  394. spin_unlock(&up->port.lock);
  395. if (push)
  396. tty_flip_buffer_push(&up->port.state->port);
  397. up = up->next;
  398. }
  399. return IRQ_HANDLED;
  400. }
  401. /* A convenient way to quickly get R0 status. The caller must _not_ hold the
  402. * port lock, it is acquired here.
  403. */
  404. static __inline__ unsigned char ip22zilog_read_channel_status(struct uart_port *port)
  405. {
  406. struct zilog_channel *channel;
  407. unsigned char status;
  408. channel = ZILOG_CHANNEL_FROM_PORT(port);
  409. status = readb(&channel->control);
  410. ZSDELAY();
  411. return status;
  412. }
  413. /* The port lock is not held. */
  414. static unsigned int ip22zilog_tx_empty(struct uart_port *port)
  415. {
  416. unsigned long flags;
  417. unsigned char status;
  418. unsigned int ret;
  419. spin_lock_irqsave(&port->lock, flags);
  420. status = ip22zilog_read_channel_status(port);
  421. spin_unlock_irqrestore(&port->lock, flags);
  422. if (status & Tx_BUF_EMP)
  423. ret = TIOCSER_TEMT;
  424. else
  425. ret = 0;
  426. return ret;
  427. }
  428. /* The port lock is held and interrupts are disabled. */
  429. static unsigned int ip22zilog_get_mctrl(struct uart_port *port)
  430. {
  431. unsigned char status;
  432. unsigned int ret;
  433. status = ip22zilog_read_channel_status(port);
  434. ret = 0;
  435. if (status & DCD)
  436. ret |= TIOCM_CAR;
  437. if (status & SYNC)
  438. ret |= TIOCM_DSR;
  439. if (status & CTS)
  440. ret |= TIOCM_CTS;
  441. return ret;
  442. }
  443. /* The port lock is held and interrupts are disabled. */
  444. static void ip22zilog_set_mctrl(struct uart_port *port, unsigned int mctrl)
  445. {
  446. struct uart_ip22zilog_port *up =
  447. container_of(port, struct uart_ip22zilog_port, port);
  448. struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port);
  449. unsigned char set_bits, clear_bits;
  450. set_bits = clear_bits = 0;
  451. if (mctrl & TIOCM_RTS)
  452. set_bits |= RTS;
  453. else
  454. clear_bits |= RTS;
  455. if (mctrl & TIOCM_DTR)
  456. set_bits |= DTR;
  457. else
  458. clear_bits |= DTR;
  459. /* NOTE: Not subject to 'transmitter active' rule. */
  460. up->curregs[R5] |= set_bits;
  461. up->curregs[R5] &= ~clear_bits;
  462. write_zsreg(channel, R5, up->curregs[R5]);
  463. }
  464. /* The port lock is held and interrupts are disabled. */
  465. static void ip22zilog_stop_tx(struct uart_port *port)
  466. {
  467. struct uart_ip22zilog_port *up =
  468. container_of(port, struct uart_ip22zilog_port, port);
  469. up->flags |= IP22ZILOG_FLAG_TX_STOPPED;
  470. }
  471. /* The port lock is held and interrupts are disabled. */
  472. static void ip22zilog_start_tx(struct uart_port *port)
  473. {
  474. struct uart_ip22zilog_port *up =
  475. container_of(port, struct uart_ip22zilog_port, port);
  476. struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port);
  477. unsigned char status;
  478. up->flags |= IP22ZILOG_FLAG_TX_ACTIVE;
  479. up->flags &= ~IP22ZILOG_FLAG_TX_STOPPED;
  480. status = readb(&channel->control);
  481. ZSDELAY();
  482. /* TX busy? Just wait for the TX done interrupt. */
  483. if (!(status & Tx_BUF_EMP))
  484. return;
  485. /* Send the first character to jump-start the TX done
  486. * IRQ sending engine.
  487. */
  488. if (port->x_char) {
  489. writeb(port->x_char, &channel->data);
  490. ZSDELAY();
  491. ZS_WSYNC(channel);
  492. port->icount.tx++;
  493. port->x_char = 0;
  494. } else {
  495. struct circ_buf *xmit = &port->state->xmit;
  496. if (uart_circ_empty(xmit))
  497. return;
  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 =
  523. container_of(port, struct uart_ip22zilog_port, port);
  524. struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port);
  525. unsigned char new_reg;
  526. new_reg = up->curregs[R15] | (DCDIE | SYNCIE | CTSIE);
  527. if (new_reg != up->curregs[R15]) {
  528. up->curregs[R15] = new_reg;
  529. /* NOTE: Not subject to 'transmitter active' rule. */
  530. write_zsreg(channel, R15, up->curregs[R15]);
  531. }
  532. }
  533. /* The port lock is not held. */
  534. static void ip22zilog_break_ctl(struct uart_port *port, int break_state)
  535. {
  536. struct uart_ip22zilog_port *up =
  537. container_of(port, struct uart_ip22zilog_port, port);
  538. struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port);
  539. unsigned char set_bits, clear_bits, new_reg;
  540. unsigned long flags;
  541. set_bits = clear_bits = 0;
  542. if (break_state)
  543. set_bits |= SND_BRK;
  544. else
  545. clear_bits |= SND_BRK;
  546. spin_lock_irqsave(&port->lock, flags);
  547. new_reg = (up->curregs[R5] | set_bits) & ~clear_bits;
  548. if (new_reg != up->curregs[R5]) {
  549. up->curregs[R5] = new_reg;
  550. /* NOTE: Not subject to 'transmitter active' rule. */
  551. write_zsreg(channel, R5, up->curregs[R5]);
  552. }
  553. spin_unlock_irqrestore(&port->lock, flags);
  554. }
  555. static void __ip22zilog_reset(struct uart_ip22zilog_port *up)
  556. {
  557. struct zilog_channel *channel;
  558. int i;
  559. if (up->flags & IP22ZILOG_FLAG_RESET_DONE)
  560. return;
  561. /* Let pending transmits finish. */
  562. channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
  563. for (i = 0; i < 1000; i++) {
  564. unsigned char stat = read_zsreg(channel, R1);
  565. if (stat & ALL_SNT)
  566. break;
  567. udelay(100);
  568. }
  569. if (!ZS_IS_CHANNEL_A(up)) {
  570. up++;
  571. channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
  572. }
  573. write_zsreg(channel, R9, FHWRES);
  574. ZSDELAY_LONG();
  575. (void) read_zsreg(channel, R0);
  576. up->flags |= IP22ZILOG_FLAG_RESET_DONE;
  577. up->next->flags |= IP22ZILOG_FLAG_RESET_DONE;
  578. }
  579. static void __ip22zilog_startup(struct uart_ip22zilog_port *up)
  580. {
  581. struct zilog_channel *channel;
  582. channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
  583. __ip22zilog_reset(up);
  584. __load_zsregs(channel, up->curregs);
  585. /* set master interrupt enable */
  586. write_zsreg(channel, R9, up->curregs[R9]);
  587. up->prev_status = readb(&channel->control);
  588. /* Enable receiver and transmitter. */
  589. up->curregs[R3] |= RxENAB;
  590. up->curregs[R5] |= TxENAB;
  591. up->curregs[R1] |= EXT_INT_ENAB | INT_ALL_Rx | TxINT_ENAB;
  592. ip22zilog_maybe_update_regs(up, channel);
  593. }
  594. static int ip22zilog_startup(struct uart_port *port)
  595. {
  596. struct uart_ip22zilog_port *up = UART_ZILOG(port);
  597. unsigned long flags;
  598. if (ZS_IS_CONS(up))
  599. return 0;
  600. spin_lock_irqsave(&port->lock, flags);
  601. __ip22zilog_startup(up);
  602. spin_unlock_irqrestore(&port->lock, flags);
  603. return 0;
  604. }
  605. /*
  606. * The test for ZS_IS_CONS is explained by the following e-mail:
  607. *****
  608. * From: Russell King <rmk@arm.linux.org.uk>
  609. * Date: Sun, 8 Dec 2002 10:18:38 +0000
  610. *
  611. * On Sun, Dec 08, 2002 at 02:43:36AM -0500, Pete Zaitcev wrote:
  612. * > I boot my 2.5 boxes using "console=ttyS0,9600" argument,
  613. * > and I noticed that something is not right with reference
  614. * > counting in this case. It seems that when the console
  615. * > is open by kernel initially, this is not accounted
  616. * > as an open, and uart_startup is not called.
  617. *
  618. * That is correct. We are unable to call uart_startup when the serial
  619. * console is initialised because it may need to allocate memory (as
  620. * request_irq does) and the memory allocators may not have been
  621. * initialised.
  622. *
  623. * 1. initialise the port into a state where it can send characters in the
  624. * console write method.
  625. *
  626. * 2. don't do the actual hardware shutdown in your shutdown() method (but
  627. * do the normal software shutdown - ie, free irqs etc)
  628. *****
  629. */
  630. static void ip22zilog_shutdown(struct uart_port *port)
  631. {
  632. struct uart_ip22zilog_port *up = UART_ZILOG(port);
  633. struct zilog_channel *channel;
  634. unsigned long flags;
  635. if (ZS_IS_CONS(up))
  636. return;
  637. spin_lock_irqsave(&port->lock, flags);
  638. channel = ZILOG_CHANNEL_FROM_PORT(port);
  639. /* Disable receiver and transmitter. */
  640. up->curregs[R3] &= ~RxENAB;
  641. up->curregs[R5] &= ~TxENAB;
  642. /* Disable all interrupts and BRK assertion. */
  643. up->curregs[R1] &= ~(EXT_INT_ENAB | TxINT_ENAB | RxINT_MASK);
  644. up->curregs[R5] &= ~SND_BRK;
  645. ip22zilog_maybe_update_regs(up, channel);
  646. spin_unlock_irqrestore(&port->lock, flags);
  647. }
  648. /* Shared by TTY driver and serial console setup. The port lock is held
  649. * and local interrupts are disabled.
  650. */
  651. static void
  652. ip22zilog_convert_to_zs(struct uart_ip22zilog_port *up, unsigned int cflag,
  653. unsigned int iflag, int brg)
  654. {
  655. up->curregs[R10] = NRZ;
  656. up->curregs[R11] = TCBR | RCBR;
  657. /* Program BAUD and clock source. */
  658. up->curregs[R4] &= ~XCLK_MASK;
  659. up->curregs[R4] |= X16CLK;
  660. up->curregs[R12] = brg & 0xff;
  661. up->curregs[R13] = (brg >> 8) & 0xff;
  662. up->curregs[R14] = BRENAB;
  663. /* Character size, stop bits, and parity. */
  664. up->curregs[3] &= ~RxN_MASK;
  665. up->curregs[5] &= ~TxN_MASK;
  666. switch (cflag & CSIZE) {
  667. case CS5:
  668. up->curregs[3] |= Rx5;
  669. up->curregs[5] |= Tx5;
  670. up->parity_mask = 0x1f;
  671. break;
  672. case CS6:
  673. up->curregs[3] |= Rx6;
  674. up->curregs[5] |= Tx6;
  675. up->parity_mask = 0x3f;
  676. break;
  677. case CS7:
  678. up->curregs[3] |= Rx7;
  679. up->curregs[5] |= Tx7;
  680. up->parity_mask = 0x7f;
  681. break;
  682. case CS8:
  683. default:
  684. up->curregs[3] |= Rx8;
  685. up->curregs[5] |= Tx8;
  686. up->parity_mask = 0xff;
  687. break;
  688. }
  689. up->curregs[4] &= ~0x0c;
  690. if (cflag & CSTOPB)
  691. up->curregs[4] |= SB2;
  692. else
  693. up->curregs[4] |= SB1;
  694. if (cflag & PARENB)
  695. up->curregs[4] |= PAR_ENAB;
  696. else
  697. up->curregs[4] &= ~PAR_ENAB;
  698. if (!(cflag & PARODD))
  699. up->curregs[4] |= PAR_EVEN;
  700. else
  701. up->curregs[4] &= ~PAR_EVEN;
  702. up->port.read_status_mask = Rx_OVR;
  703. if (iflag & INPCK)
  704. up->port.read_status_mask |= CRC_ERR | PAR_ERR;
  705. if (iflag & (IGNBRK | BRKINT | PARMRK))
  706. up->port.read_status_mask |= BRK_ABRT;
  707. up->port.ignore_status_mask = 0;
  708. if (iflag & IGNPAR)
  709. up->port.ignore_status_mask |= CRC_ERR | PAR_ERR;
  710. if (iflag & IGNBRK) {
  711. up->port.ignore_status_mask |= BRK_ABRT;
  712. if (iflag & IGNPAR)
  713. up->port.ignore_status_mask |= Rx_OVR;
  714. }
  715. if ((cflag & CREAD) == 0)
  716. up->port.ignore_status_mask = 0xff;
  717. }
  718. /* The port lock is not held. */
  719. static void
  720. ip22zilog_set_termios(struct uart_port *port, struct ktermios *termios,
  721. struct ktermios *old)
  722. {
  723. struct uart_ip22zilog_port *up =
  724. container_of(port, struct uart_ip22zilog_port, port);
  725. unsigned long flags;
  726. int baud, brg;
  727. baud = uart_get_baud_rate(port, termios, old, 1200, 76800);
  728. spin_lock_irqsave(&up->port.lock, flags);
  729. brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR);
  730. ip22zilog_convert_to_zs(up, termios->c_cflag, termios->c_iflag, brg);
  731. if (UART_ENABLE_MS(&up->port, termios->c_cflag))
  732. up->flags |= IP22ZILOG_FLAG_MODEM_STATUS;
  733. else
  734. up->flags &= ~IP22ZILOG_FLAG_MODEM_STATUS;
  735. ip22zilog_maybe_update_regs(up, ZILOG_CHANNEL_FROM_PORT(port));
  736. uart_update_timeout(port, termios->c_cflag, baud);
  737. spin_unlock_irqrestore(&up->port.lock, flags);
  738. }
  739. static const char *ip22zilog_type(struct uart_port *port)
  740. {
  741. return "IP22-Zilog";
  742. }
  743. /* We do not request/release mappings of the registers here, this
  744. * happens at early serial probe time.
  745. */
  746. static void ip22zilog_release_port(struct uart_port *port)
  747. {
  748. }
  749. static int ip22zilog_request_port(struct uart_port *port)
  750. {
  751. return 0;
  752. }
  753. /* These do not need to do anything interesting either. */
  754. static void ip22zilog_config_port(struct uart_port *port, int flags)
  755. {
  756. }
  757. /* We do not support letting the user mess with the divisor, IRQ, etc. */
  758. static int ip22zilog_verify_port(struct uart_port *port, struct serial_struct *ser)
  759. {
  760. return -EINVAL;
  761. }
  762. static struct uart_ops ip22zilog_pops = {
  763. .tx_empty = ip22zilog_tx_empty,
  764. .set_mctrl = ip22zilog_set_mctrl,
  765. .get_mctrl = ip22zilog_get_mctrl,
  766. .stop_tx = ip22zilog_stop_tx,
  767. .start_tx = ip22zilog_start_tx,
  768. .stop_rx = ip22zilog_stop_rx,
  769. .enable_ms = ip22zilog_enable_ms,
  770. .break_ctl = ip22zilog_break_ctl,
  771. .startup = ip22zilog_startup,
  772. .shutdown = ip22zilog_shutdown,
  773. .set_termios = ip22zilog_set_termios,
  774. .type = ip22zilog_type,
  775. .release_port = ip22zilog_release_port,
  776. .request_port = ip22zilog_request_port,
  777. .config_port = ip22zilog_config_port,
  778. .verify_port = ip22zilog_verify_port,
  779. };
  780. static struct uart_ip22zilog_port *ip22zilog_port_table;
  781. static struct zilog_layout **ip22zilog_chip_regs;
  782. static struct uart_ip22zilog_port *ip22zilog_irq_chain;
  783. static int zilog_irq = -1;
  784. static void * __init alloc_one_table(unsigned long size)
  785. {
  786. return kzalloc(size, GFP_KERNEL);
  787. }
  788. static void __init ip22zilog_alloc_tables(void)
  789. {
  790. ip22zilog_port_table = (struct uart_ip22zilog_port *)
  791. alloc_one_table(NUM_CHANNELS * sizeof(struct uart_ip22zilog_port));
  792. ip22zilog_chip_regs = (struct zilog_layout **)
  793. alloc_one_table(NUM_IP22ZILOG * sizeof(struct zilog_layout *));
  794. if (ip22zilog_port_table == NULL || ip22zilog_chip_regs == NULL) {
  795. panic("IP22-Zilog: Cannot allocate IP22-Zilog tables.");
  796. }
  797. }
  798. /* Get the address of the registers for IP22-Zilog instance CHIP. */
  799. static struct zilog_layout * __init get_zs(int chip)
  800. {
  801. unsigned long base;
  802. if (chip < 0 || chip >= NUM_IP22ZILOG) {
  803. panic("IP22-Zilog: Illegal chip number %d in get_zs.", chip);
  804. }
  805. /* Not probe-able, hard code it. */
  806. base = (unsigned long) &sgioc->uart;
  807. zilog_irq = SGI_SERIAL_IRQ;
  808. request_mem_region(base, 8, "IP22-Zilog");
  809. return (struct zilog_layout *) base;
  810. }
  811. #define ZS_PUT_CHAR_MAX_DELAY 2000 /* 10 ms */
  812. #ifdef CONFIG_SERIAL_IP22_ZILOG_CONSOLE
  813. static void ip22zilog_put_char(struct uart_port *port, int ch)
  814. {
  815. struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port);
  816. int loops = ZS_PUT_CHAR_MAX_DELAY;
  817. /* This is a timed polling loop so do not switch the explicit
  818. * udelay with ZSDELAY as that is a NOP on some platforms. -DaveM
  819. */
  820. do {
  821. unsigned char val = readb(&channel->control);
  822. if (val & Tx_BUF_EMP) {
  823. ZSDELAY();
  824. break;
  825. }
  826. udelay(5);
  827. } while (--loops);
  828. writeb(ch, &channel->data);
  829. ZSDELAY();
  830. ZS_WSYNC(channel);
  831. }
  832. static void
  833. ip22zilog_console_write(struct console *con, const char *s, unsigned int count)
  834. {
  835. struct uart_ip22zilog_port *up = &ip22zilog_port_table[con->index];
  836. unsigned long flags;
  837. spin_lock_irqsave(&up->port.lock, flags);
  838. uart_console_write(&up->port, s, count, ip22zilog_put_char);
  839. udelay(2);
  840. spin_unlock_irqrestore(&up->port.lock, flags);
  841. }
  842. static int __init ip22zilog_console_setup(struct console *con, char *options)
  843. {
  844. struct uart_ip22zilog_port *up = &ip22zilog_port_table[con->index];
  845. unsigned long flags;
  846. int baud = 9600, bits = 8;
  847. int parity = 'n';
  848. int flow = 'n';
  849. up->flags |= IP22ZILOG_FLAG_IS_CONS;
  850. printk(KERN_INFO "Console: ttyS%d (IP22-Zilog)\n", con->index);
  851. spin_lock_irqsave(&up->port.lock, flags);
  852. up->curregs[R15] |= BRKIE;
  853. __ip22zilog_startup(up);
  854. spin_unlock_irqrestore(&up->port.lock, flags);
  855. if (options)
  856. uart_parse_options(options, &baud, &parity, &bits, &flow);
  857. return uart_set_options(&up->port, con, baud, parity, bits, flow);
  858. }
  859. static struct uart_driver ip22zilog_reg;
  860. static struct console ip22zilog_console = {
  861. .name = "ttyS",
  862. .write = ip22zilog_console_write,
  863. .device = uart_console_device,
  864. .setup = ip22zilog_console_setup,
  865. .flags = CON_PRINTBUFFER,
  866. .index = -1,
  867. .data = &ip22zilog_reg,
  868. };
  869. #endif /* CONFIG_SERIAL_IP22_ZILOG_CONSOLE */
  870. static struct uart_driver ip22zilog_reg = {
  871. .owner = THIS_MODULE,
  872. .driver_name = "serial",
  873. .dev_name = "ttyS",
  874. .major = TTY_MAJOR,
  875. .minor = 64,
  876. .nr = NUM_CHANNELS,
  877. #ifdef CONFIG_SERIAL_IP22_ZILOG_CONSOLE
  878. .cons = &ip22zilog_console,
  879. #endif
  880. };
  881. static void __init ip22zilog_prepare(void)
  882. {
  883. struct uart_ip22zilog_port *up;
  884. struct zilog_layout *rp;
  885. int channel, chip;
  886. /*
  887. * Temporary fix.
  888. */
  889. for (channel = 0; channel < NUM_CHANNELS; channel++)
  890. spin_lock_init(&ip22zilog_port_table[channel].port.lock);
  891. ip22zilog_irq_chain = &ip22zilog_port_table[NUM_CHANNELS - 1];
  892. up = &ip22zilog_port_table[0];
  893. for (channel = NUM_CHANNELS - 1 ; channel > 0; channel--)
  894. up[channel].next = &up[channel - 1];
  895. up[channel].next = NULL;
  896. for (chip = 0; chip < NUM_IP22ZILOG; chip++) {
  897. if (!ip22zilog_chip_regs[chip]) {
  898. ip22zilog_chip_regs[chip] = rp = get_zs(chip);
  899. up[(chip * 2) + 0].port.membase = (char *) &rp->channelB;
  900. up[(chip * 2) + 1].port.membase = (char *) &rp->channelA;
  901. /* In theory mapbase is the physical address ... */
  902. up[(chip * 2) + 0].port.mapbase =
  903. (unsigned long) ioremap((unsigned long) &rp->channelB, 8);
  904. up[(chip * 2) + 1].port.mapbase =
  905. (unsigned long) ioremap((unsigned long) &rp->channelA, 8);
  906. }
  907. /* Channel A */
  908. up[(chip * 2) + 0].port.iotype = UPIO_MEM;
  909. up[(chip * 2) + 0].port.irq = zilog_irq;
  910. up[(chip * 2) + 0].port.uartclk = ZS_CLOCK;
  911. up[(chip * 2) + 0].port.fifosize = 1;
  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.ops = &ip22zilog_pops;
  923. up[(chip * 2) + 1].port.type = PORT_IP22ZILOG;
  924. up[(chip * 2) + 1].port.line = (chip * 2) + 1;
  925. up[(chip * 2) + 1].flags |= IP22ZILOG_FLAG_IS_CHANNEL_A;
  926. }
  927. for (channel = 0; channel < NUM_CHANNELS; channel++) {
  928. struct uart_ip22zilog_port *up = &ip22zilog_port_table[channel];
  929. int brg;
  930. /* Normal serial TTY. */
  931. up->parity_mask = 0xff;
  932. up->curregs[R1] = EXT_INT_ENAB | INT_ALL_Rx | TxINT_ENAB;
  933. up->curregs[R4] = PAR_EVEN | X16CLK | SB1;
  934. up->curregs[R3] = RxENAB | Rx8;
  935. up->curregs[R5] = TxENAB | Tx8;
  936. up->curregs[R9] = NV | MIE;
  937. up->curregs[R10] = NRZ;
  938. up->curregs[R11] = TCBR | RCBR;
  939. brg = BPS_TO_BRG(9600, ZS_CLOCK / ZS_CLOCK_DIVISOR);
  940. up->curregs[R12] = (brg & 0xff);
  941. up->curregs[R13] = (brg >> 8) & 0xff;
  942. up->curregs[R14] = BRENAB;
  943. }
  944. }
  945. static int __init ip22zilog_ports_init(void)
  946. {
  947. int ret;
  948. printk(KERN_INFO "Serial: IP22 Zilog driver (%d chips).\n", NUM_IP22ZILOG);
  949. ip22zilog_prepare();
  950. if (request_irq(zilog_irq, ip22zilog_interrupt, 0,
  951. "IP22-Zilog", ip22zilog_irq_chain)) {
  952. panic("IP22-Zilog: Unable to register zs interrupt handler.\n");
  953. }
  954. ret = uart_register_driver(&ip22zilog_reg);
  955. if (ret == 0) {
  956. int i;
  957. for (i = 0; i < NUM_CHANNELS; i++) {
  958. struct uart_ip22zilog_port *up = &ip22zilog_port_table[i];
  959. uart_add_one_port(&ip22zilog_reg, &up->port);
  960. }
  961. }
  962. return ret;
  963. }
  964. static int __init ip22zilog_init(void)
  965. {
  966. /* IP22 Zilog setup is hard coded, no probing to do. */
  967. ip22zilog_alloc_tables();
  968. ip22zilog_ports_init();
  969. return 0;
  970. }
  971. static void __exit ip22zilog_exit(void)
  972. {
  973. int i;
  974. struct uart_ip22zilog_port *up;
  975. for (i = 0; i < NUM_CHANNELS; i++) {
  976. up = &ip22zilog_port_table[i];
  977. uart_remove_one_port(&ip22zilog_reg, &up->port);
  978. }
  979. /* Free IO mem */
  980. up = &ip22zilog_port_table[0];
  981. for (i = 0; i < NUM_IP22ZILOG; i++) {
  982. if (up[(i * 2) + 0].port.mapbase) {
  983. iounmap((void*)up[(i * 2) + 0].port.mapbase);
  984. up[(i * 2) + 0].port.mapbase = 0;
  985. }
  986. if (up[(i * 2) + 1].port.mapbase) {
  987. iounmap((void*)up[(i * 2) + 1].port.mapbase);
  988. up[(i * 2) + 1].port.mapbase = 0;
  989. }
  990. }
  991. uart_unregister_driver(&ip22zilog_reg);
  992. }
  993. module_init(ip22zilog_init);
  994. module_exit(ip22zilog_exit);
  995. /* David wrote it but I'm to blame for the bugs ... */
  996. MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
  997. MODULE_DESCRIPTION("SGI Zilog serial port driver");
  998. MODULE_LICENSE("GPL");