[BACK]Return to uartlite_tty.c CVS log [TXT][DIR] Up to [Development] / linux-2.6-xfs / arch / ppc / boot / simple

File: [Development] / linux-2.6-xfs / arch / ppc / boot / simple / Attic / uartlite_tty.c (download)

Revision 1.2, Mon Dec 3 16:26:37 2007 UTC (9 years, 10 months ago) by lachlan.longdrop.melbourne.sgi.com
Branch: MAIN
Changes since 1.1: +8 -0 lines

Merge up to 2.6.24-rc3
Merge of 2.6.x-xfs-melb:linux:30183b by kenmcd.

/*
 * 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))

unsigned long
serial_init(int chan, void *ignored)
{
	/* Clear the RX FIFO */
	out_be32(UARTLITE_BASEADDR + 0x0C, 0x2);
	return 0;
}

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);
}