debugport.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  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/console.h>
  106. #include <linux/init.h>
  107. #include <linux/major.h>
  108. #include <linux/delay.h>
  109. #include <linux/tty.h>
  110. #include <asm/system.h>
  111. #include <asm/arch/svinto.h>
  112. #include <asm/io.h> /* Get SIMCOUT. */
  113. struct dbg_port
  114. {
  115. unsigned int index;
  116. const volatile unsigned* read;
  117. volatile char* write;
  118. volatile unsigned* xoff;
  119. volatile char* baud;
  120. volatile char* tr_ctrl;
  121. volatile char* rec_ctrl;
  122. unsigned long irq;
  123. unsigned int started;
  124. unsigned long baudrate;
  125. unsigned char parity;
  126. unsigned int bits;
  127. };
  128. struct dbg_port ports[]=
  129. {
  130. {
  131. 0,
  132. R_SERIAL0_READ,
  133. R_SERIAL0_TR_DATA,
  134. R_SERIAL0_XOFF,
  135. R_SERIAL0_BAUD,
  136. R_SERIAL0_TR_CTRL,
  137. R_SERIAL0_REC_CTRL,
  138. IO_STATE(R_IRQ_MASK1_SET, ser0_data, set),
  139. 0,
  140. 115200,
  141. 'N',
  142. 8
  143. },
  144. {
  145. 1,
  146. R_SERIAL1_READ,
  147. R_SERIAL1_TR_DATA,
  148. R_SERIAL1_XOFF,
  149. R_SERIAL1_BAUD,
  150. R_SERIAL1_TR_CTRL,
  151. R_SERIAL1_REC_CTRL,
  152. IO_STATE(R_IRQ_MASK1_SET, ser1_data, set),
  153. 0,
  154. 115200,
  155. 'N',
  156. 8
  157. },
  158. {
  159. 2,
  160. R_SERIAL2_READ,
  161. R_SERIAL2_TR_DATA,
  162. R_SERIAL2_XOFF,
  163. R_SERIAL2_BAUD,
  164. R_SERIAL2_TR_CTRL,
  165. R_SERIAL2_REC_CTRL,
  166. IO_STATE(R_IRQ_MASK1_SET, ser2_data, set),
  167. 0,
  168. 115200,
  169. 'N',
  170. 8
  171. },
  172. {
  173. 3,
  174. R_SERIAL3_READ,
  175. R_SERIAL3_TR_DATA,
  176. R_SERIAL3_XOFF,
  177. R_SERIAL3_BAUD,
  178. R_SERIAL3_TR_CTRL,
  179. R_SERIAL3_REC_CTRL,
  180. IO_STATE(R_IRQ_MASK1_SET, ser3_data, set),
  181. 0,
  182. 115200,
  183. 'N',
  184. 8
  185. }
  186. };
  187. extern struct tty_driver *serial_driver;
  188. struct dbg_port* port =
  189. #if defined(CONFIG_ETRAX_DEBUG_PORT0)
  190. &ports[0];
  191. #elif defined(CONFIG_ETRAX_DEBUG_PORT1)
  192. &ports[1];
  193. #elif defined(CONFIG_ETRAX_DEBUG_PORT2)
  194. &ports[2];
  195. #elif defined(CONFIG_ETRAX_DEBUG_PORT3)
  196. &ports[3];
  197. #else
  198. NULL;
  199. #endif
  200. static struct dbg_port* kgdb_port =
  201. #if defined(CONFIG_ETRAX_KGDB_PORT0)
  202. &ports[0];
  203. #elif defined(CONFIG_ETRAX_KGDB_PORT1)
  204. &ports[1];
  205. #elif defined(CONFIG_ETRAX_KGDB_PORT2)
  206. &ports[2];
  207. #elif defined(CONFIG_ETRAX_KGDB_PORT3)
  208. &ports[3];
  209. #else
  210. NULL;
  211. #endif
  212. static void
  213. start_port(struct dbg_port* p)
  214. {
  215. unsigned long rec_ctrl = 0;
  216. unsigned long tr_ctrl = 0;
  217. if (!p)
  218. return;
  219. if (p->started)
  220. return;
  221. p->started = 1;
  222. if (p->index == 0)
  223. {
  224. genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma6);
  225. genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma6, unused);
  226. }
  227. else if (p->index == 1)
  228. {
  229. genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma8);
  230. genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma8, usb);
  231. }
  232. else if (p->index == 2)
  233. {
  234. genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma2);
  235. genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma2, par0);
  236. genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma3);
  237. genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma3, par0);
  238. genconfig_shadow |= IO_STATE(R_GEN_CONFIG, ser2, select);
  239. }
  240. else
  241. {
  242. genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma4);
  243. genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, par1);
  244. genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma5);
  245. genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma5, par1);
  246. genconfig_shadow |= IO_STATE(R_GEN_CONFIG, ser3, select);
  247. }
  248. *R_GEN_CONFIG = genconfig_shadow;
  249. *p->xoff =
  250. IO_STATE(R_SERIAL0_XOFF, tx_stop, enable) |
  251. IO_STATE(R_SERIAL0_XOFF, auto_xoff, disable) |
  252. IO_FIELD(R_SERIAL0_XOFF, xoff_char, 0);
  253. switch (p->baudrate)
  254. {
  255. case 0:
  256. case 115200:
  257. *p->baud =
  258. IO_STATE(R_SERIAL0_BAUD, tr_baud, c115k2Hz) |
  259. IO_STATE(R_SERIAL0_BAUD, rec_baud, c115k2Hz);
  260. break;
  261. case 1200:
  262. *p->baud =
  263. IO_STATE(R_SERIAL0_BAUD, tr_baud, c1200Hz) |
  264. IO_STATE(R_SERIAL0_BAUD, rec_baud, c1200Hz);
  265. break;
  266. case 2400:
  267. *p->baud =
  268. IO_STATE(R_SERIAL0_BAUD, tr_baud, c2400Hz) |
  269. IO_STATE(R_SERIAL0_BAUD, rec_baud, c2400Hz);
  270. break;
  271. case 4800:
  272. *p->baud =
  273. IO_STATE(R_SERIAL0_BAUD, tr_baud, c4800Hz) |
  274. IO_STATE(R_SERIAL0_BAUD, rec_baud, c4800Hz);
  275. break;
  276. case 9600:
  277. *p->baud =
  278. IO_STATE(R_SERIAL0_BAUD, tr_baud, c9600Hz) |
  279. IO_STATE(R_SERIAL0_BAUD, rec_baud, c9600Hz);
  280. break;
  281. case 19200:
  282. *p->baud =
  283. IO_STATE(R_SERIAL0_BAUD, tr_baud, c19k2Hz) |
  284. IO_STATE(R_SERIAL0_BAUD, rec_baud, c19k2Hz);
  285. break;
  286. case 38400:
  287. *p->baud =
  288. IO_STATE(R_SERIAL0_BAUD, tr_baud, c38k4Hz) |
  289. IO_STATE(R_SERIAL0_BAUD, rec_baud, c38k4Hz);
  290. break;
  291. case 57600:
  292. *p->baud =
  293. IO_STATE(R_SERIAL0_BAUD, tr_baud, c57k6Hz) |
  294. IO_STATE(R_SERIAL0_BAUD, rec_baud, c57k6Hz);
  295. break;
  296. default:
  297. *p->baud =
  298. IO_STATE(R_SERIAL0_BAUD, tr_baud, c115k2Hz) |
  299. IO_STATE(R_SERIAL0_BAUD, rec_baud, c115k2Hz);
  300. break;
  301. }
  302. if (p->parity == 'E') {
  303. rec_ctrl =
  304. IO_STATE(R_SERIAL0_REC_CTRL, rec_par, even) |
  305. IO_STATE(R_SERIAL0_REC_CTRL, rec_par_en, enable);
  306. tr_ctrl =
  307. IO_STATE(R_SERIAL0_TR_CTRL, tr_par, even) |
  308. IO_STATE(R_SERIAL0_TR_CTRL, tr_par_en, enable);
  309. } else if (p->parity == 'O') {
  310. rec_ctrl =
  311. IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd) |
  312. IO_STATE(R_SERIAL0_REC_CTRL, rec_par_en, enable);
  313. tr_ctrl =
  314. IO_STATE(R_SERIAL0_TR_CTRL, tr_par, odd) |
  315. IO_STATE(R_SERIAL0_TR_CTRL, tr_par_en, enable);
  316. } else {
  317. rec_ctrl =
  318. IO_STATE(R_SERIAL0_REC_CTRL, rec_par, even) |
  319. IO_STATE(R_SERIAL0_REC_CTRL, rec_par_en, disable);
  320. tr_ctrl =
  321. IO_STATE(R_SERIAL0_TR_CTRL, tr_par, even) |
  322. IO_STATE(R_SERIAL0_TR_CTRL, tr_par_en, disable);
  323. }
  324. if (p->bits == 7)
  325. {
  326. rec_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_bitnr, rec_7bit);
  327. tr_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_bitnr, tr_7bit);
  328. }
  329. else
  330. {
  331. rec_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_bitnr, rec_8bit);
  332. tr_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_bitnr, tr_8bit);
  333. }
  334. *p->rec_ctrl =
  335. IO_STATE(R_SERIAL0_REC_CTRL, dma_err, stop) |
  336. IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable) |
  337. IO_STATE(R_SERIAL0_REC_CTRL, rts_, active) |
  338. IO_STATE(R_SERIAL0_REC_CTRL, sampling, middle) |
  339. IO_STATE(R_SERIAL0_REC_CTRL, rec_stick_par, normal) |
  340. rec_ctrl;
  341. *p->tr_ctrl =
  342. IO_FIELD(R_SERIAL0_TR_CTRL, txd, 0) |
  343. IO_STATE(R_SERIAL0_TR_CTRL, tr_enable, enable) |
  344. IO_STATE(R_SERIAL0_TR_CTRL, auto_cts, disabled) |
  345. IO_STATE(R_SERIAL0_TR_CTRL, stop_bits, one_bit) |
  346. IO_STATE(R_SERIAL0_TR_CTRL, tr_stick_par, normal) |
  347. tr_ctrl;
  348. }
  349. static void
  350. console_write_direct(struct console *co, const char *buf, unsigned int len)
  351. {
  352. int i;
  353. unsigned long flags;
  354. local_irq_save(flags);
  355. if (!port)
  356. return;
  357. /* Send data */
  358. for (i = 0; i < len; i++) {
  359. /* LF -> CRLF */
  360. if (buf[i] == '\n') {
  361. while (!(*port->read & IO_MASK(R_SERIAL0_READ, tr_ready)))
  362. ;
  363. *port->write = '\r';
  364. }
  365. /* Wait until transmitter is ready and send.*/
  366. while (!(*port->read & IO_MASK(R_SERIAL0_READ, tr_ready)))
  367. ;
  368. *port->write = buf[i];
  369. }
  370. local_irq_restore(flags);
  371. }
  372. int raw_printk(const char *fmt, ...)
  373. {
  374. static char buf[1024];
  375. int printed_len;
  376. static int first = 1;
  377. if (first) {
  378. /* Force reinitialization of the port to get manual mode. */
  379. port->started = 0;
  380. start_port(port);
  381. first = 0;
  382. }
  383. va_list args;
  384. va_start(args, fmt);
  385. printed_len = vsnprintf(buf, sizeof(buf), fmt, args);
  386. va_end(args);
  387. console_write_direct(NULL, buf, strlen(buf));
  388. return printed_len;
  389. }
  390. static void
  391. console_write(struct console *co, const char *buf, unsigned int len)
  392. {
  393. if (!port)
  394. return;
  395. #ifdef CONFIG_SVINTO_SIM
  396. /* no use to simulate the serial debug output */
  397. SIMCOUT(buf, len);
  398. return;
  399. #endif
  400. console_write_direct(co, buf, len);
  401. }
  402. /* legacy function */
  403. void
  404. console_print_etrax(const char *buf)
  405. {
  406. console_write(NULL, buf, strlen(buf));
  407. }
  408. /* Use polling to get a single character FROM the debug port */
  409. int
  410. getDebugChar(void)
  411. {
  412. unsigned long readval;
  413. if (!kgdb_port)
  414. return 0;
  415. do {
  416. readval = *kgdb_port->read;
  417. } while (!(readval & IO_MASK(R_SERIAL0_READ, data_avail)));
  418. return (readval & IO_MASK(R_SERIAL0_READ, data_in));
  419. }
  420. /* Use polling to put a single character to the debug port */
  421. void
  422. putDebugChar(int val)
  423. {
  424. if (!kgdb_port)
  425. return;
  426. while (!(*kgdb_port->read & IO_MASK(R_SERIAL0_READ, tr_ready)))
  427. ;
  428. *kgdb_port->write = val;
  429. }
  430. /* Enable irq for receiving chars on the debug port, used by kgdb */
  431. void
  432. enableDebugIRQ(void)
  433. {
  434. if (!kgdb_port)
  435. return;
  436. *R_IRQ_MASK1_SET = kgdb_port->irq;
  437. /* use R_VECT_MASK directly, since we really bypass Linux normal
  438. * IRQ handling in kgdb anyway, we don't need to use enable_irq
  439. */
  440. *R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set);
  441. *kgdb_port->rec_ctrl = IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable);
  442. }
  443. static int __init
  444. console_setup(struct console *co, char *options)
  445. {
  446. char* s;
  447. if (options) {
  448. port = &ports[co->index];
  449. port->baudrate = 115200;
  450. port->parity = 'N';
  451. port->bits = 8;
  452. port->baudrate = simple_strtoul(options, NULL, 10);
  453. s = options;
  454. while(*s >= '0' && *s <= '9')
  455. s++;
  456. if (*s) port->parity = *s++;
  457. if (*s) port->bits = *s++ - '0';
  458. port->started = 0;
  459. start_port(0);
  460. }
  461. return 0;
  462. }
  463. /* This is a dummy serial device that throws away anything written to it.
  464. * This is used when no debug output is wanted.
  465. */
  466. static struct tty_driver dummy_driver;
  467. static int dummy_open(struct tty_struct *tty, struct file * filp)
  468. {
  469. return 0;
  470. }
  471. static void dummy_close(struct tty_struct *tty, struct file * filp)
  472. {
  473. }
  474. static int dummy_write(struct tty_struct * tty,
  475. const unsigned char *buf, int count)
  476. {
  477. return count;
  478. }
  479. static int
  480. dummy_write_room(struct tty_struct *tty)
  481. {
  482. return 8192;
  483. }
  484. void __init
  485. init_dummy_console(void)
  486. {
  487. memset(&dummy_driver, 0, sizeof(struct tty_driver));
  488. dummy_driver.driver_name = "serial";
  489. dummy_driver.name = "ttyS";
  490. dummy_driver.major = TTY_MAJOR;
  491. dummy_driver.minor_start = 68;
  492. dummy_driver.num = 1; /* etrax100 has 4 serial ports */
  493. dummy_driver.type = TTY_DRIVER_TYPE_SERIAL;
  494. dummy_driver.subtype = SERIAL_TYPE_NORMAL;
  495. dummy_driver.init_termios = tty_std_termios;
  496. dummy_driver.init_termios.c_cflag =
  497. B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */
  498. dummy_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
  499. dummy_driver.open = dummy_open;
  500. dummy_driver.close = dummy_close;
  501. dummy_driver.write = dummy_write;
  502. dummy_driver.write_room = dummy_write_room;
  503. if (tty_register_driver(&dummy_driver))
  504. panic("Couldn't register dummy serial driver\n");
  505. }
  506. static struct tty_driver*
  507. etrax_console_device(struct console* co, int *index)
  508. {
  509. if (port)
  510. *index = port->index;
  511. return port ? serial_driver : &dummy_driver;
  512. }
  513. static struct console sercons = {
  514. name : "ttyS",
  515. write: console_write,
  516. read : NULL,
  517. device : etrax_console_device,
  518. unblank : NULL,
  519. setup : console_setup,
  520. flags : CON_PRINTBUFFER,
  521. index : -1,
  522. cflag : 0,
  523. next : NULL
  524. };
  525. static struct console sercons0 = {
  526. name : "ttyS",
  527. write: console_write,
  528. read : NULL,
  529. device : etrax_console_device,
  530. unblank : NULL,
  531. setup : console_setup,
  532. flags : CON_PRINTBUFFER,
  533. index : 0,
  534. cflag : 0,
  535. next : NULL
  536. };
  537. static struct console sercons1 = {
  538. name : "ttyS",
  539. write: console_write,
  540. read : NULL,
  541. device : etrax_console_device,
  542. unblank : NULL,
  543. setup : console_setup,
  544. flags : CON_PRINTBUFFER,
  545. index : 1,
  546. cflag : 0,
  547. next : NULL
  548. };
  549. static struct console sercons2 = {
  550. name : "ttyS",
  551. write: console_write,
  552. read : NULL,
  553. device : etrax_console_device,
  554. unblank : NULL,
  555. setup : console_setup,
  556. flags : CON_PRINTBUFFER,
  557. index : 2,
  558. cflag : 0,
  559. next : NULL
  560. };
  561. static struct console sercons3 = {
  562. name : "ttyS",
  563. write: console_write,
  564. read : NULL,
  565. device : etrax_console_device,
  566. unblank : NULL,
  567. setup : console_setup,
  568. flags : CON_PRINTBUFFER,
  569. index : 3,
  570. cflag : 0,
  571. next : NULL
  572. };
  573. /*
  574. * Register console (for printk's etc)
  575. */
  576. int __init
  577. init_etrax_debug(void)
  578. {
  579. static int first = 1;
  580. if (!first) {
  581. unregister_console(&sercons);
  582. register_console(&sercons0);
  583. register_console(&sercons1);
  584. register_console(&sercons2);
  585. register_console(&sercons3);
  586. init_dummy_console();
  587. return 0;
  588. }
  589. first = 0;
  590. register_console(&sercons);
  591. start_port(port);
  592. #ifdef CONFIG_ETRAX_KGDB
  593. start_port(kgdb_port);
  594. #endif
  595. return 0;
  596. }
  597. __initcall(init_etrax_debug);