[adm5120] more license cleanups
[openwrt/svn-archive/archive.git] / target / linux / adm5120 / files / include / asm-mips / mach-adm5120 / adm5120_uart.h
1 /*
2 * ADM5120 UART definitions
3 *
4 * This header file defines the hardware registers of the ADM5120 SoC
5 * built-in UARTs.
6 *
7 * Copyright (C) 2007 OpenWrt.org
8 * Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License version 2 as published
12 * by the Free Software Foundation.
13 *
14 */
15
16 #ifndef _ADM5120_UART_H_
17 #define _ADM5120_UART_H_
18
19 #define UART_BAUDDIV(clk, baud) ((clk/(16 * (baud)))-1)
20
21 #define UART_REG_DATA 0x00
22 #define UART_REG_RSR 0x04
23 #define UART_REG_ECR UART_REG_RSR
24 #define UART_REG_LCRH 0x08
25 #define UART_REG_LCRM 0x0C
26 #define UART_REG_LCRL 0x10
27 #define UART_REG_CTRL 0x14
28 #define UART_REG_FLAG 0x18
29
30 /* Receive Status Register bits */
31 #define UART_RSR_FE ( 1 << 0 )
32 #define UART_RSR_PE ( 1 << 1 )
33 #define UART_RSR_BE ( 1 << 2 )
34 #define UART_RSR_OE ( 1 << 3 )
35 #define UART_RSR_ERR ( UART_RSR_FE | UART_RSR_PE | UART_RSR_BE )
36
37 #define UART_ECR_ALL 0xFF
38
39 /* Line Control High register bits */
40 #define UART_LCRH_BRK ( 1 << 0 ) /* send break */
41 #define UART_LCRH_PEN ( 1 << 1 ) /* parity enable */
42 #define UART_LCRH_EPS ( 1 << 2 ) /* even parity select */
43 #define UART_LCRH_STP1 ( 0 << 3 ) /* one stop bits select */
44 #define UART_LCRH_STP2 ( 1 << 3 ) /* two stop bits select */
45 #define UART_LCRH_FEN ( 1 << 4 ) /* FIFO enable */
46
47 #define UART_LCRH_WLEN5 ( 0 << 5 )
48 #define UART_LCRH_WLEN6 ( 1 << 5 )
49 #define UART_LCRH_WLEN7 ( 2 << 5 )
50 #define UART_LCRH_WLEN8 ( 3 << 5 )
51
52 /* Control register bits */
53 #define UART_CTRL_EN ( 1 << 0 )
54
55 /* Flag register bits */
56 #define UART_FLAG_CTS ( 1 << 0 )
57 #define UART_FLAG_DSR ( 1 << 1 )
58 #define UART_FLAG_DCD ( 1 << 2 )
59 #define UART_FLAG_BUSY ( 1 << 3 )
60 #define UART_FLAG_RXFE ( 1 << 4 )
61 #define UART_FLAG_TXFF ( 1 << 5 )
62 #define UART_FLAG_RXFF ( 1 << 6 )
63 #define UART_FLAG_TXFE ( 1 << 7 )
64
65 #endif /* _ADM5120_UART_H_ */