diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/boot/Makefile | 2 | ||||
-rw-r--r-- | arch/powerpc/boot/ops.h | 1 | ||||
-rw-r--r-- | arch/powerpc/boot/serial.c | 2 | ||||
-rw-r--r-- | arch/powerpc/boot/uartlite.c | 64 |
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 |
50 | src-plat := of.c cuboot-52xx.c cuboot-83xx.c cuboot-85xx.c holly.c \ | 50 | src-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); | |||
85 | int mpsc_console_init(void *devp, struct serial_console_data *scdp); | 85 | int mpsc_console_init(void *devp, struct serial_console_data *scdp); |
86 | int cpm_console_init(void *devp, struct serial_console_data *scdp); | 86 | int cpm_console_init(void *devp, struct serial_console_data *scdp); |
87 | int mpc5200_psc_console_init(void *devp, struct serial_console_data *scdp); | 87 | int mpc5200_psc_console_init(void *devp, struct serial_console_data *scdp); |
88 | int uartlite_console_init(void *devp, struct serial_console_data *scdp); | ||
88 | void *simple_alloc_init(char *base, unsigned long heap_size, | 89 | void *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); |
90 | extern void flush_cache(void *, unsigned long); | 91 | extern 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 | |||
19 | static void * reg_base; | ||
20 | |||
21 | static int uartlite_open(void) | ||
22 | { | ||
23 | /* Clear the RX FIFO */ | ||
24 | out_be32(reg_base + 0x0C, 0x2); | ||
25 | return 0; | ||
26 | } | ||
27 | |||
28 | static 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 | |||
34 | static unsigned char uartlite_getc(void) | ||
35 | { | ||
36 | while ((in_be32(reg_base + 0x8) & 0x01) == 0); /* spin */ | ||
37 | return in_be32(reg_base); | ||
38 | } | ||
39 | |||
40 | static u8 uartlite_tstc(void) | ||
41 | { | ||
42 | return ((in_be32(reg_base + 0x8) & 0x01) != 0); | ||
43 | } | ||
44 | |||
45 | int 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", ®_base, sizeof(reg_base)); | ||
51 | if (n != sizeof(reg_base)) { | ||
52 | if (!dt_xlate_reg(devp, 0, ®_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 | } | ||