Wed Jun 22 08:26:05 2016 UTC ()
Pull up following revision(s) (requested by bouyer in ticket #1178):
	sys/arch/arm/allwinner/files.awin: revision 1.36
	sys/conf/files: revision 1.1159
	sys/dev/ic/com.c: revision 1.339
	sys/dev/ic/comreg.h: revision 1.25
	sys/dev/ic/comvar.h: revision 1.82
	sys/dev/ic/ns16550reg.h: revision 1.11
The UART in the allwiner SoCs is not full-compatible with the 16550, and
it's not a 16750 either. Like the 16750 it has the IIR_BUSY interrupt,
which is triggered when writing to LCR while the chip
can't accept it. But unlike the 16750, it has a specific register,
HALT, to allow writing to the LCR and divisor registers, and then
commit the changes.
Tested on an A20 SoC, changing the baud rate while keeping the
tty device open and incoming data.


(snj)
diff -r1.8.10.4 -r1.8.10.5 src/sys/arch/arm/allwinner/files.awin
diff -r1.1096.2.6 -r1.1096.2.7 src/sys/conf/files
diff -r1.327 -r1.327.2.1 src/sys/dev/ic/com.c
diff -r1.22 -r1.22.4.1 src/sys/dev/ic/comreg.h
diff -r1.78 -r1.78.4.1 src/sys/dev/ic/comvar.h
diff -r1.10 -r1.10.4.1 src/sys/dev/ic/ns16550reg.h

cvs diff -r1.8.10.4 -r1.8.10.5 src/sys/arch/arm/allwinner/Attic/files.awin (expand / switch to unified diff)

--- src/sys/arch/arm/allwinner/Attic/files.awin 2014/11/23 13:07:04 1.8.10.4
+++ src/sys/arch/arm/allwinner/Attic/files.awin 2016/06/22 08:26:05 1.8.10.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: files.awin,v 1.8.10.4 2014/11/23 13:07:04 martin Exp $ 1# $NetBSD: files.awin,v 1.8.10.5 2016/06/22 08:26:05 snj Exp $
2# 2#
3# Configuration info for Allwinner ARM Peripherals 3# Configuration info for Allwinner ARM Peripherals
4# 4#
5 5
6include "arch/arm/pic/files.pic" 6include "arch/arm/pic/files.pic"
7include "arch/arm/cortex/files.cortex" 7include "arch/arm/cortex/files.cortex"
8 8
9file arch/arm/arm32/arm32_boot.c 9file arch/arm/arm32/arm32_boot.c
10file arch/arm/arm32/arm32_kvminit.c 10file arch/arm/arm32/arm32_kvminit.c
11file arch/arm/arm32/arm32_reboot.c 11file arch/arm/arm32/arm32_reboot.c
12file arch/arm/arm32/irq_dispatch.S 12file arch/arm/arm32/irq_dispatch.S
13 13
14file arch/arm/allwinner/awin_board.c 14file arch/arm/allwinner/awin_board.c
@@ -54,27 +54,27 @@ attach awinrtc at awinio with awin_rtc @@ -54,27 +54,27 @@ attach awinrtc at awinio with awin_rtc
54file arch/arm/allwinner/awin_rtc.c awin_rtc 54file arch/arm/allwinner/awin_rtc.c awin_rtc
55 55
56# A10 Timers 56# A10 Timers
57device awintmr 57device awintmr
58attach awintmr at awinio with awin_tmr 58attach awintmr at awinio with awin_tmr
59file arch/arm/allwinner/awin_tmr.c awin_tmr 59file arch/arm/allwinner/awin_tmr.c awin_tmr
60 60
61# A20/A31 64-bit counter 61# A20/A31 64-bit counter
62device awincnt 62device awincnt
63attach awincnt at awinio with awin_cnt 63attach awincnt at awinio with awin_cnt
64file arch/arm/allwinner/awin_cnt.c awin_cnt 64file arch/arm/allwinner/awin_cnt.c awin_cnt
65 65
66# A10/A20 UART 66# A10/A20 UART
67options COM_16750 # for IIR_BUSY 67options COM_AWIN # for IIR_BUSY
68attach com at awinio with awin_com 68attach com at awinio with awin_com
69file arch/arm/allwinner/awin_com.c awin_com 69file arch/arm/allwinner/awin_com.c awin_com
70 70
71# A10/A20 GPIO 71# A10/A20 GPIO
72device awingpio : gpiobus 72device awingpio : gpiobus
73attach awingpio at awinio with awin_gpio 73attach awingpio at awinio with awin_gpio
74file arch/arm/allwinner/awin_gpio.c awin_gpio | awin_io needs-flag 74file arch/arm/allwinner/awin_gpio.c awin_gpio | awin_io needs-flag
75 75
76# A10/A20 DMA 76# A10/A20 DMA
77device awindma 77device awindma
78attach awindma at awinio with awin_dma 78attach awindma at awinio with awin_dma
79file arch/arm/allwinner/awin_dma.c awin_dma 79file arch/arm/allwinner/awin_dma.c awin_dma
80file arch/arm/allwinner/awin_dma_a10.c awin_dma & (allwinner_a10 | allwinner_a20) 80file arch/arm/allwinner/awin_dma_a10.c awin_dma & (allwinner_a10 | allwinner_a20)

cvs diff -r1.1096.2.6 -r1.1096.2.7 src/sys/conf/files (expand / switch to unified diff)

--- src/sys/conf/files 2015/05/19 04:42:31 1.1096.2.6
+++ src/sys/conf/files 2016/06/22 08:26:05 1.1096.2.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: files,v 1.1096.2.6 2015/05/19 04:42:31 snj Exp $ 1# $NetBSD: files,v 1.1096.2.7 2016/06/22 08:26:05 snj Exp $
2# @(#)files.newconf 7.5 (Berkeley) 5/10/93 2# @(#)files.newconf 7.5 (Berkeley) 5/10/93
3 3
4version 20100430 4version 20100430
5 5
6# 6#
7# device classes 7# device classes
8# 8#
9devclass disk 9devclass disk
10devclass tape 10devclass tape
11devclass ifnet 11devclass ifnet
12devclass tty 12devclass tty
13devclass audiodev 13devclass audiodev
14devclass displaydev 14devclass displaydev
@@ -854,27 +854,27 @@ file dev/ic/tms320av110.c tms320av110 @@ -854,27 +854,27 @@ file dev/ic/tms320av110.c tms320av110
854# Novell NE2000-compatible Ethernet cards, based on the 854# Novell NE2000-compatible Ethernet cards, based on the
855# National Semiconductor DS8390. 855# National Semiconductor DS8390.
856# 856#
857defflag opt_ipkdb.h IPKDB_NE : IPKDB_DP8390 857defflag opt_ipkdb.h IPKDB_NE : IPKDB_DP8390
858device ne: ether, ifnet, arp, dp8390nic, mii 858device ne: ether, ifnet, arp, dp8390nic, mii
859file dev/ic/ne2000.c ne | ipkdb_ne 859file dev/ic/ne2000.c ne | ipkdb_ne
860 860
861# 8250/16[45]50-based "com" ports 861# 8250/16[45]50-based "com" ports
862# 862#
863defflag opt_com.h COM_DEBUG 863defflag opt_com.h COM_DEBUG
864# XXX In a perfect world, this would be done with attributes 864# XXX In a perfect world, this would be done with attributes
865defflag opt_com.h COM_16650 COM_16750 865defflag opt_com.h COM_16650 COM_16750
866 COM_HAYESP COM_PXA2X0 COM_AU1X00 866 COM_HAYESP COM_PXA2X0 COM_AU1X00
867 COM_REGMAP COM_FUNCMAP 867 COM_REGMAP COM_FUNCMAP COM_AWIN
868defparam opt_com.h COM_TOLERANCE 868defparam opt_com.h COM_TOLERANCE
869device com { } : tty 869device com { } : tty
870file dev/ic/com.c com needs-flag 870file dev/ic/com.c com needs-flag
871 871
872# PC-like keyboard controller 872# PC-like keyboard controller
873# 873#
874device pckbc: pckbport 874device pckbc: pckbport
875file dev/ic/pckbc.c pckbc needs-flag 875file dev/ic/pckbc.c pckbc needs-flag
876 876
877device attimer 877device attimer
878file dev/ic/attimer.c attimer needs-flag 878file dev/ic/attimer.c attimer needs-flag
879 879
880# Cirrus Logic CD240[01] 4-port Multi-Protocol Communications Controller 880# Cirrus Logic CD240[01] 4-port Multi-Protocol Communications Controller

cvs diff -r1.327 -r1.327.2.1 src/sys/dev/ic/com.c (expand / switch to unified diff)

--- src/sys/dev/ic/com.c 2014/08/10 16:44:35 1.327
+++ src/sys/dev/ic/com.c 2016/06/22 08:26:05 1.327.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: com.c,v 1.327 2014/08/10 16:44:35 tls Exp $ */ 1/* $NetBSD: com.c,v 1.327.2.1 2016/06/22 08:26:05 snj Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum. 8 * by Charles M. Hannum.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -56,27 +56,27 @@ @@ -56,27 +56,27 @@
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE. 58 * SUCH DAMAGE.
59 * 59 *
60 * @(#)com.c 7.5 (Berkeley) 5/16/91 60 * @(#)com.c 7.5 (Berkeley) 5/16/91
61 */ 61 */
62 62
63/* 63/*
64 * COM driver, uses National Semiconductor NS16450/NS16550AF UART 64 * COM driver, uses National Semiconductor NS16450/NS16550AF UART
65 * Supports automatic hardware flow control on StarTech ST16C650A UART 65 * Supports automatic hardware flow control on StarTech ST16C650A UART
66 */ 66 */
67 67
68#include <sys/cdefs.h> 68#include <sys/cdefs.h>
69__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.327 2014/08/10 16:44:35 tls Exp $"); 69__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.327.2.1 2016/06/22 08:26:05 snj Exp $");
70 70
71#include "opt_com.h" 71#include "opt_com.h"
72#include "opt_ddb.h" 72#include "opt_ddb.h"
73#include "opt_kgdb.h" 73#include "opt_kgdb.h"
74#include "opt_lockdebug.h" 74#include "opt_lockdebug.h"
75#include "opt_multiprocessor.h" 75#include "opt_multiprocessor.h"
76#include "opt_ntp.h" 76#include "opt_ntp.h"
77 77
78#include "rnd.h" 78#include "rnd.h"
79 79
80/* The COM16650 option was renamed to COM_16650. */ 80/* The COM16650 option was renamed to COM_16650. */
81#ifdef COM16650 81#ifdef COM16650
82#error Obsolete COM16650 option; use COM_16650 instead. 82#error Obsolete COM16650 option; use COM_16650 instead.
@@ -415,27 +415,27 @@ com_attach_subr(struct com_softc *sc) @@ -415,27 +415,27 @@ com_attach_subr(struct com_softc *sc)
415 sc->sc_ier = 0; 415 sc->sc_ier = 0;
416 416
417 CSR_WRITE_1(regsp, COM_REG_IER, sc->sc_ier); 417 CSR_WRITE_1(regsp, COM_REG_IER, sc->sc_ier);
418 418
419 if (bus_space_is_equal(regsp->cr_iot, comcons_info.regs.cr_iot) && 419 if (bus_space_is_equal(regsp->cr_iot, comcons_info.regs.cr_iot) &&
420 regsp->cr_iobase == comcons_info.regs.cr_iobase) { 420 regsp->cr_iobase == comcons_info.regs.cr_iobase) {
421 comconsattached = 1; 421 comconsattached = 1;
422 422
423 if (cn_tab == NULL && comcnreattach() != 0) { 423 if (cn_tab == NULL && comcnreattach() != 0) {
424 printf("can't re-init serial console @%lx\n", 424 printf("can't re-init serial console @%lx\n",
425 (u_long)comcons_info.regs.cr_iobase); 425 (u_long)comcons_info.regs.cr_iobase);
426 } 426 }
427 427
428#ifdef COM_16750 428#if defined(COM_16750) || defined(COM_AWIN)
429 /* Use in comintr(). */ 429 /* Use in comintr(). */
430 sc->sc_lcr = cflag2lcr(comcons_info.cflag); 430 sc->sc_lcr = cflag2lcr(comcons_info.cflag);
431#endif 431#endif
432 432
433 /* Make sure the console is always "hardwired". */ 433 /* Make sure the console is always "hardwired". */
434 delay(10000); /* wait for output to finish */ 434 delay(10000); /* wait for output to finish */
435 if (is_console) { 435 if (is_console) {
436 SET(sc->sc_hwflags, COM_HW_CONSOLE); 436 SET(sc->sc_hwflags, COM_HW_CONSOLE);
437 } 437 }
438 438
439 SET(sc->sc_swflags, TIOCFLAG_SOFTCAR); 439 SET(sc->sc_swflags, TIOCFLAG_SOFTCAR);
440 } 440 }
441 441
@@ -1526,27 +1526,27 @@ com_iflush(struct com_softc *sc) @@ -1526,27 +1526,27 @@ com_iflush(struct com_softc *sc)
1526 while (ISSET(CSR_READ_1(regsp, COM_REG_LSR), LSR_RXRDY) 1526 while (ISSET(CSR_READ_1(regsp, COM_REG_LSR), LSR_RXRDY)
1527 && --timo) 1527 && --timo)
1528#ifdef DIAGNOSTIC 1528#ifdef DIAGNOSTIC
1529 reg = 1529 reg =
1530#else 1530#else
1531 (void) 1531 (void)
1532#endif 1532#endif
1533 CSR_READ_1(regsp, COM_REG_RXDATA); 1533 CSR_READ_1(regsp, COM_REG_RXDATA);
1534#ifdef DIAGNOSTIC 1534#ifdef DIAGNOSTIC
1535 if (!timo) 1535 if (!timo)
1536 aprint_error_dev(sc->sc_dev, "com_iflush timeout %02x\n", reg); 1536 aprint_error_dev(sc->sc_dev, "com_iflush timeout %02x\n", reg);
1537#endif 1537#endif
1538 1538
1539#ifdef COM_16750 1539#if defined(COM_16750) || defined(COM_AWIN)
1540 uint8_t fifo; 1540 uint8_t fifo;
1541 /* 1541 /*
1542 * Reset all Rx/Tx FIFO, preserve current FIFO length. 1542 * Reset all Rx/Tx FIFO, preserve current FIFO length.
1543 * This should prevent triggering busy interrupt while 1543 * This should prevent triggering busy interrupt while
1544 * manipulating divisors. 1544 * manipulating divisors.
1545 */ 1545 */
1546 fifo = CSR_READ_1(regsp, COM_REG_FIFO) & (FIFO_TRIGGER_1 | 1546 fifo = CSR_READ_1(regsp, COM_REG_FIFO) & (FIFO_TRIGGER_1 |
1547 FIFO_TRIGGER_4 | FIFO_TRIGGER_8 | FIFO_TRIGGER_14); 1547 FIFO_TRIGGER_4 | FIFO_TRIGGER_8 | FIFO_TRIGGER_14);
1548 CSR_WRITE_1(regsp, COM_REG_FIFO, fifo | FIFO_ENABLE | FIFO_RCV_RST | 1548 CSR_WRITE_1(regsp, COM_REG_FIFO, fifo | FIFO_ENABLE | FIFO_RCV_RST |
1549 FIFO_XMT_RST); 1549 FIFO_XMT_RST);
1550 delay(100); 1550 delay(100);
1551#endif 1551#endif
1552} 1552}
@@ -1968,43 +1968,78 @@ comintr(void *arg) @@ -1968,43 +1968,78 @@ comintr(void *arg)
1968 u_int cc; 1968 u_int cc;
1969 u_char lsr, iir; 1969 u_char lsr, iir;
1970 1970
1971 if (COM_ISALIVE(sc) == 0) 1971 if (COM_ISALIVE(sc) == 0)
1972 return (0); 1972 return (0);
1973 1973
1974 KASSERT(regsp != NULL); 1974 KASSERT(regsp != NULL);
1975 1975
1976 mutex_spin_enter(&sc->sc_lock); 1976 mutex_spin_enter(&sc->sc_lock);
1977 iir = CSR_READ_1(regsp, COM_REG_IIR); 1977 iir = CSR_READ_1(regsp, COM_REG_IIR);
1978 1978
1979 /* Handle ns16750-specific busy interrupt. */ 1979 /* Handle ns16750-specific busy interrupt. */
1980#ifdef COM_16750 1980#ifdef COM_16750
 1981#ifdef COM_AWIN
 1982#error "COM_16750 and COM_AWIN are exclusive"
 1983#endif
