serial.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. /*
  2. * (C) Copyright 2000
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <commproc.h>
  25. #include <command.h>
  26. #include <watchdog.h>
  27. #if !defined(CONFIG_8xx_CONS_NONE) /* No Console at all */
  28. #if defined(CONFIG_8xx_CONS_SMC1) /* Console on SMC1 */
  29. #define SMC_INDEX 0
  30. #undef SCC_INDEX
  31. #define PROFF_SMC PROFF_SMC1
  32. #define CPM_CR_CH_SMC CPM_CR_CH_SMC1
  33. #elif defined(CONFIG_8xx_CONS_SMC2) /* Console on SMC2 */
  34. #define SMC_INDEX 1
  35. #undef SCC_INDEX
  36. #define PROFF_SMC PROFF_SMC2
  37. #define CPM_CR_CH_SMC CPM_CR_CH_SMC2
  38. #elif defined(CONFIG_8xx_CONS_SCC1) /* Console on SCC1 */
  39. #undef SMC_INDEX
  40. #define SCC_INDEX 0
  41. #define PROFF_SCC PROFF_SCC1
  42. #define CPM_CR_CH_SCC CPM_CR_CH_SCC1
  43. #elif defined(CONFIG_8xx_CONS_SCC2) /* Console on SCC2 */
  44. #undef SMC_INDEX
  45. #define SCC_INDEX 1
  46. #define PROFF_SCC PROFF_SCC2
  47. #define CPM_CR_CH_SCC CPM_CR_CH_SCC2
  48. #elif defined(CONFIG_8xx_CONS_SCC3) /* Console on SCC3 */
  49. #undef SMC_INDEX
  50. #define SCC_INDEX 2
  51. #define PROFF_SCC PROFF_SCC3
  52. #define CPM_CR_CH_SCC CPM_CR_CH_SCC3
  53. #elif defined(CONFIG_8xx_CONS_SCC4) /* Console on SCC4 */
  54. #undef SMC_INDEX
  55. #define SCC_INDEX 3
  56. #define PROFF_SCC PROFF_SCC4
  57. #define CPM_CR_CH_SCC CPM_CR_CH_SCC4
  58. #else /* CONFIG_8xx_CONS_? */
  59. #error "console not correctly defined"
  60. #endif
  61. #if (defined (CONFIG_8xx_CONS_SMC1) || defined (CONFIG_8xx_CONS_SMC2))
  62. /*
  63. * Minimal serial functions needed to use one of the SMC ports
  64. * as serial console interface.
  65. */
  66. int serial_init (void)
  67. {
  68. volatile immap_t *im = (immap_t *)CFG_IMMR;
  69. volatile smc_t *sp;
  70. volatile smc_uart_t *up;
  71. volatile cbd_t *tbdf, *rbdf;
  72. volatile cpm8xx_t *cp = &(im->im_cpm);
  73. #if (!defined(CONFIG_8xx_CONS_SMC1)) && (defined(CONFIG_MPC823) || defined(CONFIG_MPC850))
  74. volatile iop8xx_t *ip = (iop8xx_t *)&(im->im_ioport);
  75. #endif
  76. uint dpaddr;
  77. /* initialize pointers to SMC */
  78. sp = (smc_t *) &(cp->cp_smc[SMC_INDEX]);
  79. up = (smc_uart_t *) &cp->cp_dparam[PROFF_SMC];
  80. /* Disable transmitter/receiver.
  81. */
  82. sp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
  83. /* Enable SDMA.
  84. */
  85. im->im_siu_conf.sc_sdcr = 1;
  86. /* clear error conditions */
  87. #ifdef CFG_SDSR
  88. im->im_sdma.sdma_sdsr = CFG_SDSR;
  89. #else
  90. im->im_sdma.sdma_sdsr = 0x83;
  91. #endif
  92. /* clear SDMA interrupt mask */
  93. #ifdef CFG_SDMR
  94. im->im_sdma.sdma_sdmr = CFG_SDMR;
  95. #else
  96. im->im_sdma.sdma_sdmr = 0x00;
  97. #endif
  98. #if defined(CONFIG_8xx_CONS_SMC1)
  99. /* Use Port B for SMC1 instead of other functions.
  100. */
  101. cp->cp_pbpar |= 0x000000c0;
  102. cp->cp_pbdir &= ~0x000000c0;
  103. cp->cp_pbodr &= ~0x000000c0;
  104. #else /* CONFIG_8xx_CONS_SMC2 */
  105. # if defined(CONFIG_MPC823) || defined(CONFIG_MPC850)
  106. /* Use Port A for SMC2 instead of other functions.
  107. */
  108. ip->iop_papar |= 0x00c0;
  109. ip->iop_padir &= ~0x00c0;
  110. ip->iop_paodr &= ~0x00c0;
  111. # else /* must be a 860 then */
  112. /* Use Port B for SMC2 instead of other functions.
  113. */
  114. cp->cp_pbpar |= 0x00000c00;
  115. cp->cp_pbdir &= ~0x00000c00;
  116. cp->cp_pbodr &= ~0x00000c00;
  117. # endif
  118. #endif
  119. #if defined(CONFIG_FADS)
  120. /* Enable RS232 */
  121. #if defined(CONFIG_8xx_CONS_SMC1)
  122. *((uint *) BCSR1) &= ~BCSR1_RS232EN_1;
  123. #else
  124. *((uint *) BCSR1) &= ~BCSR1_RS232EN_2;
  125. #endif
  126. #endif /* CONFIG_FADS */
  127. #if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC)
  128. /* Enable Monitor Port Transceiver */
  129. *((uchar *) BCSR0) |= BCSR0_ENMONXCVR ;
  130. #endif /* CONFIG_RPXLITE */
  131. /* Set the physical address of the host memory buffers in
  132. * the buffer descriptors.
  133. */
  134. #ifdef CFG_ALLOC_DPRAM
  135. dpaddr = dpram_alloc_align (sizeof(cbd_t)*2 + 2, 8) ;
  136. #else
  137. dpaddr = CPM_SERIAL_BASE ;
  138. #endif
  139. /* Allocate space for two buffer descriptors in the DP ram.
  140. * For now, this address seems OK, but it may have to
  141. * change with newer versions of the firmware.
  142. * damm: allocating space after the two buffers for rx/tx data
  143. */
  144. rbdf = (cbd_t *)&cp->cp_dpmem[dpaddr];
  145. rbdf->cbd_bufaddr = (uint) (rbdf+2);
  146. rbdf->cbd_sc = 0;
  147. tbdf = rbdf + 1;
  148. tbdf->cbd_bufaddr = ((uint) (rbdf+2)) + 1;
  149. tbdf->cbd_sc = 0;
  150. /* Set up the uart parameters in the parameter ram.
  151. */
  152. up->smc_rbase = dpaddr;
  153. up->smc_tbase = dpaddr+sizeof(cbd_t);
  154. up->smc_rfcr = SMC_EB;
  155. up->smc_tfcr = SMC_EB;
  156. #if defined(CONFIG_MBX)
  157. board_serial_init();
  158. #endif /* CONFIG_MBX */
  159. /* Set UART mode, 8 bit, no parity, one stop.
  160. * Enable receive and transmit.
  161. */
  162. sp->smc_smcmr = smcr_mk_clen(9) | SMCMR_SM_UART;
  163. /* Mask all interrupts and remove anything pending.
  164. */
  165. sp->smc_smcm = 0;
  166. sp->smc_smce = 0xff;
  167. /* Set up the baud rate generator.
  168. */
  169. serial_setbrg ();
  170. /* Make the first buffer the only buffer.
  171. */
  172. tbdf->cbd_sc |= BD_SC_WRAP;
  173. rbdf->cbd_sc |= BD_SC_EMPTY | BD_SC_WRAP;
  174. /* Single character receive.
  175. */
  176. up->smc_mrblr = 1;
  177. up->smc_maxidl = 0;
  178. /* Initialize Tx/Rx parameters.
  179. */
  180. while (cp->cp_cpcr & CPM_CR_FLG) /* wait if cp is busy */
  181. ;
  182. cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SMC, CPM_CR_INIT_TRX) | CPM_CR_FLG;
  183. while (cp->cp_cpcr & CPM_CR_FLG) /* wait if cp is busy */
  184. ;
  185. /* Enable transmitter/receiver.
  186. */
  187. sp->smc_smcmr |= SMCMR_REN | SMCMR_TEN;
  188. return (0);
  189. }
  190. void
  191. serial_setbrg (void)
  192. {
  193. DECLARE_GLOBAL_DATA_PTR;
  194. volatile immap_t *im = (immap_t *)CFG_IMMR;
  195. volatile cpm8xx_t *cp = &(im->im_cpm);
  196. /* Set up the baud rate generator.
  197. * See 8xx_io/commproc.c for details.
  198. *
  199. * Wire BRG1 to SMCx
  200. */
  201. cp->cp_simode = 0x00000000;
  202. cp->cp_brgc1 =
  203. (((gd->cpu_clk / 16 / gd->baudrate)-1) << 1) | CPM_BRG_EN;
  204. }
  205. #ifdef CONFIG_MODEM_SUPPORT
  206. void disable_putc(void)
  207. {
  208. DECLARE_GLOBAL_DATA_PTR;
  209. gd->be_quiet = 1;
  210. }
  211. void enable_putc(void)
  212. {
  213. DECLARE_GLOBAL_DATA_PTR;
  214. gd->be_quiet = 0;
  215. }
  216. #endif
  217. void
  218. serial_putc(const char c)
  219. {
  220. volatile cbd_t *tbdf;
  221. volatile char *buf;
  222. volatile smc_uart_t *up;
  223. volatile immap_t *im = (immap_t *)CFG_IMMR;
  224. volatile cpm8xx_t *cpmp = &(im->im_cpm);
  225. #ifdef CONFIG_MODEM_SUPPORT
  226. DECLARE_GLOBAL_DATA_PTR;
  227. if (gd->be_quiet)
  228. return;
  229. #endif
  230. if (c == '\n')
  231. serial_putc ('\r');
  232. up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC];
  233. tbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_tbase];
  234. /* Wait for last character to go.
  235. */
  236. buf = (char *)tbdf->cbd_bufaddr;
  237. *buf = c;
  238. tbdf->cbd_datlen = 1;
  239. tbdf->cbd_sc |= BD_SC_READY;
  240. __asm__("eieio");
  241. while (tbdf->cbd_sc & BD_SC_READY) {
  242. WATCHDOG_RESET ();
  243. __asm__("eieio");
  244. }
  245. }
  246. int
  247. serial_getc(void)
  248. {
  249. volatile cbd_t *rbdf;
  250. volatile unsigned char *buf;
  251. volatile smc_uart_t *up;
  252. volatile immap_t *im = (immap_t *)CFG_IMMR;
  253. volatile cpm8xx_t *cpmp = &(im->im_cpm);
  254. unsigned char c;
  255. up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC];
  256. rbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_rbase];
  257. /* Wait for character to show up.
  258. */
  259. buf = (unsigned char *)rbdf->cbd_bufaddr;
  260. while (rbdf->cbd_sc & BD_SC_EMPTY)
  261. WATCHDOG_RESET ();
  262. c = *buf;
  263. rbdf->cbd_sc |= BD_SC_EMPTY;
  264. return(c);
  265. }
  266. int
  267. serial_tstc()
  268. {
  269. volatile cbd_t *rbdf;
  270. volatile smc_uart_t *up;
  271. volatile immap_t *im = (immap_t *)CFG_IMMR;
  272. volatile cpm8xx_t *cpmp = &(im->im_cpm);
  273. up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC];
  274. rbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_rbase];
  275. return(!(rbdf->cbd_sc & BD_SC_EMPTY));
  276. }
  277. #else /* ! CONFIG_8xx_CONS_SMC1, CONFIG_8xx_CONS_SMC2 */
  278. int serial_init (void)
  279. {
  280. volatile immap_t *im = (immap_t *)CFG_IMMR;
  281. volatile scc_t *sp;
  282. volatile scc_uart_t *up;
  283. volatile cbd_t *tbdf, *rbdf;
  284. volatile cpm8xx_t *cp = &(im->im_cpm);
  285. uint dpaddr;
  286. #if (SCC_INDEX != 2) || !defined(CONFIG_MPC850)
  287. volatile iop8xx_t *ip = (iop8xx_t *)&(im->im_ioport);
  288. #endif
  289. /* initialize pointers to SCC */
  290. sp = (scc_t *) &(cp->cp_scc[SCC_INDEX]);
  291. up = (scc_uart_t *) &cp->cp_dparam[PROFF_SCC];
  292. #if defined(CONFIG_LWMON) && defined(CONFIG_8xx_CONS_SCC2)
  293. { /* Disable Ethernet, enable Serial */
  294. uchar c;
  295. c = pic_read (0x61);
  296. c &= ~0x40; /* enable COM3 */
  297. c |= 0x80; /* disable Ethernet */
  298. pic_write (0x61, c);
  299. /* enable RTS2 */
  300. cp->cp_pbpar |= 0x2000;
  301. cp->cp_pbdat |= 0x2000;
  302. cp->cp_pbdir |= 0x2000;
  303. }
  304. #endif /* CONFIG_LWMON */
  305. /* Disable transmitter/receiver.
  306. */
  307. sp->scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
  308. #if (SCC_INDEX == 2) && defined(CONFIG_MPC850)
  309. /*
  310. * The MPC850 has SCC3 on Port B
  311. */
  312. cp->cp_pbpar |= 0x06;
  313. cp->cp_pbdir &= ~0x06;
  314. cp->cp_pbodr &= ~0x06;
  315. #elif (SCC_INDEX < 2) || !defined(CONFIG_IP860)
  316. /*
  317. * Standard configuration for SCC's is on Part A
  318. */
  319. ip->iop_papar |= ((3 << (2 * SCC_INDEX)));
  320. ip->iop_padir &= ~((3 << (2 * SCC_INDEX)));
  321. ip->iop_paodr &= ~((3 << (2 * SCC_INDEX)));
  322. #else
  323. /*
  324. * The IP860 has SCC3 and SCC4 on Port D
  325. */
  326. ip->iop_pdpar |= ((3 << (2 * SCC_INDEX)));
  327. #endif
  328. /* Allocate space for two buffer descriptors in the DP ram.
  329. */
  330. #ifdef CFG_ALLOC_DPRAM
  331. dpaddr = dpram_alloc_align (sizeof(cbd_t)*2 + 2, 8) ;
  332. #else
  333. dpaddr = CPM_SERIAL_BASE ;
  334. #endif
  335. /* Enable SDMA.
  336. */
  337. im->im_siu_conf.sc_sdcr = 0x0001;
  338. /* Set the physical address of the host memory buffers in
  339. * the buffer descriptors.
  340. */
  341. rbdf = (cbd_t *)&cp->cp_dpmem[dpaddr];
  342. rbdf->cbd_bufaddr = (uint) (rbdf+2);
  343. rbdf->cbd_sc = 0;
  344. tbdf = rbdf + 1;
  345. tbdf->cbd_bufaddr = ((uint) (rbdf+2)) + 1;
  346. tbdf->cbd_sc = 0;
  347. /* Set up the baud rate generator.
  348. */
  349. serial_setbrg ();
  350. /* Set up the uart parameters in the parameter ram.
  351. */
  352. up->scc_genscc.scc_rbase = dpaddr;
  353. up->scc_genscc.scc_tbase = dpaddr+sizeof(cbd_t);
  354. /* Initialize Tx/Rx parameters.
  355. */
  356. while (cp->cp_cpcr & CPM_CR_FLG) /* wait if cp is busy */
  357. ;
  358. cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SCC, CPM_CR_INIT_TRX) | CPM_CR_FLG;
  359. while (cp->cp_cpcr & CPM_CR_FLG) /* wait if cp is busy */
  360. ;
  361. up->scc_genscc.scc_rfcr = SCC_EB | 0x05;
  362. up->scc_genscc.scc_tfcr = SCC_EB | 0x05;
  363. up->scc_genscc.scc_mrblr = 1; /* Single character receive */
  364. up->scc_maxidl = 0; /* disable max idle */
  365. up->scc_brkcr = 1; /* send one break character on stop TX */
  366. up->scc_parec = 0;
  367. up->scc_frmec = 0;
  368. up->scc_nosec = 0;
  369. up->scc_brkec = 0;
  370. up->scc_uaddr1 = 0;
  371. up->scc_uaddr2 = 0;
  372. up->scc_toseq = 0;
  373. up->scc_char1 = 0x8000;
  374. up->scc_char2 = 0x8000;
  375. up->scc_char3 = 0x8000;
  376. up->scc_char4 = 0x8000;
  377. up->scc_char5 = 0x8000;
  378. up->scc_char6 = 0x8000;
  379. up->scc_char7 = 0x8000;
  380. up->scc_char8 = 0x8000;
  381. up->scc_rccm = 0xc0ff;
  382. /* Set low latency / small fifo.
  383. */
  384. sp->scc_gsmrh = SCC_GSMRH_RFW;
  385. /* Set SCC(x) clock mode to 16x
  386. * See 8xx_io/commproc.c for details.
  387. *
  388. * Wire BRG1 to SCCn
  389. */
  390. /* Set UART mode, clock divider 16 on Tx and Rx
  391. */
  392. sp->scc_gsmrl |=
  393. (SCC_GSMRL_MODE_UART | SCC_GSMRL_TDCR_16 | SCC_GSMRL_RDCR_16);
  394. sp->scc_psmr |= SCU_PSMR_CL;
  395. /* Mask all interrupts and remove anything pending.
  396. */
  397. sp->scc_sccm = 0;
  398. sp->scc_scce = 0xffff;
  399. sp->scc_dsr = 0x7e7e;
  400. sp->scc_psmr = 0x3000;
  401. /* Make the first buffer the only buffer.
  402. */
  403. tbdf->cbd_sc |= BD_SC_WRAP;
  404. rbdf->cbd_sc |= BD_SC_EMPTY | BD_SC_WRAP;
  405. /* Enable transmitter/receiver.
  406. */
  407. sp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT);
  408. return (0);
  409. }
  410. void
  411. serial_setbrg (void)
  412. {
  413. DECLARE_GLOBAL_DATA_PTR;
  414. volatile immap_t *im = (immap_t *)CFG_IMMR;
  415. volatile cpm8xx_t *cp = &(im->im_cpm);
  416. /* Set up the baud rate generator.
  417. * See 8xx_io/commproc.c for details.
  418. *
  419. * Wire BRG1 to SCCx
  420. */
  421. cp->cp_sicr &= ~(0x000000FF << (8 * SCC_INDEX));
  422. /* no |= needed, since BRG1 is 000 */
  423. cp->cp_brgc1 =
  424. (((gd->cpu_clk / 16 / gd->baudrate)-1) << 1) | CPM_BRG_EN;
  425. }
  426. void
  427. serial_putc(const char c)
  428. {
  429. volatile cbd_t *tbdf;
  430. volatile char *buf;
  431. volatile scc_uart_t *up;
  432. volatile immap_t *im = (immap_t *)CFG_IMMR;
  433. volatile cpm8xx_t *cpmp = &(im->im_cpm);
  434. if (c == '\n')
  435. serial_putc ('\r');
  436. up = (scc_uart_t *)&cpmp->cp_dparam[PROFF_SCC];
  437. tbdf = (cbd_t *)&cpmp->cp_dpmem[up->scc_genscc.scc_tbase];
  438. /* Wait for last character to go.
  439. */
  440. buf = (char *)tbdf->cbd_bufaddr;
  441. *buf = c;
  442. tbdf->cbd_datlen = 1;
  443. tbdf->cbd_sc |= BD_SC_READY;
  444. __asm__("eieio");
  445. while (tbdf->cbd_sc & BD_SC_READY) {
  446. __asm__("eieio");
  447. WATCHDOG_RESET ();
  448. }
  449. }
  450. int
  451. serial_getc(void)
  452. {
  453. volatile cbd_t *rbdf;
  454. volatile unsigned char *buf;
  455. volatile scc_uart_t *up;
  456. volatile immap_t *im = (immap_t *)CFG_IMMR;
  457. volatile cpm8xx_t *cpmp = &(im->im_cpm);
  458. unsigned char c;
  459. up = (scc_uart_t *)&cpmp->cp_dparam[PROFF_SCC];
  460. rbdf = (cbd_t *)&cpmp->cp_dpmem[up->scc_genscc.scc_rbase];
  461. /* Wait for character to show up.
  462. */
  463. buf = (unsigned char *)rbdf->cbd_bufaddr;
  464. while (rbdf->cbd_sc & BD_SC_EMPTY)
  465. WATCHDOG_RESET ();
  466. c = *buf;
  467. rbdf->cbd_sc |= BD_SC_EMPTY;
  468. return(c);
  469. }
  470. int
  471. serial_tstc()
  472. {
  473. volatile cbd_t *rbdf;
  474. volatile scc_uart_t *up;
  475. volatile immap_t *im = (immap_t *)CFG_IMMR;
  476. volatile cpm8xx_t *cpmp = &(im->im_cpm);
  477. up = (scc_uart_t *)&cpmp->cp_dparam[PROFF_SCC];
  478. rbdf = (cbd_t *)&cpmp->cp_dpmem[up->scc_genscc.scc_rbase];
  479. return(!(rbdf->cbd_sc & BD_SC_EMPTY));
  480. }
  481. #endif /* CONFIG_8xx_CONS_SMC1, CONFIG_8xx_CONS_SMC2 */
  482. void
  483. serial_puts (const char *s)
  484. {
  485. while (*s) {
  486. serial_putc (*s++);
  487. }
  488. }
  489. #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
  490. void
  491. kgdb_serial_init(void)
  492. {
  493. #if defined(CONFIG_8xx_CONS_SMC1)
  494. serial_printf("[on SMC1] ");
  495. #elif defined(CONFIG_8xx_CONS_SMC2)
  496. serial_printf("[on SMC2] ");
  497. #elif defined(CONFIG_8xx_CONS_SCC1)
  498. serial_printf("[on SCC1] ");
  499. #elif defined(CONFIG_8xx_CONS_SCC2)
  500. serial_printf("[on SCC2] ");
  501. #elif defined(CONFIG_8xx_CONS_SCC3)
  502. serial_printf("[on SCC3] ");
  503. #elif defined(CONFIG_8xx_CONS_SCC4)
  504. serial_printf("[on SCC4] ");
  505. #endif
  506. }
  507. void
  508. putDebugChar (int c)
  509. {
  510. serial_putc (c);
  511. }
  512. void
  513. putDebugStr (const char *str)
  514. {
  515. serial_puts (str);
  516. }
  517. int
  518. getDebugChar (void)
  519. {
  520. return serial_getc();
  521. }
  522. void
  523. kgdb_interruptible (int yes)
  524. {
  525. return;
  526. }
  527. #endif /* CFG_CMD_KGDB */
  528. #endif /* CONFIG_8xx_CONS_NONE */