aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2007-04-27 15:50:03 -0400
committerPaul Mackerras <paulus@samba.org>2007-04-29 21:02:04 -0400
commit8b01653ab01eebc781c5a375ff336d0837f30c4e (patch)
treef86e552eb7e1490dec344c1088b97fa03e7238a7 /arch
parent8c38fc2b7429b26105fe244890c8d5ab3043f099 (diff)
[POWERPC] Add uartlite boot console driver for the zImage wrapper
Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/ppc/boot/common/misc-common.c15
-rw-r--r--arch/ppc/boot/simple/Makefile1
-rw-r--r--arch/ppc/boot/simple/uartlite_tty.c37
3 files changed, 48 insertions, 5 deletions
diff --git a/arch/ppc/boot/common/misc-common.c b/arch/ppc/boot/common/misc-common.c
index 8e1fccd96fc0..9589969cec72 100644
--- a/arch/ppc/boot/common/misc-common.c
+++ b/arch/ppc/boot/common/misc-common.c
@@ -57,7 +57,8 @@ unsigned char *ISA_io = NULL;
57 57
58#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \ 58#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
59 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \ 59 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
60 || defined(CONFIG_SERIAL_MPSC_CONSOLE) 60 || defined(CONFIG_SERIAL_MPSC_CONSOLE) \
61 || defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
61extern unsigned long com_port; 62extern unsigned long com_port;
62 63
63extern int serial_tstc(unsigned long com_port); 64extern int serial_tstc(unsigned long com_port);
@@ -80,7 +81,8 @@ int tstc(void)
80{ 81{
81#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \ 82#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
82 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \ 83 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
83 || defined(CONFIG_SERIAL_MPSC_CONSOLE) 84 || defined(CONFIG_SERIAL_MPSC_CONSOLE) \
85 || defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
84 if(keyb_present) 86 if(keyb_present)
85 return (CRT_tstc() || serial_tstc(com_port)); 87 return (CRT_tstc() || serial_tstc(com_port));
86 else 88 else
@@ -95,7 +97,8 @@ int getc(void)
95 while (1) { 97 while (1) {
96#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \ 98#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
97 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \ 99 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
98 || defined(CONFIG_SERIAL_MPSC_CONSOLE) 100 || defined(CONFIG_SERIAL_MPSC_CONSOLE) \
101 || defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
99 if (serial_tstc(com_port)) 102 if (serial_tstc(com_port))
100 return (serial_getc(com_port)); 103 return (serial_getc(com_port));
101#endif /* serial console */ 104#endif /* serial console */
@@ -112,7 +115,8 @@ putc(const char c)
112 115
113#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \ 116#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
114 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \ 117 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
115 || defined(CONFIG_SERIAL_MPSC_CONSOLE) 118 || defined(CONFIG_SERIAL_MPSC_CONSOLE) \
119 || defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
116 serial_putc(com_port, c); 120 serial_putc(com_port, c);
117 if ( c == '\n' ) 121 if ( c == '\n' )
118 serial_putc(com_port, '\r'); 122 serial_putc(com_port, '\r');
@@ -161,7 +165,8 @@ void puts(const char *s)
161 while ( ( c = *s++ ) != '\0' ) { 165 while ( ( c = *s++ ) != '\0' ) {
162#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \ 166#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
163 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \ 167 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
164 || defined(CONFIG_SERIAL_MPSC_CONSOLE) 168 || defined(CONFIG_SERIAL_MPSC_CONSOLE) \
169 || defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
165 serial_putc(com_port, c); 170 serial_putc(com_port, c);
166 if ( c == '\n' ) serial_putc(com_port, '\r'); 171 if ( c == '\n' ) serial_putc(com_port, '\r');
167#endif /* serial console */ 172#endif /* serial console */
diff --git a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile
index bcfb6cde70c4..5b877792d14f 100644
--- a/arch/ppc/boot/simple/Makefile
+++ b/arch/ppc/boot/simple/Makefile
@@ -201,6 +201,7 @@ boot-$(CONFIG_8260) += m8260_tty.o
201endif 201endif
202boot-$(CONFIG_SERIAL_MPC52xx_CONSOLE) += mpc52xx_tty.o 202boot-$(CONFIG_SERIAL_MPC52xx_CONSOLE) += mpc52xx_tty.o
203boot-$(CONFIG_SERIAL_MPSC_CONSOLE) += mv64x60_tty.o 203boot-$(CONFIG_SERIAL_MPSC_CONSOLE) += mv64x60_tty.o
204boot-$(CONFIG_SERIAL_UARTLITE_CONSOLE) += uartlite_tty.o
204 205
205LIBS := $(common)/lib.a $(bootlib)/lib.a 206LIBS := $(common)/lib.a $(bootlib)/lib.a
206ifeq ($(CONFIG_PPC_PREP),y) 207ifeq ($(CONFIG_PPC_PREP),y)
diff --git a/arch/ppc/boot/simple/uartlite_tty.c b/arch/ppc/boot/simple/uartlite_tty.c
new file mode 100644
index 000000000000..0eae1eab38d4
--- /dev/null
+++ b/arch/ppc/boot/simple/uartlite_tty.c
@@ -0,0 +1,37 @@
1/*
2 * Xilinx UARTLITE bootloader driver
3 *
4 * Copyright (c) 2007 Secret Lab Technologies Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/types.h>
13#include <asm/serial.h>
14#include <asm/io.h>
15#include <platforms/4xx/xparameters/xparameters.h>
16
17#define UARTLITE_BASEADDR ((void*)(XPAR_UARTLITE_0_BASEADDR))
18
19void
20serial_putc(unsigned long com_port, unsigned char c)
21{
22 while ((in_be32(UARTLITE_BASEADDR + 0x8) & 0x08) != 0); /* spin */
23 out_be32(UARTLITE_BASEADDR + 0x4, c);
24}
25
26unsigned char
27serial_getc(unsigned long com_port)
28{
29 while ((in_be32(UARTLITE_BASEADDR + 0x8) & 0x01) == 0); /* spin */
30 return in_be32(UARTLITE_BASEADDR);
31}
32
33int
34serial_tstc(unsigned long com_port)
35{
36 return ((in_be32(UARTLITE_BASEADDR + 0x8) & 0x01) != 0);
37}