[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>
This commit is contained in:
parent
340ffd267c
commit
7ddc5f978b
4 changed files with 68 additions and 1 deletions
|
@ -46,7 +46,7 @@ src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \
|
||||||
ns16550.c serial.c simple_alloc.c div64.S util.S \
|
ns16550.c serial.c simple_alloc.c div64.S util.S \
|
||||||
gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \
|
gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \
|
||||||
4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
|
4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
|
||||||
cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c
|
cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c
|
||||||
src-plat := of.c cuboot-52xx.c cuboot-83xx.c cuboot-85xx.c holly.c \
|
src-plat := of.c cuboot-52xx.c cuboot-83xx.c cuboot-85xx.c holly.c \
|
||||||
cuboot-ebony.c treeboot-ebony.c prpmc2800.c \
|
cuboot-ebony.c treeboot-ebony.c prpmc2800.c \
|
||||||
ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \
|
ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \
|
||||||
|
|
|
@ -85,6 +85,7 @@ int ns16550_console_init(void *devp, struct serial_console_data *scdp);
|
||||||
int mpsc_console_init(void *devp, struct serial_console_data *scdp);
|
int mpsc_console_init(void *devp, struct serial_console_data *scdp);
|
||||||
int cpm_console_init(void *devp, struct serial_console_data *scdp);
|
int cpm_console_init(void *devp, struct serial_console_data *scdp);
|
||||||
int mpc5200_psc_console_init(void *devp, struct serial_console_data *scdp);
|
int mpc5200_psc_console_init(void *devp, struct serial_console_data *scdp);
|
||||||
|
int uartlite_console_init(void *devp, struct serial_console_data *scdp);
|
||||||
void *simple_alloc_init(char *base, unsigned long heap_size,
|
void *simple_alloc_init(char *base, unsigned long heap_size,
|
||||||
unsigned long granularity, unsigned long max_allocs);
|
unsigned long granularity, unsigned long max_allocs);
|
||||||
extern void flush_cache(void *, unsigned long);
|
extern void flush_cache(void *, unsigned long);
|
||||||
|
|
|
@ -128,6 +128,8 @@ int serial_console_init(void)
|
||||||
rc = cpm_console_init(devp, &serial_cd);
|
rc = cpm_console_init(devp, &serial_cd);
|
||||||
else if (dt_is_compatible(devp, "mpc5200-psc-uart"))
|
else if (dt_is_compatible(devp, "mpc5200-psc-uart"))
|
||||||
rc = mpc5200_psc_console_init(devp, &serial_cd);
|
rc = mpc5200_psc_console_init(devp, &serial_cd);
|
||||||
|
else if (dt_is_compatible(devp, "xilinx,uartlite"))
|
||||||
|
rc = uartlite_console_init(devp, &serial_cd);
|
||||||
|
|
||||||
/* Add other serial console driver calls here */
|
/* Add other serial console driver calls here */
|
||||||
|
|
||||||
|
|
64
arch/powerpc/boot/uartlite.c
Normal file
64
arch/powerpc/boot/uartlite.c
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
* Xilinx UARTLITE bootloader driver
|
||||||
|
*
|
||||||
|
* Copyright (C) 2007 Secret Lab Technologies Ltd.
|
||||||
|
*
|
||||||
|
* This file is licensed under the terms of the GNU General Public License
|
||||||
|
* version 2. This program is licensed "as is" without any warranty of any
|
||||||
|
* kind, whether express or implied.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include "types.h"
|
||||||
|
#include "string.h"
|
||||||
|
#include "stdio.h"
|
||||||
|
#include "io.h"
|
||||||
|
#include "ops.h"
|
||||||
|
|
||||||
|
static void * reg_base;
|
||||||
|
|
||||||
|
static int uartlite_open(void)
|
||||||
|
{
|
||||||
|
/* Clear the RX FIFO */
|
||||||
|
out_be32(reg_base + 0x0C, 0x2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void uartlite_putc(unsigned char c)
|
||||||
|
{
|
||||||
|
while ((in_be32(reg_base + 0x8) & 0x08) != 0); /* spin */
|
||||||
|
out_be32(reg_base + 0x4, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned char uartlite_getc(void)
|
||||||
|
{
|
||||||
|
while ((in_be32(reg_base + 0x8) & 0x01) == 0); /* spin */
|
||||||
|
return in_be32(reg_base);
|
||||||
|
}
|
||||||
|
|
||||||
|
static u8 uartlite_tstc(void)
|
||||||
|
{
|
||||||
|
return ((in_be32(reg_base + 0x8) & 0x01) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int uartlite_console_init(void *devp, struct serial_console_data *scdp)
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
unsigned long reg_phys;
|
||||||
|
|
||||||
|
n = getprop(devp, "virtual-reg", ®_base, sizeof(reg_base));
|
||||||
|
if (n != sizeof(reg_base)) {
|
||||||
|
if (!dt_xlate_reg(devp, 0, ®_phys, NULL))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
reg_base = (void *)reg_phys;
|
||||||
|
}
|
||||||
|
|
||||||
|
scdp->open = uartlite_open;
|
||||||
|
scdp->putc = uartlite_putc;
|
||||||
|
scdp->getc = uartlite_getc;
|
||||||
|
scdp->tstc = uartlite_tstc;
|
||||||
|
scdp->close = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue