summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-12-28 20:50:27 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-12-28 20:50:27 +0000
commit3f4b1eb0600c478d611cbe6c62e480b4d3ce739f (patch)
treec6fc1813cffb16cc97671114cdc3b54754987c90 /sys
parent0120d5b8c1276e772173c88de8aa624dd1594628 (diff)
Support for ST16C654 chips, however these aren't detected as such, so the
attachment code has to know better for now; from Alexei G. Malinin (alexei.malinin@inetcomm.ru)
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/isa/pccom.c11
-rw-r--r--sys/arch/i386/isa/pccomvar.h3
-rw-r--r--sys/dev/ic/com_subr.c47
-rw-r--r--sys/dev/ic/comvar.h3
4 files changed, 38 insertions, 26 deletions
diff --git a/sys/arch/i386/isa/pccom.c b/sys/arch/i386/isa/pccom.c
index a37b083823b..a8b11944d59 100644
--- a/sys/arch/i386/isa/pccom.c
+++ b/sys/arch/i386/isa/pccom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pccom.c,v 1.55 2006/09/19 11:06:34 jsg Exp $ */
+/* $OpenBSD: pccom.c,v 1.56 2006/12/28 20:50:21 miod Exp $ */
/* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */
/*
@@ -541,6 +541,7 @@ comopen(dev_t dev, int flag, int mode, struct proc *p)
switch (sc->sc_uarttype) {
case COM_UART_ST16650:
case COM_UART_ST16650V2:
+ case COM_UART_ST16C654:
case COM_UART_XR16850:
case COM_UART_OX16C950:
bus_space_write_1(iot, ioh, com_lcr, LCR_EFR);
@@ -571,6 +572,12 @@ comopen(dev_t dev, int flag, int mode, struct proc *p)
else
fifo |= FIFO_RCV_TRIGGER_28|FIFO_XMT_TRIGGER_30;
break;
+ case COM_UART_ST16C654:
+ if (tp->t_ispeed <= 1200)
+ fifo |= FIFO_RCV3_TRIGGER_8|FIFO_XMT3_TRIGGER_8; /* XXX */
+ else
+ fifo |= FIFO_RCV3_TRIGGER_60|FIFO_XMT3_TRIGGER_56;
+ break;
case COM_UART_XR16850:
case COM_UART_OX16C950:
pccom_xr16850_fifo_init(iot, ioh);
@@ -748,6 +755,7 @@ compwroff(struct com_softc *sc)
switch (sc->sc_uarttype) {
case COM_UART_ST16650:
case COM_UART_ST16650V2:
+ case COM_UART_ST16C654:
case COM_UART_XR16850:
case COM_UART_OX16C950:
bus_space_write_1(iot, ioh, com_lcr, LCR_EFR);
@@ -1018,6 +1026,7 @@ comparam(struct tty *tp, struct termios *t)
else
fifo |= FIFO_RCV_TRIGGER_28|FIFO_XMT_TRIGGER_30;
break;
+ case COM_UART_ST16C654:
case COM_UART_XR16850:
case COM_UART_OX16C950:
if (t->c_ispeed <= 1200)
diff --git a/sys/arch/i386/isa/pccomvar.h b/sys/arch/i386/isa/pccomvar.h
index 64a18db08ba..1119762240c 100644
--- a/sys/arch/i386/isa/pccomvar.h
+++ b/sys/arch/i386/isa/pccomvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pccomvar.h,v 1.18 2006/07/31 11:06:20 mickey Exp $ */
+/* $OpenBSD: pccomvar.h,v 1.19 2006/12/28 20:50:21 miod Exp $ */
/* $NetBSD: comvar.h,v 1.5 1996/05/05 19:50:47 christos Exp $ */
/*
@@ -70,6 +70,7 @@ struct com_softc {
#define COM_UART_ST16650 0x05 /* no working fifo */
#define COM_UART_ST16650V2 0x06 /* 32 byte fifo */
#define COM_UART_TI16750 0x07 /* 64 byte fifo */
+#define COM_UART_ST16C654 0x08 /* 64 bytes fifo */
#define COM_UART_XR16850 0x10 /* 128 byte fifo */
#define COM_UART_OX16C950 0x12 /* 128 byte fifo */
u_char sc_uartrev;
diff --git a/sys/dev/ic/com_subr.c b/sys/dev/ic/com_subr.c
index 15e2156f560..9bd6f6aec09 100644
--- a/sys/dev/ic/com_subr.c
+++ b/sys/dev/ic/com_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com_subr.c,v 1.7 2006/07/31 11:06:30 mickey Exp $ */
+/* $OpenBSD: com_subr.c,v 1.8 2006/12/28 20:50:26 miod Exp $ */
/*
* Copyright (c) 1997 - 1999, Jason Downs. All rights reserved.
@@ -169,28 +169,24 @@ com_attach_subr(sc)
bus_space_write_1(iot, ioh, com_fifo, FIFO_ENABLE);
delay(100);
-#ifdef COM_PXA2X0
- /* Attachment driver presets COM_UART_PXA2X0. */
- if (sc->sc_uarttype != COM_UART_PXA2X0)
-#endif
-#ifdef COM_UART_OX16C950
- /* Attachment driver presets COM_UART_OX16C950. */
- if (sc->sc_uarttype != COM_UART_OX16C950)
-#endif
- switch(bus_space_read_1(iot, ioh, com_iir) >> 6) {
- case 0:
- sc->sc_uarttype = COM_UART_16450;
- break;
- case 2:
- sc->sc_uarttype = COM_UART_16550;
- break;
- case 3:
- sc->sc_uarttype = COM_UART_16550A;
- break;
- default:
- sc->sc_uarttype = COM_UART_UNKNOWN;
- break;
- }
+ /*
+ * Skip specific probes if attachment code knows it already.
+ */
+ if (sc->sc_uarttype == COM_UART_UNKNOWN)
+ switch (bus_space_read_1(iot, ioh, com_iir) >> 6) {
+ case 0:
+ sc->sc_uarttype = COM_UART_16450;
+ break;
+ case 2:
+ sc->sc_uarttype = COM_UART_16550;
+ break;
+ case 3:
+ sc->sc_uarttype = COM_UART_16550A;
+ break;
+ default:
+ sc->sc_uarttype = COM_UART_UNKNOWN;
+ break;
+ }
if (sc->sc_uarttype == COM_UART_16550A) { /* Probe for ST16650s */
bus_space_write_1(iot, ioh, com_lcr, lcr | LCR_DLAB);
@@ -300,6 +296,11 @@ com_attach_subr(sc)
printf(": st16650, %d byte fifo\n", sc->sc_fifolen);
SET(sc->sc_hwflags, COM_HW_FIFO);
break;
+ case COM_UART_ST16C654:
+ printf(": st16c654, 64 byte fifo\n");
+ SET(sc->sc_hwflags, COM_HW_FIFO);
+ sc->sc_fifolen = 64;
+ break;
case COM_UART_TI16750:
printf(": ti16750, 64 byte fifo\n");
SET(sc->sc_hwflags, COM_HW_FIFO);
diff --git a/sys/dev/ic/comvar.h b/sys/dev/ic/comvar.h
index 1a04a40c114..9d061140c0e 100644
--- a/sys/dev/ic/comvar.h
+++ b/sys/dev/ic/comvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: comvar.h,v 1.39 2006/07/31 11:06:30 mickey Exp $ */
+/* $OpenBSD: comvar.h,v 1.40 2006/12/28 20:50:26 miod Exp $ */
/* $NetBSD: comvar.h,v 1.5 1996/05/05 19:50:47 christos Exp $ */
/*
@@ -102,6 +102,7 @@ struct com_softc {
#define COM_UART_ST16650 0x05 /* no working fifo */
#define COM_UART_ST16650V2 0x06 /* 32 byte fifo */
#define COM_UART_TI16750 0x07 /* 64 byte fifo */
+#define COM_UART_ST16C654 0x08 /* 64 bytes fifo */
#define COM_UART_XR16850 0x10 /* 128 byte fifo */
#define COM_UART_PXA2X0 0x11 /* 16 byte fifo */
#define COM_UART_OX16C950 0x12 /* 128 byte fifo */