1981 int timeout; 1984 int timeout;
1982 if ((iir & IIR_BUSY) == IIR_BUSY) { 1985 if ((iir & IIR_BUSY) == IIR_BUSY) {
1983 for (timeout = 10000; 1986 for (timeout = 10000;
1984 (CSR_READ_1(regsp, COM_REG_USR) & 0x1) != 0; timeout--) 1987 (CSR_READ_1(regsp, COM_REG_USR) & 0x1) != 0; timeout--)
1985 if (timeout <= 0) { 1988 if (timeout <= 0) {
1986 aprint_error_dev(sc->sc_dev, 1989 aprint_error_dev(sc->sc_dev,
1987 "timeout while waiting for BUSY interrupt " 1990 "timeout while waiting for BUSY interrupt "
1988 "acknowledge\n"); 1991 "acknowledge\n");
1989 mutex_spin_exit(&sc->sc_lock); 1992 mutex_spin_exit(&sc->sc_lock);
1990 return (0); 1993 return (0);
1991 } 1994 }
1992 1995
1993 CSR_WRITE_1(regsp, COM_REG_LCR, sc->sc_lcr); 1996 CSR_WRITE_1(regsp, COM_REG_LCR, sc->sc_lcr);
1994 iir = CSR_READ_1(regsp, COM_REG_IIR); 1997 iir = CSR_READ_1(regsp, COM_REG_IIR);
1995 } 1998 }
1996#endif /* COM_16750 */ 1999#endif /* COM_16750 */
1997 2000#ifdef COM_AWIN
 2001 /* Allwinner BUSY interrupt */
 2002 if ((iir & IIR_BUSY) == IIR_BUSY) {
 2003 if ((CSR_READ_1(regsp, COM_REG_USR) & 0x1) != 0) {
 2004 CSR_WRITE_1(regsp, COM_REG_HALT, HALT_CHCFG_EN);
 2005 CSR_WRITE_1(regsp, COM_REG_LCR, sc->sc_lcr | LCR_DLAB);
 2006 CSR_WRITE_1(regsp, COM_REG_DLBL, sc->sc_dlbl);
 2007 CSR_WRITE_1(regsp, COM_REG_DLBH, sc->sc_dlbh);
 2008 CSR_WRITE_1(regsp, COM_REG_LCR, sc->sc_lcr);
 2009 CSR_WRITE_1(regsp, COM_REG_HALT,
 2010 HALT_CHCFG_EN | HALT_CHCFG_UD);
 2011 for (int timeout = 10000000;
 2012 (CSR_READ_1(regsp, COM_REG_HALT) & HALT_CHCFG_UD) != 0;
 2013 timeout--) {
 2014 if (timeout <= 0) {
 2015 aprint_error_dev(sc->sc_dev,
 2016 "timeout while waiting for HALT "
 2017 "update acknowledge 0x%x 0x%x\n",
 2018 CSR_READ_1(regsp, COM_REG_HALT),
 2019 CSR_READ_1(regsp, COM_REG_USR));
 2020 break;
 2021 }
 2022 }
 2023 CSR_WRITE_1(regsp, COM_REG_HALT, 0);
 2024 (void)CSR_READ_1(regsp, COM_REG_USR);
 2025 } else {
 2026 CSR_WRITE_1(regsp, COM_REG_LCR, sc->sc_lcr | LCR_DLAB);
 2027 CSR_WRITE_1(regsp, COM_REG_DLBL, sc->sc_dlbl);
 2028 CSR_WRITE_1(regsp, COM_REG_DLBH, sc->sc_dlbh);
 2029 CSR_WRITE_1(regsp, COM_REG_LCR, sc->sc_lcr);
 2030 }
 2031 }
 2032#endif /* COM_AWIN */
