xref: /netbsd-src/sys/arch/arm/samsung/sscom_reg.h (revision b8ecfcfef0e343ad71faea7a54fb5fcb42ad4e27)
1 /* $NetBSD: sscom_reg.h,v 1.2 2014/04/14 21:16:15 reinoud Exp $ */
2 
3 /*
4  * Copyright (c) 2002, 2003 Fujitsu Component Limited
5  * Copyright (c) 2002, 2003 Genetec Corporation
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. Neither the name of The Fujitsu Component Limited nor the name of
17  *    Genetec corporation may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY FUJITSU COMPONENT LIMITED AND GENETEC
21  * CORPORATION ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED.  IN NO EVENT SHALL FUJITSU COMPONENT LIMITED OR GENETEC
25  * CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  */
34 
35 
36 /*
37  * Register definitions for the Exynos[45] chipsets UARTs
38  */
39 #ifndef _ARM_SAMSUNG_SSCOM_REG_H_
40 #define	_ARM_SAMSUNG_SSCOM_REG_H_
41 
42 
43 #define	SSCOM_ULCON 0x00 /* UART line control */
44 #define	 ULCON_IR  		__BIT(6)
45 #define	 ULCON_PARITY		__BITS(5,3)
46 #define	 ULCON_PARITY_NONE	__SHIFTIN(0, ULCON_PARITY)
47 #define	 ULCON_PARITY_ODD	__SHIFTIN(4, ULCON_PARITY)
48 #define	 ULCON_PARITY_EVEN	__SHIFTIN(5, ULCON_PARITY)
49 #define	 ULCON_PARITY_ONE	__SHIFTIN(6, ULCON_PARITY)
50 #define	 ULCON_PARITY_ZERO	__SHIFTIN(7, ULCON_PARITY)
51 #define	 ULCON_STOP		__BIT(2)
52 #define	 ULCON_LENGTH_5		0
53 #define	 ULCON_LENGTH_6		1
54 #define	 ULCON_LENGTH_7		2
55 #define	 ULCON_LENGTH_8		3
56 #define	SSCOM_UCON		0x04	/* UART control */
57 #define  UCON_TXDMA_BRST	__BITS(22,20)
58 #define  UCON_TXDMA_BRST_1	__SHIFTIN(0, UCON_TXDMA)
59 #define  UCON_TXDMA_BRST_4	__SHIFTIN(1, UCON_TXDMA)
60 #define  UCON_TXDMA_BRST_8	__SHIFTIN(2, UCON_TXDMA)
61 #define  UCON_TXDMA_BRST_16	__SHIFTIN(3, UCON_TXDMA)
62 #define  UCON_RXDMA_BRST	__BITS(18,16)
63 #define  UCON_RXDMA_BRST_1	__SHIFTIN(0, UCON_RXDMA)
64 #define  UCON_RXDMA_BRST_4	__SHIFTIN(1, UCON_RXDMA)
65 #define  UCON_RXDMA_BRST_8	__SHIFTIN(2, UCON_RXDMA)
66 #define  UCON_RXDMA_BRST_16	__SHIFTIN(3, UCON_RXDMA)
67 #define  UCON_RXTO		__BITS(15,12)
68 #define  UCON_RXTO_FIFO_EMPTY   __BIT(11)
69 #define  UCON_RXTO_DMA_FSM_STOP __BIT(10)
70 #define	 UCON_TXINT_TYPE	__BIT(9)	/* Tx interrupt. 0=pulse,1=level */
71 #define	 UCON_TXINT_TYPE_LEVEL  UCON_TXINT_TYPE	/* 4412 mandatory */
72 #define	 UCON_TXINT_TYPE_PULSE  0
73 #define	 UCON_RXINT_TYPE	__BIT(8)	/* Rx interrupt */
74 #define	 UCON_RXINT_TYPE_LEVEL  UCON_RXINT_TYPE	/* 4412 mandatory */
75 #define	 UCON_RXINT_TYPE_PULSE  __SHIFTIN(0,UCON_RXINT_TYPE)
76 #define	 UCON_TOINT		__BIT(7)	/* Rx timeout interrupt */
77 #define	 UCON_ERRINT		__BIT(6)	/* receive error interrupt */
78 #define	 UCON_LOOP		__BIT(5)	/* loopback */
79 #define	 UCON_SBREAK		__BIT(4)	/* send break */
80 #define  UCON_TXMODE		__BITS(3,2)
81 #define	 UCON_TXMODE_DISABLE	__SHIFTIN(0, UCON_TXMODE)
82 #define	 UCON_TXMODE_INT	__SHIFTIN(1, UCON_TXMODE)
83 #define	 UCON_TXMODE_DMA	__SHIFTIN(2, UCON_TXMODE)
84 #define	 UCON_TXMODE_MASK	__SHIFTIN(3, UCON_TXMODE)
85 #define	 UCON_RXMODE		__BITS(1,0)
86 #define	 UCON_RXMODE_DISABLE	__SHIFTIN(1, UCON_RXMODE)
87 #define	 UCON_RXMODE_INT	__SHIFTIN(1, UCON_RXMODE)
88 #define	 UCON_RXMODE_DMA	__SHIFTIN(2, UCON_RXMODE)
89 #define	 UCON_RXMODE_MASK	__SHIFTIN(3, UCON_RXMODE)
90 #define	SSCOM_UFCON		0x08	/* FIFO control */
91 #define  UFCON_TXTRIGGER	__BITS(10,8)
92 #define  UFCON_RXTRIGGER	__BITS(6,4)
93 #define	 UFCON_TXFIFO_RESET	__BIT(2)
94 #define	 UFCON_RXFIFO_RESET	__BIT(1)
95 #define	 UFCON_FIFO_ENABLE	__BIT(0)
96 #define	SSCOM_UMCON		0x0c	/* MODEM control */
97 #define  UMCON_RTSTRIGGER	__BITS(7,5)
98 #define  UMCON_AFC		__BIT(4)
99 #define  UMCON_MODEMINT_ENABLE	__BIT(3)
100 #define	 UMCON_RTS		__BIT(0)	/* Request to send */
101 #define	SSCOM_UTRSTAT		0x10	/* Status register */
102 #define  UTRSTAT_RXFIFOCNT	__BITS(23,16)
103 #define  UTRSTAT_TXDMA_FSM	__BITS(15,12)
104 #define  UTRSTAT_RXDMA_FSM	__BITS(11,8)
105 #define  UTRSTAT_RXTIMEOUT	__BIT(3)
106 #define	 UTRSTAT_TXSHIFTER_EMPTY __BIT(2)
107 #define	 UTRSTAT_TXEMPTY	__BIT(1) /* TX fifo or buffer empty */
108 #define	 UTRSTAT_RXREADY	__BIT(0) /* RX fifo or buffer is not empty */
109 #define	SSCOM_UERSTAT		0x14	/* Error status register */
110 #define	 UERSTAT_BREAK		__BIT(3) /* Break signal */
111 #define	 UERSTAT_FRAME		__BIT(2) /* Frame error */
112 #define	 UERSTAT_PARITY		__BIT(1) /* Parity error */
113 #define	 UERSTAT_OVERRUN	__BIT(0) /* Overrun */
114 #define	 UERSTAT_ALL_ERRORS (UERSTAT_OVERRUN|UERSTAT_BREAK|UERSTAT_FRAME|UERSTAT_PARITY)
115 #define	SSCOM_UFSTAT		0x18	/* Fifo status register */
116 #define	 UFSTAT_TXFULL		__BIT(24) /* Tx fifo full */
117 #define	 UFSTAT_TXCOUNT	  	__BITS(23,16)	/* TX FIFO count */
118 #define  UFSTAT_RXERROR		__BIT(9)
119 #define	 UFSTAT_RXFULL		__BIT(8) /* Rx fifo full */
120 #define	 UFSTAT_RXCOUNT		__BITS(7,0)	/* RX FIFO count */
121 #define	SSCOM_UMSTAT		0x1c	/* Modem status register */
122 #define  UMSTAT_DCTS		__BIT(4)
123 #define	 UMSTAT_CTS		__BIT(0) /* Clear to send */
124 #if _BYTE_ORDER == _LITTLE_ENDIAN
125 #define	SSCOM_UTXH		0x20	/* Transmit data register */
126 #define	SSCOM_URXH		0x24	/* Receive data register */
127 #else
128 #define	SSCOM_UTXH		0x23	/* Transmit data register */
129 #define	SSCOM_URXH		0x27	/* Receive data register */
130 #endif
131 #define	SSCOM_UBRDIV		0x28	/* baud-rate divisor [15:0] */
132 #define	SSCOM_UFRACVAL		0x2C	/* baud-rate fraction [3:0] */
133 
134 /* Interrupt controller */
135 #define SSCOM_UINTP		0x30	/* interrupt source */
136 #define SSCOM_UINTSP		0x34	/* pending interrupts */
137 #define SSCOM_UINTM		0x38	/* interrupt masking */
138 #define   UINT_MODEM		__BIT(3)
139 #define   UINT_TXD		__BIT(2)
140 #define   UINT_ERROR		__BIT(1)
141 #define   UINT_RXD		__BIT(0)
142 
143 #define	SSCOM_SIZE  0x3C
144 
145 #endif /* _ARM_SAMSUNG_SSCOM_REG_H_ */
146 
147