1 1.8 rmind /* $NetBSD: ixp12x0_comreg.h,v 1.8 2009/10/21 14:15:50 rmind Exp $ */ 2 1.1 ichiro 3 1.1 ichiro /* 4 1.1 ichiro * Copyright (c) 2002 5 1.1 ichiro * Ichiro FUKUHARA <ichiro (at) ichiro.org>. All rights reserved. 6 1.1 ichiro * 7 1.1 ichiro * Redistribution and use in source and binary forms, with or without 8 1.1 ichiro * modification, are permitted provided that the following conditions 9 1.1 ichiro * are met: 10 1.1 ichiro * 1. Redistributions of source code must retain the above copyright 11 1.1 ichiro * notice, this list of conditions and the following disclaimer. 12 1.1 ichiro * 2. Redistributions in binary form must reproduce the above copyright 13 1.1 ichiro * notice, this list of conditions and the following disclaimer in the 14 1.1 ichiro * documentation and/or other materials provided with the distribution. 15 1.1 ichiro * 16 1.1 ichiro * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA AND CONTRIBUTORS ``AS IS'' 17 1.1 ichiro * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 1.1 ichiro * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 1.1 ichiro * ARE DISCLAIMED. IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS 20 1.1 ichiro * HEAD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 21 1.1 ichiro * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 1.1 ichiro * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 1.1 ichiro * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 1.1 ichiro * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 1.1 ichiro * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 1.1 ichiro * THE POSSIBILITY OF SUCH DAMAGE. 27 1.1 ichiro */ 28 1.1 ichiro 29 1.1 ichiro /* 30 1.1 ichiro * IXP12X0 UART register 31 1.1 ichiro * UART_SR 0x90003400 32 1.1 ichiro * UART_CR 0x90003800 33 1.1 ichiro * UART_DR 0x90003C00 34 1.1 ichiro */ 35 1.1 ichiro 36 1.7 igy #ifndef _IXP12X0_COMREG_H_ 37 1.7 igy #define _IXP12X0_COMREG_H_ 38 1.7 igy 39 1.1 ichiro #define IXPCOM_FREQ (3686400 / 16) 40 1.1 ichiro #define IXPCOMSPEED(b) (IXPCOM_FREQ / (b) - 1) 41 1.1 ichiro #define IXPCOMSPEED2BRD(b) (IXPCOMSPEED(b) << 16) 42 1.1 ichiro 43 1.6 igy /* I/O space */ 44 1.4 ichiro #define IXPCOM_UART_SIZE 0x00004000UL 45 1.6 igy #define IXPCOM_UART_OFFSET 0x00000000UL 46 1.6 igy #define IXPCOM_UART_HWBASE (IXP12X0_SYS_HWBASE + IXPCOM_UART_OFFSET) 47 1.6 igy /* IXPCOM_UART_VBASE should be used only for console's ioh. */ 48 1.6 igy #define IXPCOM_UART_VBASE (IXP12X0_SYS_VBASE + IXPCOM_UART_OFFSET) 49 1.1 ichiro 50 1.1 ichiro /* UART control register */ 51 1.1 ichiro #define IXPCOM_CR 0x00003800UL 52 1.1 ichiro #define CR_BRK 0x01 /* Break */ 53 1.1 ichiro #define CR_PE 0x02 /* Parity enable */ 54 1.1 ichiro #define CR_OES 0x04 /* Odd/even parity select */ 55 1.1 ichiro #define CR_SBS 0x08 /* Stop bit select */ 56 1.1 ichiro #define SBS_1STOP (0 << 3) /* 1 Stop Bit */ 57 1.1 ichiro #define SBS_2STOP (1 << 3) /* 2 Stop Bit */ 58 1.1 ichiro #define CR_RIE 0x10 /* Receive FIFO interrupt enable */ 59 1.1 ichiro #define CR_DSS 0x60 /* Data size select */ 60 1.1 ichiro #define DSS_5BIT (0 << 5) /* 5Bits */ 61 1.1 ichiro #define DSS_6BIT (1 << 5) /* 6Bits */ 62 1.1 ichiro #define DSS_7BIT (2 << 5) /* 7Bits */ 63 1.1 ichiro #define DSS_8BIT (3 << 5) /* 8Bits */ 64 1.1 ichiro #define CR_UE 0x80 /* UART Enable */ 65 1.1 ichiro #define UE_DISABLE (0 << 7) /* UART Disabled */ 66 1.1 ichiro #define UE_ENABLE (1 << 7) /* UART Enabled */ 67 1.1 ichiro #define CR_XIE 0x100 /* Transmit FIFO interrupt enable */ 68 1.1 ichiro #define CR_UIS 0x200 /* UART Interrupt Select */ 69 1.1 ichiro #define CR_BRD 0x03ff0000 /* Baud rate divisor */ 70 1.1 ichiro 71 1.1 ichiro 72 1.1 ichiro /* UART Status register */ 73 1.4 ichiro #define IXPCOM_SR 0x00003400UL 74 1.1 ichiro #define SR_PRE 0x01 /* Parity error */ 75 1.1 ichiro #define SR_FRE 0x02 /* Framing error */ 76 1.1 ichiro #define SR_TXR 0x04 /* Transmit FIFO Ready */ 77 1.1 ichiro #define SR_ROR 0x08 /* Receiver overrun */ 78 1.1 ichiro #define SR_RXR 0x10 /* Receiver FIFO Ready */ 79 1.2 ichiro #define SR_TXE 0x20 /* Transmit FIFO Empty */ 80 1.1 ichiro #define SR_RXF 0x40 /* Receiver FIFO Full */ 81 1.1 ichiro #define SR_TXF 0x80 /* Transmit FIFO Full */ 82 1.1 ichiro 83 1.1 ichiro 84 1.1 ichiro /* UART data register */ 85 1.4 ichiro #define IXPCOM_DR 0x00003C00UL 86 1.1 ichiro #define DR_PRE 0x100 /* Parity error */ 87 1.1 ichiro #define DR_FRE 0x200 /* Framing error */ 88 1.1 ichiro #define DR_ROR 0x400 /* Receiver overrun */ 89 1.1 ichiro 90 1.1 ichiro #define IXPCOMSPLRAISED (~(CR_RIE | CR_XIE)) 91 1.1 ichiro #define IXPCOMSPLLOWERD (~0UL); 92 1.7 igy 93 1.7 igy #endif /* _IXP12X0_COMREG_H_ */ 94