Home | History | Annotate | Line # | Download | only in tx
tx39uartreg.h revision 1.2
      1  1.2  uch /*	$NetBSD: tx39uartreg.h,v 1.2 2001/06/14 11:09:56 uch Exp $ */
      2  1.1  uch 
      3  1.2  uch /*-
      4  1.2  uch  * Copyright (c) 1999 The NetBSD Foundation, Inc.
      5  1.1  uch  * All rights reserved.
      6  1.1  uch  *
      7  1.2  uch  * This code is derived from software contributed to The NetBSD Foundation
      8  1.2  uch  * by UCHIYAMA Yasushi.
      9  1.2  uch  *
     10  1.1  uch  * Redistribution and use in source and binary forms, with or without
     11  1.1  uch  * modification, are permitted provided that the following conditions
     12  1.1  uch  * are met:
     13  1.1  uch  * 1. Redistributions of source code must retain the above copyright
     14  1.1  uch  *    notice, this list of conditions and the following disclaimer.
     15  1.2  uch  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.2  uch  *    notice, this list of conditions and the following disclaimer in the
     17  1.2  uch  *    documentation and/or other materials provided with the distribution.
     18  1.2  uch  * 3. All advertising materials mentioning features or use of this software
     19  1.2  uch  *    must display the following acknowledgement:
     20  1.2  uch  *        This product includes software developed by the NetBSD
     21  1.2  uch  *        Foundation, Inc. and its contributors.
     22  1.2  uch  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.2  uch  *    contributors may be used to endorse or promote products derived
     24  1.2  uch  *    from this software without specific prior written permission.
     25  1.1  uch  *
     26  1.2  uch  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.2  uch  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.2  uch  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.2  uch  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.2  uch  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.2  uch  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.2  uch  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.2  uch  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.2  uch  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.2  uch  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.2  uch  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1  uch  */
     38  1.1  uch /*
     39  1.1  uch  * Toshiba TX3912/3922 UART module
     40  1.1  uch  */
     41  1.1  uch 
     42  1.1  uch #define	TX39_UARTACTRL1_REG	0x0b0
     43  1.1  uch #define	TX39_UARTACTRL2_REG	0x0b4
     44  1.1  uch #define	TX39_UARTADMACTRL1_REG	0x0b8
     45  1.1  uch #define	TX39_UARTADMACTRL2_REG	0x0bc
     46  1.1  uch #define	TX39_UARTADMACNT_REG	0x0c0
     47  1.1  uch #define	TX39_UARTATXHOLD_REG	0x0c4
     48  1.1  uch #define	TX39_UARTARXHOLD_REG	0x0c4
     49  1.1  uch 
     50  1.1  uch #define	TX39_UARTBCTRL1_REG	0x0c8
     51  1.1  uch #define	TX39_UARTBCTRL2_REG	0x0cc
     52  1.1  uch #define	TX39_UARTBDMACTRL1_REG	0x0d0
     53  1.1  uch #define	TX39_UARTBDMACTRL2_REG	0x0d4
     54  1.1  uch #define	TX39_UARTBDMACNT_REG	0x0d8
     55  1.1  uch #define	TX39_UARTBTXHOLD_REG	0x0dc
     56  1.1  uch #define	TX39_UARTBRXHOLD_REG	0x0dc
     57  1.1  uch 
     58  1.1  uch #define TX39_UARTA_REG_START	0x0b0
     59  1.1  uch #define TX39_UARTB_REG_START	0x0c8
     60  1.2  uch #define	TX39_UARTCTRL1_REG(x)						\
     61  1.1  uch 	(((x) ? TX39_UARTB_REG_START : TX39_UARTA_REG_START))
     62  1.2  uch #define	TX39_UARTCTRL2_REG(x)						\
     63  1.1  uch 	(((x) ? TX39_UARTB_REG_START : TX39_UARTA_REG_START) + 4)
     64  1.2  uch #define	TX39_UARTDMACTRL1_REG(x)					\
     65  1.1  uch 	(((x) ? TX39_UARTB_REG_START : TX39_UARTA_REG_START) + 8)
     66  1.2  uch #define	TX39_UARTDMACTRL2_REG(x)					\
     67  1.1  uch 	(((x) ? TX39_UARTB_REG_START : TX39_UARTA_REG_START) + 12)
     68  1.2  uch #define	TX39_UARTDMACNT_REG(x)						\
     69  1.1  uch 	(((x) ? TX39_UARTB_REG_START : TX39_UARTA_REG_START) + 16)
     70  1.2  uch #define	TX39_UARTTXHOLD_REG(x)						\
     71  1.1  uch 	(((x) ? TX39_UARTB_REG_START : TX39_UARTA_REG_START) + 20)
     72  1.2  uch #define	TX39_UARTRXHOLD_REG(x)						\
     73  1.1  uch 	(((x) ? TX39_UARTB_REG_START : TX39_UARTA_REG_START) + 20)
     74  1.1  uch 
     75  1.1  uch /*
     76  1.1  uch  *	UART Control 1 Register
     77  1.1  uch  */
     78  1.1  uch /* R */
     79  1.1  uch #define	TX39_UARTCTRL1_UARTON		0x80000000
     80  1.1  uch #define	TX39_UARTCTRL1_EMPTY		0x40000000
     81  1.1  uch #define	TX39_UARTCTRL1_PRXHOLDFULL	0x20000000
     82  1.1  uch #define	TX39_UARTCTRL1_RXHOLDFULL	0x10000000
     83  1.1  uch /* R/W */
     84  1.1  uch #define	TX39_UARTCTRL1_ENDMARX		0x00008000
     85  1.1  uch #define	TX39_UARTCTRL1_ENDMATX		0x00004000
     86  1.1  uch #define	TX39_UARTCTRL1_TESTMODE		0x00002000
     87  1.1  uch #define	TX39_UARTCTRL1_ENBREAHALT	0x00001000
     88  1.1  uch #define	TX39_UARTCTRL1_ENDMATEST	0x00000800
     89  1.1  uch #define	TX39_UARTCTRL1_ENDMALOOP	0x00000400
     90  1.1  uch #define	TX39_UARTCTRL1_PULSEOPT2	0x00000200
     91  1.1  uch #define	TX39_UARTCTRL1_PULSEOPT1	0x00000100
     92  1.1  uch #define	TX39_UARTCTRL1_DTINVERT		0x00000080
     93  1.1  uch #define	TX39_UARTCTRL1_DISTXD		0x00000040
     94  1.1  uch #define	TX39_UARTCTRL1_TWOSTOP		0x00000020
     95  1.1  uch #define	TX39_UARTCTRL1_LOOPBACK		0x00000010
     96  1.1  uch #define	TX39_UARTCTRL1_BIT7		0x00000008
     97  1.1  uch #define	TX39_UARTCTRL1_EVENPARITY	0x00000004
     98  1.1  uch #define	TX39_UARTCTRL1_ENPARITY		0x00000002
     99  1.1  uch #define	TX39_UARTCTRL1_ENUART		0x00000001
    100  1.1  uch 
    101  1.1  uch /*
    102  1.1  uch  *	UART Control 2 Register
    103  1.1  uch  */
    104  1.1  uch /* W */
    105  1.1  uch /*
    106  1.1  uch  *	BaudRate = UART Clock Hz / ((BAUDRATE + 1) * 16)
    107  1.1  uch  */
    108  1.1  uch #define TX3922_UARTCLOCKHZ	9216000
    109  1.1  uch #define TX3912_UARTCLOCKHZ	3686400
    110  1.1  uch 
    111  1.1  uch #define TX39_UARTCTRL2_BAUDRATE_SHIFT	0
    112  1.1  uch 
    113  1.1  uch #define TX3912_UARTCTRL2_BAUDRATE_MASK	0x3ff
    114  1.1  uch #define TX3922_UARTCTRL2_BAUDRATE_MASK	0x7ff
    115  1.1  uch 
    116  1.1  uch #ifdef TX391X
    117  1.1  uch #define TX39_UARTCLOCKHZ		TX3912_UARTCLOCKHZ
    118  1.1  uch #define TX39_UARTCTRL2_BAUDRATE_MASK	TX3912_UARTCTRL2_BAUDRATE_MASK
    119  1.1  uch #elif defined TX392X
    120  1.1  uch #define TX39_UARTCLOCKHZ		TX3922_UARTCLOCKHZ
    121  1.1  uch #define TX39_UARTCTRL2_BAUDRATE_MASK	TX3922_UARTCTRL2_BAUDRATE_MASK
    122  1.1  uch #endif
    123  1.1  uch 
    124  1.2  uch #define TX39_UARTCTRL2_BAUDRATE_SET(cr, val)				\
    125  1.2  uch 	((cr) | (((val) << TX39_UARTCTRL2_BAUDRATE_SHIFT) &		\
    126  1.1  uch 	(TX39_UARTCTRL2_BAUDRATE_MASK << TX39_UARTCTRL2_BAUDRATE_SHIFT)))
    127  1.1  uch 
    128  1.1  uch /*
    129  1.1  uch  *	UART DMA Control 1 Register
    130  1.1  uch  */
    131  1.1  uch /* W */
    132  1.1  uch #define TX39_UARTDMACTRL1_DMASTARTVAL_MASK	0xfffffffc
    133  1.2  uch #define TX39_UARTDMACTRL1_DMASTARTVAL_SET(cr, val)			\
    134  1.1  uch 	((cr) | ((val) & TX39_UARTDMACTRL1_DMASTARTVAL_MASK))
    135  1.1  uch 
    136  1.1  uch /*
    137  1.1  uch  *	UART DMA Control 2 Register
    138  1.1  uch  */
    139  1.1  uch /* W */
    140  1.1  uch #define TX39_UARTDMACTRL2_DMALENGTH_MASK	0x0000ffff
    141  1.2  uch #define TX39_UARTDMACTRL2_DMALENGTH_SET(cr, val)			\
    142  1.1  uch 	((cr) | ((val) & TX39_UARTDMACTRL1_DMALENGTH_MASK))
    143  1.1  uch 
    144  1.1  uch /*
    145  1.1  uch  *	UART DMA Count Register
    146  1.1  uch  */
    147  1.1  uch /* R */
    148  1.1  uch #define TX39_UARTDMACNT_DMACNT_SHIFT	0
    149  1.1  uch #define TX39_UARTDMACNT_DMACNT_MASK	0xffff
    150  1.2  uch #define TX39_UARTDMACNT_DMACNT(cr)					\
    151  1.1  uch 	((cr) & TX39_UARTDMACNT_DMACNT_MASK)
    152  1.1  uch 
    153  1.1  uch /*
    154  1.1  uch  *	UART Transmit Holding Register
    155  1.1  uch  */
    156  1.1  uch /* W */
    157  1.1  uch #define	TX39_UARTTXHOLD_BREAK		0x00000100
    158  1.1  uch #define TX39_UARTTXHOLD_TXDATA_SHIFT	0
    159  1.1  uch #define TX39_UARTTXHOLD_TXDATA_MASK	0x000000ff
    160  1.2  uch #define TX39_UARTTXHOLD_TXDATA_SET(cr, val)				\
    161  1.1  uch 	((cr) | ((val) & TX39_UARTTXHOLD_TXDATA_MASK))
    162  1.1  uch 
    163  1.1  uch /*
    164  1.1  uch  *	UART Receiver Holding Register
    165  1.1  uch  */
    166  1.1  uch /* R */
    167  1.1  uch #define TX39_UARTRXHOLD_RXDATA_SHIFT	0
    168  1.1  uch #define TX39_UARTRXHOLD_RXDATA_MASK	0x000000ff
    169  1.2  uch #define	TX39_UARTRXHOLD_RXDATA(cr)					\
    170  1.1  uch 	((cr) & TX39_UARTRXHOLD_RXDATA_MASK)
    171