1998 2033
1999 if (ISSET(iir, IIR_NOPEND)) { 2034 if (ISSET(iir, IIR_NOPEND)) {
2000 mutex_spin_exit(&sc->sc_lock); 2035 mutex_spin_exit(&sc->sc_lock);
2001 return (0); 2036 return (0);
2002 } 2037 }
2003 2038
2004 end = sc->sc_ebuf; 2039 end = sc->sc_ebuf;
2005 put = sc->sc_rbput; 2040 put = sc->sc_rbput;
2006 cc = sc->sc_rbavail; 2041 cc = sc->sc_rbavail;
2007 2042
2008again: do { 2043again: do {
2009 u_char msr, delta; 2044 u_char msr, delta;
2010 2045

cvs diff -r1.22 -r1.22.4.1 src/sys/dev/ic/comreg.h (expand / switch to unified diff)

--- src/sys/dev/ic/comreg.h 2013/10/03 13:23:03 1.22
+++ src/sys/dev/ic/comreg.h 2016/06/22 08:26:05 1.22.4.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: comreg.h,v 1.22 2013/10/03 13:23:03 kiyohara Exp $ */ 1/* $NetBSD: comreg.h,v 1.22.4.1 2016/06/22 08:26:05 snj Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1991 The Regents of the University of California. 4 * Copyright (c) 1991 The Regents of the University of California.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -53,27 +53,27 @@ @@ -53,27 +53,27 @@
53#define IER_ERXTOUT 0x10 /* Enable rx timeout interrupt */ 53#define IER_ERXTOUT 0x10 /* Enable rx timeout interrupt */
54#define IER_EUART 0x40 /* Enable UART */ 54#define IER_EUART 0x40 /* Enable UART */
55 55
56/* interrupt identification register */ 56/* interrupt identification register */
57#define IIR_IMASK 0xf 57#define IIR_IMASK 0xf
58#define IIR_RXTOUT 0xc 58#define IIR_RXTOUT 0xc
59#define IIR_RLS 0x6 /* Line status change */ 59#define IIR_RLS 0x6 /* Line status change */
60#define IIR_RXRDY 0x4 /* Receiver ready */ 60#define IIR_RXRDY 0x4 /* Receiver ready */
61#define IIR_TXRDY 0x2 /* Transmitter ready */ 61#define IIR_TXRDY 0x2 /* Transmitter ready */
62#define IIR_MLSC 0x0 /* Modem status */ 62#define IIR_MLSC 0x0 /* Modem status */
63#define IIR_NOPEND 0x1 /* No pending interrupts */ 63#define IIR_NOPEND 0x1 /* No pending interrupts */
64#define IIR_64B_FIFO 0x20 /* 64byte FIFO Enabled (16750) */ 64#define IIR_64B_FIFO 0x20 /* 64byte FIFO Enabled (16750) */
65#define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */ 65#define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */
66#ifdef COM_16750 66#if defined(COM_16750) || defined(COM_AWIN)
67#define IIR_BUSY 0x7 /* Busy indicator */ 67#define IIR_BUSY 0x7 /* Busy indicator */
68#endif 68#endif
69 69
70/* fifo control register */ 70/* fifo control register */
71#define FIFO_ENABLE 0x01 /* Turn the FIFO on */ 71#define FIFO_ENABLE 0x01 /* Turn the FIFO on */
72#define FIFO_RCV_RST 0x02 /* Reset RX FIFO */ 72#define FIFO_RCV_RST 0x02 /* Reset RX FIFO */
73#define FIFO_XMT_RST 0x04 /* Reset TX FIFO */ 73#define FIFO_XMT_RST 0x04 /* Reset TX FIFO */
74#define FIFO_DMA_MODE 0x08 74#define FIFO_DMA_MODE 0x08
75#define FIFO_64B_ENABLE 0x20 /* 64byte FIFO Enable (16750) */ 75#define FIFO_64B_ENABLE 0x20 /* 64byte FIFO Enable (16750) */
76#define FIFO_TRIGGER_1 0x00 /* Trigger RXRDY intr on 1 character */ 76#define FIFO_TRIGGER_1 0x00 /* Trigger RXRDY intr on 1 character */
77#define FIFO_TRIGGER_4 0x40 /* ibid 4 */ 77#define FIFO_TRIGGER_4 0x40 /* ibid 4 */
78#define FIFO_TRIGGER_8 0x80 /* ibid 8 */ 78#define FIFO_TRIGGER_8 0x80 /* ibid 8 */
79#define FIFO_TRIGGER_14 0xc0 /* ibid 14 */ 79#define FIFO_TRIGGER_14 0xc0 /* ibid 14 */
@@ -146,16 +146,22 @@ @@ -146,16 +146,22 @@
146#define MDR1_SIP_MODE 0x40 146#define MDR1_SIP_MODE 0x40
147#define MDR1_SCT 0x20 147#define MDR1_SCT 0x20
148#define MDR1_SET_TXIR 0x10 148#define MDR1_SET_TXIR 0x10
149#define MDR1_IR_SLEEP 0x08 149#define MDR1_IR_SLEEP 0x08
150#define MDR1_MODE_DISABLE 0x07 150#define MDR1_MODE_DISABLE 0x07
151#define MDR1_MODE_FIR 0x05 151#define MDR1_MODE_FIR 0x05
152#define MDR1_MODE_MIR 0x04 152#define MDR1_MODE_MIR 0x04
153#define MDR1_MODE_UART_13X 0x03 153#define MDR1_MODE_UART_13X 0x03
154#define MDR1_MODE_UART_16X_AUTOBAUD 0x02 154#define MDR1_MODE_UART_16X_AUTOBAUD 0x02
155#define MDR1_MODE_SIR 0x01 155#define MDR1_MODE_SIR 0x01
156#define MDR1_MODE_UART_16X 0x00 156#define MDR1_MODE_UART_16X 0x00
157#define MDR1_MODE_MASK 0x07 157#define MDR1_MODE_MASK 0x07
158 158
 159#ifdef COM_AWIN
 160/* AWIN-specific registers */
 161#define HALT_CHCFG_UD 0x04 /* apply updates to LCR/dividors */
 162#define HALT_CHCFG_EN 0x02 /* enable change while busy */
 163#endif
 164
159 165
160/* XXX ISA-specific. */ 166/* XXX ISA-specific. */
161#define COM_NPORTS 8 167#define COM_NPORTS 8

cvs diff -r1.78 -r1.78.4.1 src/sys/dev/ic/comvar.h (expand / switch to unified diff)

--- src/sys/dev/ic/comvar.h 2013/10/03 13:23:03 1.78
+++ src/sys/dev/ic/comvar.h 2016/06/22 08:26:05 1.78.4.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: comvar.h,v 1.78 2013/10/03 13:23:03 kiyohara Exp $ */ 1/* $NetBSD: comvar.h,v 1.78.4.1 2016/06/22 08:26:05 snj Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. 4 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software 14 * 3. All advertising materials mentioning features or use of this software
@@ -85,26 +85,32 @@ int com_is_console(bus_space_tag_t, bus_ @@ -85,26 +85,32 @@ int com_is_console(bus_space_tag_t, bus_
85#define COM_REG_IIR 5 85#define COM_REG_IIR 5
86#define COM_REG_FIFO 6 86#define COM_REG_FIFO 6
87#define COM_REG_TCR 6 87#define COM_REG_TCR 6
88#define COM_REG_EFR 7 88#define COM_REG_EFR 7
89#define COM_REG_TLR 7 89#define COM_REG_TLR 7
90#define COM_REG_LCR 8 90#define COM_REG_LCR 8
91#define COM_REG_MDR1 8 91#define COM_REG_MDR1 8
92#define COM_REG_MCR 9 92#define COM_REG_MCR 9
93#define COM_REG_LSR 10 93#define COM_REG_LSR 10
94#define COM_REG_MSR 11 94#define COM_REG_MSR 11
95#ifdef COM_16750 95#ifdef COM_16750
96#define COM_REG_USR 31 96#define COM_REG_USR 31
97#endif 97#endif
 98#ifdef COM_AWIN
 99#define COM_REG_USR 31
 100#define COM_REG_TFL 32
 101#define COM_REG_RFL 33
 102#define COM_REG_HALT 41
 103#endif
98 104
99struct com_regs { 105struct com_regs {
100 bus_space_tag_t cr_iot; 106 bus_space_tag_t cr_iot;
101 bus_space_handle_t cr_ioh; 107 bus_space_handle_t cr_ioh;
102 bus_addr_t cr_iobase; 108 bus_addr_t cr_iobase;
103 bus_size_t cr_nports; 109 bus_size_t cr_nports;
104#ifdef COM_16750 110#ifdef COM_16750
105 bus_size_t cr_map[32]; 111 bus_size_t cr_map[32];
106#else 112#else
107 bus_size_t cr_map[16]; 113 bus_size_t cr_map[16];
108#endif 114#endif
109}; 115};
110 116
@@ -132,26 +138,32 @@ extern const bus_size_t com_std_map[16]; @@ -132,26 +138,32 @@ extern const bus_size_t com_std_map[16];
132#define COM_REG_IIR com_iir 138#define COM_REG_IIR com_iir
133#define COM_REG_FIFO com_fifo 139#define COM_REG_FIFO com_fifo
134#define COM_REG_EFR com_efr 140#define COM_REG_EFR com_efr
135#define COM_REG_LCR com_lctl 141#define COM_REG_LCR com_lctl
136#define COM_REG_MCR com_mcr 142#define COM_REG_MCR com_mcr
137#define COM_REG_LSR com_lsr 143#define COM_REG_LSR com_lsr
138#define COM_REG_MSR com_msr 144#define COM_REG_MSR com_msr
139#define COM_REG_TCR com_msr 145#define COM_REG_TCR com_msr
140#define COM_REG_TLR com_scratch 146#define COM_REG_TLR com_scratch
141#define COM_REG_MDR1 8 147#define COM_REG_MDR1 8
142#ifdef COM_16750 148#ifdef COM_16750
143#define COM_REG_USR com_usr 149#define COM_REG_USR com_usr
144#endif 150#endif
 151#ifdef COM_AWIN
 152#define COM_REG_USR com_usr
 153#define COM_REG_TFL com_tfl
 154#define COM_REG_RFL com_rfl
 155#define COM_REG_HALT com_halt
 156#endif
145 157
146struct com_regs { 158struct com_regs {
147 bus_space_tag_t cr_iot; 159 bus_space_tag_t cr_iot;
148 bus_space_handle_t cr_ioh; 160 bus_space_handle_t cr_ioh;
149 bus_addr_t cr_iobase; 161 bus_addr_t cr_iobase;
150 bus_size_t cr_nports; 162 bus_size_t cr_nports;
151}; 163};
152 164
153#define COM_INIT_REGS(regs, tag, hdl, addr) \ 165#define COM_INIT_REGS(regs, tag, hdl, addr) \
154 do { \ 166 do { \
155 regs.cr_iot = tag; \ 167 regs.cr_iot = tag; \
156 regs.cr_ioh = hdl; \ 168 regs.cr_ioh = hdl; \
157 regs.cr_iobase = addr; \ 169 regs.cr_iobase = addr; \

cvs diff -r1.10 -r1.10.4.1 src/sys/dev/ic/ns16550reg.h (expand / switch to unified diff)

--- src/sys/dev/ic/ns16550reg.h 2013/10/03 13:23:03 1.10
+++ src/sys/dev/ic/ns16550reg.h 2016/06/22 08:26:05 1.10.4.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ns16550reg.h,v 1.10 2013/10/03 13:23:03 kiyohara Exp $ */ 1/* $NetBSD: ns16550reg.h,v 1.10.4.1 2016/06/22 08:26:05 snj Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1991 The Regents of the University of California. 4 * Copyright (c) 1991 The Regents of the University of California.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -44,14 +44,19 @@ @@ -44,14 +44,19 @@
44#define com_lctl 3 /* line control register (R/W) */ 44#define com_lctl 3 /* line control register (R/W) */
45#define com_cfcr 3 /* line control register (R/W) */ 45#define com_cfcr 3 /* line control register (R/W) */
46#define com_mcr 4 /* modem control register (R/W) */ 46#define com_mcr 4 /* modem control register (R/W) */
47#define com_lsr 5 /* line status register (R/W) */ 47#define com_lsr 5 /* line status register (R/W) */
48#define com_msr 6 /* modem status register (R/W) */ 48#define com_msr 6 /* modem status register (R/W) */
49#define com_scratch 7 /* scratch register (R/W) */ 49#define com_scratch 7 /* scratch register (R/W) */
50 50
51/* 51/*
52 * Additional register present in NS16750  52 * Additional register present in NS16750
53 */ 53 */
54#ifdef COM_16750 54#ifdef COM_16750
55#define com_usr 31 /* status register (R) */ 55#define com_usr 31 /* status register (R) */
56#endif 56#endif
57 57#ifdef COM_AWIN
 58#define com_usr 31 /* status register (R) */
 59#define com_tfl 32 /* transmit fifo level (R) */
 60#define com_rfl 33 /* receive fifo level (R) */
 61#define com_halt 41 /* halt tx (R/W) */
 62#endif