]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/ppc/boot/simple/uartlite_tty.c
Merge branch 'x86/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux...
[mirror_ubuntu-artful-kernel.git] / arch / ppc / boot / simple / uartlite_tty.c
CommitLineData
8b01653a
GL
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
bedfc8a0
GL
19unsigned long
20serial_init(int chan, void *ignored)
21{
22 /* Clear the RX FIFO */
23 out_be32(UARTLITE_BASEADDR + 0x0C, 0x2);
24 return 0;
25}
26
8b01653a
GL
27void
28serial_putc(unsigned long com_port, unsigned char c)
29{
30 while ((in_be32(UARTLITE_BASEADDR + 0x8) & 0x08) != 0); /* spin */
31 out_be32(UARTLITE_BASEADDR + 0x4, c);
32}
33
34unsigned char
35serial_getc(unsigned long com_port)
36{
37 while ((in_be32(UARTLITE_BASEADDR + 0x8) & 0x01) == 0); /* spin */
38 return in_be32(UARTLITE_BASEADDR);
39}
40
41int
42serial_tstc(unsigned long com_port)
43{
44 return ((in_be32(UARTLITE_BASEADDR + 0x8) & 0x01) != 0);
45}