]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[POWERPC] Add uartlite boot console driver for the zImage wrapper
authorGrant Likely <grant.likely@secretlab.ca>
Fri, 27 Apr 2007 19:50:03 +0000 (05:50 +1000)
committerPaul Mackerras <paulus@samba.org>
Mon, 30 Apr 2007 01:02:04 +0000 (11:02 +1000)
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/ppc/boot/common/misc-common.c
arch/ppc/boot/simple/Makefile
arch/ppc/boot/simple/uartlite_tty.c [new file with mode: 0644]

index 8e1fccd96fc029a252f58c67c181bca0012abc10..9589969cec725d86b1817d0248efc244ec8b73ae 100644 (file)
@@ -57,7 +57,8 @@ unsigned char *ISA_io = NULL;
 
 #if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
        || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
-       || defined(CONFIG_SERIAL_MPSC_CONSOLE)
+       || defined(CONFIG_SERIAL_MPSC_CONSOLE) \
+       || defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
 extern unsigned long com_port;
 
 extern int serial_tstc(unsigned long com_port);
@@ -80,7 +81,8 @@ int tstc(void)
 {
 #if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
        || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
-       || defined(CONFIG_SERIAL_MPSC_CONSOLE)
+       || defined(CONFIG_SERIAL_MPSC_CONSOLE) \
+       || defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
        if(keyb_present)
                return (CRT_tstc() || serial_tstc(com_port));
        else
@@ -95,7 +97,8 @@ int getc(void)
        while (1) {
 #if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
        || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
-       || defined(CONFIG_SERIAL_MPSC_CONSOLE)
+       || defined(CONFIG_SERIAL_MPSC_CONSOLE) \
+       || defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
                if (serial_tstc(com_port))
                        return (serial_getc(com_port));
 #endif /* serial console */
@@ -112,7 +115,8 @@ putc(const char c)
 
 #if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
        || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
-       || defined(CONFIG_SERIAL_MPSC_CONSOLE)
+       || defined(CONFIG_SERIAL_MPSC_CONSOLE) \
+       || defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
        serial_putc(com_port, c);
        if ( c == '\n' )
                serial_putc(com_port, '\r');
@@ -161,7 +165,8 @@ void puts(const char *s)
        while ( ( c = *s++ ) != '\0' ) {
 #if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
        || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
-       || defined(CONFIG_SERIAL_MPSC_CONSOLE)
+       || defined(CONFIG_SERIAL_MPSC_CONSOLE) \
+       || defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
                serial_putc(com_port, c);
                if ( c == '\n' ) serial_putc(com_port, '\r');
 #endif /* serial console */
index bcfb6cde70c4c90b8463ec37fc25a1291b90eda6..5b877792d14f6566feee08f21cb9b5ce8d000451 100644 (file)
@@ -201,6 +201,7 @@ boot-$(CONFIG_8260)         += m8260_tty.o
 endif
 boot-$(CONFIG_SERIAL_MPC52xx_CONSOLE)  += mpc52xx_tty.o
 boot-$(CONFIG_SERIAL_MPSC_CONSOLE)     += mv64x60_tty.o
+boot-$(CONFIG_SERIAL_UARTLITE_CONSOLE) += uartlite_tty.o
 
 LIBS                           := $(common)/lib.a $(bootlib)/lib.a
 ifeq ($(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 (file)
index 0000000..0eae1ea
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Xilinx UARTLITE bootloader driver
+ *
+ * Copyright (c) 2007 Secret Lab Technologies Ltd.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/types.h>
+#include <asm/serial.h>
+#include <asm/io.h>
+#include <platforms/4xx/xparameters/xparameters.h>
+
+#define UARTLITE_BASEADDR ((void*)(XPAR_UARTLITE_0_BASEADDR))
+
+void
+serial_putc(unsigned long com_port, unsigned char c)
+{
+       while ((in_be32(UARTLITE_BASEADDR + 0x8) & 0x08) != 0); /* spin */
+       out_be32(UARTLITE_BASEADDR + 0x4, c);
+}
+
+unsigned char
+serial_getc(unsigned long com_port)
+{
+       while ((in_be32(UARTLITE_BASEADDR + 0x8) & 0x01) == 0); /* spin */
+       return in_be32(UARTLITE_BASEADDR);
+}
+
+int
+serial_tstc(unsigned long com_port)
+{
+       return ((in_be32(UARTLITE_BASEADDR + 0x8) & 0x01) != 0);
+}