2 * (C) Copyright 2008 Michal Simek <monstr@monstr.eu>
3 * Clean driver and add xilinx constant from header file
5 * (C) Copyright 2004 Atmark Techno, Inc.
6 * Yasushi SHOJI <yashi@atmark-techno.com>
8 * See file CREDITS for list of people who contributed to this
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30 #define RX_FIFO_OFFSET 0 /* receive FIFO, read only */
31 #define TX_FIFO_OFFSET 4 /* transmit FIFO, write only */
32 #define STATUS_REG_OFFSET 8 /* status register, read only */
34 #define SR_TX_FIFO_FULL 0x08 /* transmit FIFO full */
35 #define SR_RX_FIFO_VALID_DATA 0x01 /* data in receive FIFO */
36 #define SR_RX_FIFO_FULL 0x02 /* receive FIFO full */
38 #define UARTLITE_STATUS (CONFIG_SERIAL_BASE + STATUS_REG_OFFSET)
39 #define UARTLITE_TX_FIFO (CONFIG_SERIAL_BASE + TX_FIFO_OFFSET)
40 #define UARTLITE_RX_FIFO (CONFIG_SERIAL_BASE + RX_FIFO_OFFSET)
44 /* FIXME: Nothing for now. We should initialize fifo, etc */
48 void serial_setbrg(void)
50 /* FIXME: what's this for? */
53 void serial_putc(const char c)
57 while (in_be32((u32 *) UARTLITE_STATUS) & SR_TX_FIFO_FULL);
58 out_be32((u32 *) UARTLITE_TX_FIFO, (unsigned char) (c & 0xff));
61 void serial_puts(const char * s)
70 while (!(in_be32((u32 *) UARTLITE_STATUS) & SR_RX_FIFO_VALID_DATA));
71 return in_be32((u32 *) UARTLITE_RX_FIFO) & 0xff;
76 return (in_be32((u32 *) UARTLITE_STATUS) & SR_RX_FIFO_VALID_DATA);