debugport.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. /* Serialport functions for debugging
  2. *
  3. * Copyright (c) 2000 Axis Communications AB
  4. *
  5. * Authors: Bjorn Wesen
  6. *
  7. * Exports:
  8. * console_print_etrax(char *buf)
  9. * int getDebugChar()
  10. * putDebugChar(int)
  11. * enableDebugIRQ()
  12. * init_etrax_debug()
  13. *
  14. * $Log: debugport.c,v $
  15. * Revision 1.27 2005/06/10 10:34:14 starvik
  16. * Real console support
  17. *
  18. * Revision 1.26 2005/06/07 07:06:07 starvik
  19. * Added LF->CR translation to make ETRAX customers happy.
  20. *
  21. * Revision 1.25 2005/03/08 08:56:47 mikaelam
  22. * Do only set index as port->index if port is defined, otherwise use the index from the command line
  23. *
  24. * Revision 1.24 2005/01/19 10:26:33 mikaelam
  25. * Return the cris serial driver in console device driver callback function
  26. *
  27. * Revision 1.23 2005/01/14 10:12:17 starvik
  28. * KGDB on separate port.
  29. * Console fixes from 2.4.
  30. *
  31. * Revision 1.22 2005/01/11 16:06:13 starvik
  32. * typo
  33. *
  34. * Revision 1.21 2005/01/11 13:49:14 starvik
  35. * Added raw_printk to be used where we don't trust the console.
  36. *
  37. * Revision 1.20 2004/12/27 11:18:32 starvik
  38. * Merge of Linux 2.6.10 (not functional yet).
  39. *
  40. * Revision 1.19 2004/10/21 07:26:16 starvik
  41. * Made it possible to specify console settings on kernel command line.
  42. *
  43. * Revision 1.18 2004/10/19 13:07:37 starvik
  44. * Merge of Linux 2.6.9
  45. *
  46. * Revision 1.17 2004/09/29 10:33:46 starvik
  47. * Resolved a dealock when printing debug from kernel.
  48. *
  49. * Revision 1.16 2004/08/24 06:12:19 starvik
  50. * Whitespace cleanup
  51. *
  52. * Revision 1.15 2004/08/16 12:37:19 starvik
  53. * Merge of Linux 2.6.8
  54. *
  55. * Revision 1.14 2004/05/17 13:11:29 starvik
  56. * Disable DMA until real serial driver is up
  57. *
  58. * Revision 1.13 2004/05/14 07:58:01 starvik
  59. * Merge of changes from 2.4
  60. *
  61. * Revision 1.12 2003/09/11 07:29:49 starvik
  62. * Merge of Linux 2.6.0-test5
  63. *
  64. * Revision 1.11 2003/07/07 09:53:36 starvik
  65. * Revert all the 2.5.74 merge changes to make the console work again
  66. *
  67. * Revision 1.9 2003/02/17 17:07:23 starvik
  68. * Solved the problem with corrupted debug output (from Linux 2.4)
  69. * * Wait until DMA, FIFO and pipe is empty before and after transmissions
  70. * * Buffer data until a FIFO flush can be triggered.
  71. *
  72. * Revision 1.8 2003/01/22 06:48:36 starvik
  73. * Fixed warnings issued by GCC 3.2.1
  74. *
  75. * Revision 1.7 2002/12/12 08:26:32 starvik
  76. * Don't use C-comments inside CVS comments
  77. *
  78. * Revision 1.6 2002/12/11 15:42:02 starvik
  79. * Extracted v10 (ETRAX 100LX) specific stuff from arch/cris/kernel/
  80. *
  81. * Revision 1.5 2002/11/20 06:58:03 starvik
  82. * Compiles with kgdb
  83. *
  84. * Revision 1.4 2002/11/19 14:35:24 starvik
  85. * Changes from linux 2.4
  86. * Changed struct initializer syntax to the currently prefered notation
  87. *
  88. * Revision 1.3 2002/11/06 09:47:03 starvik
  89. * Modified for new interrupt macros
  90. *
  91. * Revision 1.2 2002/01/21 15:21:50 bjornw
  92. * Update for kdev_t changes
  93. *
  94. * Revision 1.6 2001/04/17 13:58:39 orjanf
  95. * * Renamed CONFIG_KGDB to CONFIG_ETRAX_KGDB.
  96. *
  97. * Revision 1.5 2001/03/26 14:22:05 bjornw
  98. * Namechange of some config options
  99. *
  100. * Revision 1.4 2000/10/06 12:37:26 bjornw
  101. * Use physical addresses when talking to DMA
  102. *
  103. *
  104. */
  105. #include <linux/config.h>
  106. #include <linux/console.h>
  107. #include <linux/init.h>
  108. #include <linux/major.h>
  109. #include <linux/delay.h>
  110. #include <linux/tty.h>
  111. #include <asm/system.h>
  112. #include <asm/arch/svinto.h>
  113. #include <asm/io.h> /* Get SIMCOUT. */
  114. struct dbg_port
  115. {
  116. unsigned int index;
  117. const volatile unsigned* read;
  118. volatile char* write;
  119. volatile unsigned* xoff;
  120. volatile char* baud;
  121. volatile char* tr_ctrl;
  122. volatile char* rec_ctrl;
  123. unsigned long irq;
  124. unsigned int started;
  125. unsigned long baudrate;
  126. unsigned char parity;
  127. unsigned int bits;
  128. };
  129. struct dbg_port ports[]=
  130. {
  131. {
  132. 0,
  133. R_SERIAL0_READ,
  134. R_SERIAL0_TR_DATA,
  135. R_SERIAL0_XOFF,
  136. R_SERIAL0_BAUD,
  137. R_SERIAL0_TR_CTRL,
  138. R_SERIAL0_REC_CTRL,
  139. IO_STATE(R_IRQ_MASK1_SET, ser0_data, set),
  140. 0,
  141. 115200,
  142. 'N',
  143. 8
  144. },
  145. {
  146. 1,
  147. R_SERIAL1_READ,
  148. R_SERIAL1_TR_DATA,
  149. R_SERIAL1_XOFF,
  150. R_SERIAL1_BAUD,
  151. R_SERIAL1_TR_CTRL,
  152. R_SERIAL1_REC_CTRL,
  153. IO_STATE(R_IRQ_MASK1_SET, ser1_data, set),
  154. 0,
  155. 115200,
  156. 'N',
  157. 8
  158. },
  159. {
  160. 2,
  161. R_SERIAL2_READ,
  162. R_SERIAL2_TR_DATA,
  163. R_SERIAL2_XOFF,
  164. R_SERIAL2_BAUD,
  165. R_SERIAL2_TR_CTRL,
  166. R_SERIAL2_REC_CTRL,
  167. IO_STATE(R_IRQ_MASK1_SET, ser2_data, set),
  168. 0,
  169. 115200,
  170. 'N',
  171. 8
  172. },
  173. {
  174. 3,
  175. R_SERIAL3_READ,
  176. R_SERIAL3_TR_DATA,
  177. R_SERIAL3_XOFF,
  178. R_SERIAL3_BAUD,
  179. R_SERIAL3_TR_CTRL,
  180. R_SERIAL3_REC_CTRL,
  181. IO_STATE(R_IRQ_MASK1_SET, ser3_data, set),
  182. 0,
  183. 115200,
  184. 'N',
  185. 8
  186. }
  187. };
  188. extern struct tty_driver *serial_driver;
  189. struct dbg_port* port =
  190. #if defined(CONFIG_ETRAX_DEBUG_PORT0)
  191. &ports[0];
  192. #elif defined(CONFIG_ETRAX_DEBUG_PORT1)
  193. &ports[1];
  194. #elif defined(CONFIG_ETRAX_DEBUG_PORT2)
  195. &ports[2];
  196. #elif defined(CONFIG_ETRAX_DEBUG_PORT3)
  197. &ports[3];
  198. #else
  199. NULL;
  200. #endif
  201. static struct dbg_port* kgdb_port =
  202. #if defined(CONFIG_ETRAX_KGDB_PORT0)
  203. &ports[0];
  204. #elif defined(CONFIG_ETRAX_KGDB_PORT1)
  205. &ports[1];
  206. #elif defined(CONFIG_ETRAX_KGDB_PORT2)
  207. &ports[2];
  208. #elif defined(CONFIG_ETRAX_KGDB_PORT3)
  209. &ports[3];
  210. #else
  211. NULL;
  212. #endif
  213. static void
  214. start_port(struct dbg_port* p)
  215. {
  216. unsigned long rec_ctrl = 0;
  217. unsigned long tr_ctrl = 0;
  218. if (!p)
  219. return;
  220. if (p->started)
  221. return;
  222. p->started = 1;
  223. if (p->index == 0)
  224. {
  225. genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma6);
  226. genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma6, unused);
  227. }
  228. else if (p->index == 1)
  229. {
  230. genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma8);
  231. genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma8, usb);
  232. }
  233. else if (p->index == 2)
  234. {
  235. genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma2);
  236. genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma2, par0);
  237. genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma3);
  238. genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma3, par0);
  239. genconfig_shadow |= IO_STATE(R_GEN_CONFIG, ser2, select);
  240. }
  241. else
  242. {
  243. genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma4);
  244. genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, par1);
  245. genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma5);
  246. genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma5, par1);
  247. genconfig_shadow |= IO_STATE(R_GEN_CONFIG, ser3, select);
  248. }
  249. *R_GEN_CONFIG = genconfig_shadow;
  250. *p->xoff =
  251. IO_STATE(R_SERIAL0_XOFF, tx_stop, enable) |
  252. IO_STATE(R_SERIAL0_XOFF, auto_xoff, disable) |
  253. IO_FIELD(R_SERIAL0_XOFF, xoff_char, 0);
  254. switch (p->baudrate)
  255. {
  256. case 0:
  257. case 115200:
  258. *p->baud =
  259. IO_STATE(R_SERIAL0_BAUD, tr_baud, c115k2Hz) |
  260. IO_STATE(R_SERIAL0_BAUD, rec_baud, c115k2Hz);
  261. break;
  262. case 1200:
  263. *p->baud =
  264. IO_STATE(R_SERIAL0_BAUD, tr_baud, c1200Hz) |
  265. IO_STATE(R_SERIAL0_BAUD, rec_baud, c1200Hz);
  266. break;
  267. case 2400:
  268. *p->baud =
  269. IO_STATE(R_SERIAL0_BAUD, tr_baud, c2400Hz) |
  270. IO_STATE(R_SERIAL0_BAUD, rec_baud, c2400Hz);
  271. break;
  272. case 4800:
  273. *p->baud =
  274. IO_STATE(R_SERIAL0_BAUD, tr_baud, c4800Hz) |
  275. IO_STATE(R_SERIAL0_BAUD, rec_baud, c4800Hz);
  276. break;
  277. case 9600:
  278. *p->baud =
  279. IO_STATE(R_SERIAL0_BAUD, tr_baud, c9600Hz) |
  280. IO_STATE(R_SERIAL0_BAUD, rec_baud, c9600Hz);
  281. break;
  282. case 19200:
  283. *p->baud =
  284. IO_STATE(R_SERIAL0_BAUD, tr_baud, c19k2Hz) |
  285. IO_STATE(R_SERIAL0_BAUD, rec_baud, c19k2Hz);
  286. break;
  287. case 38400:
  288. *p->baud =
  289. IO_STATE(R_SERIAL0_BAUD, tr_baud, c38k4Hz) |
  290. IO_STATE(R_SERIAL0_BAUD, rec_baud, c38k4Hz);
  291. break;
  292. case 57600:
  293. *p->baud =
  294. IO_STATE(R_SERIAL0_BAUD, tr_baud, c57k6Hz) |
  295. IO_STATE(R_SERIAL0_BAUD, rec_baud, c57k6Hz);
  296. break;
  297. default:
  298. *p->baud =
  299. IO_STATE(R_SERIAL0_BAUD, tr_baud, c115k2Hz) |
  300. IO_STATE(R_SERIAL0_BAUD, rec_baud, c115k2Hz);
  301. break;
  302. }
  303. if (p->parity == 'E') {
  304. rec_ctrl =
  305. IO_STATE(R_SERIAL0_REC_CTRL, rec_par, even) |
  306. IO_STATE(R_SERIAL0_REC_CTRL, rec_par_en, enable);
  307. tr_ctrl =
  308. IO_STATE(R_SERIAL0_TR_CTRL, tr_par, even) |
  309. IO_STATE(R_SERIAL0_TR_CTRL, tr_par_en, enable);
  310. } else if (p->parity == 'O') {
  311. rec_ctrl =
  312. IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd) |
  313. IO_STATE(R_SERIAL0_REC_CTRL, rec_par_en, enable);
  314. tr_ctrl =
  315. IO_STATE(R_SERIAL0_TR_CTRL, tr_par, odd) |
  316. IO_STATE(R_SERIAL0_TR_CTRL, tr_par_en, enable);
  317. } else {
  318. rec_ctrl =
  319. IO_STATE(R_SERIAL0_REC_CTRL, rec_par, even) |
  320. IO_STATE(R_SERIAL0_REC_CTRL, rec_par_en, disable);
  321. tr_ctrl =
  322. IO_STATE(R_SERIAL0_TR_CTRL, tr_par, even) |
  323. IO_STATE(R_SERIAL0_TR_CTRL, tr_par_en, disable);
  324. }
  325. if (p->bits == 7)
  326. {
  327. rec_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_bitnr, rec_7bit);
  328. tr_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_bitnr, tr_7bit);
  329. }
  330. else
  331. {
  332. rec_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_bitnr, rec_8bit);
  333. tr_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_bitnr, tr_8bit);
  334. }
  335. *p->rec_ctrl =
  336. IO_STATE(R_SERIAL0_REC_CTRL, dma_err, stop) |
  337. IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable) |
  338. IO_STATE(R_SERIAL0_REC_CTRL, rts_, active) |
  339. IO_STATE(R_SERIAL0_REC_CTRL, sampling, middle) |
  340. IO_STATE(R_SERIAL0_REC_CTRL, rec_stick_par, normal) |
  341. rec_ctrl;
  342. *p->tr_ctrl =
  343. IO_FIELD(R_SERIAL0_TR_CTRL, txd, 0) |
  344. IO_STATE(R_SERIAL0_TR_CTRL, tr_enable, enable) |
  345. IO_STATE(R_SERIAL0_TR_CTRL, auto_cts, disabled) |
  346. IO_STATE(R_SERIAL0_TR_CTRL, stop_bits, one_bit) |
  347. IO_STATE(R_SERIAL0_TR_CTRL, tr_stick_par, normal) |
  348. tr_ctrl;
  349. }
  350. static void
  351. console_write_direct(struct console *co, const char *buf, unsigned int len)
  352. {
  353. int i;
  354. unsigned long flags;
  355. local_irq_save(flags);
  356. if (!port)
  357. return;
  358. /* Send data */
  359. for (i = 0; i < len; i++) {
  360. /* LF -> CRLF */
  361. if (buf[i] == '\n') {
  362. while (!(*port->read & IO_MASK(R_SERIAL0_READ, tr_ready)))
  363. ;
  364. *port->write = '\r';
  365. }
  366. /* Wait until transmitter is ready and send.*/
  367. while (!(*port->read & IO_MASK(R_SERIAL0_READ, tr_ready)))
  368. ;
  369. *port->write = buf[i];
  370. }
  371. local_irq_restore(flags);
  372. }
  373. int raw_printk(const char *fmt, ...)
  374. {
  375. static char buf[1024];
  376. int printed_len;
  377. static int first = 1;
  378. if (first) {
  379. /* Force reinitialization of the port to get manual mode. */
  380. port->started = 0;
  381. start_port(port);
  382. first = 0;
  383. }
  384. va_list args;
  385. va_start(args, fmt);
  386. printed_len = vsnprintf(buf, sizeof(buf), fmt, args);
  387. va_end(args);
  388. console_write_direct(NULL, buf, strlen(buf));
  389. return printed_len;
  390. }
  391. static void
  392. console_write(struct console *co, const char *buf, unsigned int len)
  393. {
  394. if (!port)
  395. return;
  396. #ifdef CONFIG_SVINTO_SIM
  397. /* no use to simulate the serial debug output */
  398. SIMCOUT(buf, len);
  399. return;
  400. #endif
  401. console_write_direct(co, buf, len);
  402. }
  403. /* legacy function */
  404. void
  405. console_print_etrax(const char *buf)
  406. {
  407. console_write(NULL, buf, strlen(buf));
  408. }
  409. /* Use polling to get a single character FROM the debug port */
  410. int
  411. getDebugChar(void)
  412. {
  413. unsigned long readval;
  414. if (!kgdb_port)
  415. return 0;
  416. do {
  417. readval = *kgdb_port->read;
  418. } while (!(readval & IO_MASK(R_SERIAL0_READ, data_avail)));
  419. return (readval & IO_MASK(R_SERIAL0_READ, data_in));
  420. }
  421. /* Use polling to put a single character to the debug port */
  422. void
  423. putDebugChar(int val)
  424. {
  425. if (!kgdb_port)
  426. return;
  427. while (!(*kgdb_port->read & IO_MASK(R_SERIAL0_READ, tr_ready)))
  428. ;
  429. *kgdb_port->write = val;
  430. }
  431. /* Enable irq for receiving chars on the debug port, used by kgdb */
  432. void
  433. enableDebugIRQ(void)
  434. {
  435. if (!kgdb_port)
  436. return;
  437. *R_IRQ_MASK1_SET = kgdb_port->irq;
  438. /* use R_VECT_MASK directly, since we really bypass Linux normal
  439. * IRQ handling in kgdb anyway, we don't need to use enable_irq
  440. */
  441. *R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set);
  442. *kgdb_port->rec_ctrl = IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable);
  443. }
  444. static int __init
  445. console_setup(struct console *co, char *options)
  446. {
  447. char* s;
  448. if (options) {
  449. port = &ports[co->index];
  450. port->baudrate = 115200;
  451. port->parity = 'N';
  452. port->bits = 8;
  453. port->baudrate = simple_strtoul(options, NULL, 10);
  454. s = options;
  455. while(*s >= '0' && *s <= '9')
  456. s++;
  457. if (*s) port->parity = *s++;
  458. if (*s) port->bits = *s++ - '0';
  459. port->started = 0;
  460. start_port(0);
  461. }
  462. return 0;
  463. }
  464. /* This is a dummy serial device that throws away anything written to it.
  465. * This is used when no debug output is wanted.
  466. */
  467. static struct tty_driver dummy_driver;
  468. static int dummy_open(struct tty_struct *tty, struct file * filp)
  469. {
  470. return 0;
  471. }
  472. static void dummy_close(struct tty_struct *tty, struct file * filp)
  473. {
  474. }
  475. static int dummy_write(struct tty_struct * tty,
  476. const unsigned char *buf, int count)
  477. {
  478. return count;
  479. }
  480. static int
  481. dummy_write_room(struct tty_struct *tty)
  482. {
  483. return 8192;
  484. }
  485. void __init
  486. init_dummy_console(void)
  487. {
  488. memset(&dummy_driver, 0, sizeof(struct tty_driver));
  489. dummy_driver.driver_name = "serial";
  490. dummy_driver.name = "ttyS";
  491. dummy_driver.major = TTY_MAJOR;
  492. dummy_driver.minor_start = 68;
  493. dummy_driver.num = 1; /* etrax100 has 4 serial ports */
  494. dummy_driver.type = TTY_DRIVER_TYPE_SERIAL;
  495. dummy_driver.subtype = SERIAL_TYPE_NORMAL;
  496. dummy_driver.init_termios = tty_std_termios;
  497. dummy_driver.init_termios.c_cflag =
  498. B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */
  499. dummy_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS;
  500. dummy_driver.open = dummy_open;
  501. dummy_driver.close = dummy_close;
  502. dummy_driver.write = dummy_write;
  503. dummy_driver.write_room = dummy_write_room;
  504. if (tty_register_driver(&dummy_driver))
  505. panic("Couldn't register dummy serial driver\n");
  506. }
  507. static struct tty_driver*
  508. etrax_console_device(struct console* co, int *index)
  509. {
  510. if (port)
  511. *index = port->index;
  512. return port ? serial_driver : &dummy_driver;
  513. }
  514. static struct console sercons = {
  515. name : "ttyS",
  516. write: console_write,
  517. read : NULL,
  518. device : etrax_console_device,
  519. unblank : NULL,
  520. setup : console_setup,
  521. flags : CON_PRINTBUFFER,
  522. index : -1,
  523. cflag : 0,
  524. next : NULL
  525. };
  526. static struct console sercons0 = {
  527. name : "ttyS",
  528. write: console_write,
  529. read : NULL,
  530. device : etrax_console_device,
  531. unblank : NULL,
  532. setup : console_setup,
  533. flags : CON_PRINTBUFFER,
  534. index : 0,
  535. cflag : 0,
  536. next : NULL
  537. };
  538. static struct console sercons1 = {
  539. name : "ttyS",
  540. write: console_write,
  541. read : NULL,
  542. device : etrax_console_device,
  543. unblank : NULL,
  544. setup : console_setup,
  545. flags : CON_PRINTBUFFER,
  546. index : 1,
  547. cflag : 0,
  548. next : NULL
  549. };
  550. static struct console sercons2 = {
  551. name : "ttyS",
  552. write: console_write,
  553. read : NULL,
  554. device : etrax_console_device,
  555. unblank : NULL,
  556. setup : console_setup,
  557. flags : CON_PRINTBUFFER,
  558. index : 2,
  559. cflag : 0,
  560. next : NULL
  561. };
  562. static struct console sercons3 = {
  563. name : "ttyS",
  564. write: console_write,
  565. read : NULL,
  566. device : etrax_console_device,
  567. unblank : NULL,
  568. setup : console_setup,
  569. flags : CON_PRINTBUFFER,
  570. index : 3,
  571. cflag : 0,
  572. next : NULL
  573. };
  574. /*
  575. * Register console (for printk's etc)
  576. */
  577. int __init
  578. init_etrax_debug(void)
  579. {
  580. static int first = 1;
  581. if (!first) {
  582. unregister_console(&sercons);
  583. register_console(&sercons0);
  584. register_console(&sercons1);
  585. register_console(&sercons2);
  586. register_console(&sercons3);
  587. init_dummy_console();
  588. return 0;
  589. }
  590. first = 0;
  591. register_console(&sercons);
  592. start_port(port);
  593. #ifdef CONFIG_ETRAX_KGDB
  594. start_port(kgdb_port);
  595. #endif
  596. return 0;
  597. }
  598. __initcall(init_etrax_debug);