aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2007-10-01 22:15:13 -0400
committerJosh Boyer <jwboyer@linux.vnet.ibm.com>2007-10-03 08:23:13 -0400
commit7ddc5f978b16c024b6c1fcecbda6815d3d3222ef (patch)
treec6772bcbf1c19583b9aaf1303aea09e12e2568a0 /arch/powerpc/boot
parent340ffd267c85fc28da7cfd681b177c816af800cf (diff)
[POWERPC] Virtex: Add uartlite bootwrapper driver
Allows the bootwrapper to use the uartlite device for console output. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Diffstat (limited to 'arch/powerpc/boot')
-rw-r--r--arch/powerpc/boot/Makefile2
-rw-r--r--arch/powerpc/boot/ops.h1
-rw-r--r--arch/powerpc/boot/serial.c2
-rw-r--r--arch/powerpc/boot/uartlite.c64
4 files changed, 68 insertions, 1 deletions
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 53fd8e6a4e3b..cf80db3ef78c 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -46,7 +46,7 @@ src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \
46 ns16550.c serial.c simple_alloc.c div64.S util.S \ 46 ns16550.c serial.c simple_alloc.c div64.S util.S \
47 gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ 47 gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \
48 4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \ 48 4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
49 cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c 49 cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c
50src-plat := of.c cuboot-52xx.c cuboot-83xx.c cuboot-85xx.c holly.c \ 50src-plat := of.c cuboot-52xx.c cuboot-83xx.c cuboot-85xx.c holly.c \
51 cuboot-ebony.c treeboot-ebony.c prpmc2800.c \ 51 cuboot-ebony.c treeboot-ebony.c prpmc2800.c \
52 ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \ 52 ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
index e948e57abef8..a180b6505f47 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -85,6 +85,7 @@ int ns16550_console_init(void *devp, struct serial_console_data *scdp);
85int mpsc_console_init(void *devp, struct serial_console_data *scdp); 85int mpsc_console_init(void *devp, struct serial_console_data *scdp);
86int cpm_console_init(void *devp, struct serial_console_data *scdp); 86int cpm_console_init(void *devp, struct serial_console_data *scdp);
87int mpc5200_psc_console_init(void *devp, struct serial_console_data *scdp); 87int mpc5200_psc_console_init(void *devp, struct serial_console_data *scdp);
88int uartlite_console_init(void *devp, struct serial_console_data *scdp);
88void *simple_alloc_init(char *base, unsigned long heap_size, 89void *simple_alloc_init(char *base, unsigned long heap_size,
89 unsigned long granularity, unsigned long max_allocs); 90 unsigned long granularity, unsigned long max_allocs);
90extern void flush_cache(void *, unsigned long); 91extern void flush_cache(void *, unsigned long);
diff --git a/arch/powerpc/boot/serial.c b/arch/powerpc/boot/serial.c
index 95e08e4ddcd2..cafeece20ac7 100644
--- a/arch/powerpc/boot/serial.c
+++ b/arch/powerpc/boot/serial.c
@@ -128,6 +128,8 @@ int serial_console_init(void)
128 rc = cpm_console_init(devp, &serial_cd); 128 rc = cpm_console_init(devp, &serial_cd);
129 else if (dt_is_compatible(devp, "mpc5200-psc-uart")) 129 else if (dt_is_compatible(devp, "mpc5200-psc-uart"))
130 rc = mpc5200_psc_console_init(devp, &serial_cd); 130 rc = mpc5200_psc_console_init(devp, &serial_cd);
131 else if (dt_is_compatible(devp, "xilinx,uartlite"))
132 rc = uartlite_console_init(devp, &serial_cd);
131 133
132 /* Add other serial console driver calls here */ 134 /* Add other serial console driver calls here */
133 135
diff --git a/arch/powerpc/boot/uartlite.c b/arch/powerpc/boot/uartlite.c
new file mode 100644
index 000000000000..f4249a74c367
--- /dev/null
+++ b/arch/powerpc/boot/uartlite.c
@@ -0,0 +1,64 @@
1/*
2 * Xilinx UARTLITE bootloader driver
3 *
4 * Copyright (C) 2007 Secret Lab Technologies Ltd.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#include <stdarg.h>
12#include <stddef.h>
13#include "types.h"
14#include "string.h"
15#include "stdio.h"
16#include "io.h"
17#include "ops.h"
18
19static void * reg_base;
20
21static int uartlite_open(void)
22{
23 /* Clear the RX FIFO */
24 out_be32(reg_base + 0x0C, 0x2);
25 return 0;
26}
27
28static void uartlite_putc(unsigned char c)
29{
30 while ((in_be32(reg_base + 0x8) & 0x08) != 0); /* spin */
31 out_be32(reg_base + 0x4, c);
32}
33
34static unsigned char uartlite_getc(void)
35{
36 while ((in_be32(reg_base + 0x8) & 0x01) == 0); /* spin */
37 return in_be32(reg_base);
38}
39
40static u8 uartlite_tstc(void)
41{
42 return ((in_be32(reg_base + 0x8) & 0x01) != 0);
43}
44
45int uartlite_console_init(void *devp, struct serial_console_data *scdp)
46{
47 int n;
48 unsigned long reg_phys;
49
50 n = getprop(devp, "virtual-reg", &reg_base, sizeof(reg_base));
51 if (n != sizeof(reg_base)) {
52 if (!dt_xlate_reg(devp, 0, &reg_phys, NULL))
53 return -1;
54
55 reg_base = (void *)reg_phys;
56 }
57
58 scdp->open = uartlite_open;
59 scdp->putc = uartlite_putc;
60 scdp->getc = uartlite_getc;
61 scdp->tstc = uartlite_tstc;
62 scdp->close = NULL;
63 return 0;
64}