2 * (C) Copyright 2004, Freescale, Inc
3 * TsiChung Liew, Tsi-Chung.Liew@freescale.com.
5 * See file CREDITS for list of people who contributed to this
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.
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.
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,
26 * Minimal serial functions needed to use one of the PSC ports
27 * as serial console interface.
33 int serial_init (void)
35 DECLARE_GLOBAL_DATA_PTR;
37 #if defined (CONFIG_EXTUART_CONSOLE)
38 volatile uchar *cpld = (volatile uchar *) CFG_CPLD_BASE;
41 /* Check CPLD Switch 2 whether is external or internal */
42 #if defined (CONFIG_EXTUART_CONSOLE)
43 if ((*cpld & 0x02) == 0x02) {
45 return ext_serial_init ();
49 #if defined(CONFIG_PSC_CONSOLE)
51 return psc_serial_init ();
58 void serial_putc (const char c)
60 DECLARE_GLOBAL_DATA_PTR;
63 #if defined (CONFIG_EXTUART_CONSOLE)
67 #if defined(CONFIG_PSC_CONSOLE)
73 void serial_puts (const char *s)
75 DECLARE_GLOBAL_DATA_PTR;
78 #if defined (CONFIG_EXTUART_CONSOLE)
82 #if defined(CONFIG_PSC_CONSOLE)
88 int serial_getc (void)
90 DECLARE_GLOBAL_DATA_PTR;
93 #if defined (CONFIG_EXTUART_CONSOLE)
94 return ext_serial_getc ();
97 #if defined(CONFIG_PSC_CONSOLE)
98 return psc_serial_getc ();
103 int serial_tstc (void)
105 DECLARE_GLOBAL_DATA_PTR;
108 #if defined (CONFIG_EXTUART_CONSOLE)
109 return ext_serial_tstc ();
112 #if defined(CONFIG_PSC_CONSOLE)
113 return psc_serial_tstc ();
118 void serial_setbrg (void)
120 DECLARE_GLOBAL_DATA_PTR;
123 #if defined (CONFIG_EXTUART_CONSOLE)
124 ext_serial_setbrg ();
127 #if defined(CONFIG_PSC_CONSOLE)
128 psc_serial_setbrg ();