summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authormacallan <macallan@NetBSD.org>2014-11-22 15:14:35 +0000
committermacallan <macallan@NetBSD.org>2014-11-22 15:14:35 +0000
commitb704b68c5d3a7402ecd151d5fe80ee99038e787e (patch)
treec328c80b64fa27e000032336ada1acc6411f3800 /sys/dev
parentb393526993048a4d9d117b58c1047ed3e1179059 (diff)
deal with quirk in Ingenic UARTs
( they have a bit in the FIFO control register which turns the entire port off if not set )
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/com.c23
-rw-r--r--sys/dev/ic/comreg.h3
-rw-r--r--sys/dev/ic/comvar.h3
3 files changed, 22 insertions, 7 deletions
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c
index 9a408cce9e3..0176d63778c 100644
--- a/sys/dev/ic/com.c
+++ b/sys/dev/ic/com.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.328 2014/11/15 19:18:18 christos Exp $ */
+/* $NetBSD: com.c,v 1.329 2014/11/22 15:14:35 macallan Exp $ */
/*-
* Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.328 2014/11/15 19:18:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.329 2014/11/22 15:14:35 macallan Exp $");
#include "opt_com.h"
#include "opt_ddb.h"
@@ -403,7 +403,6 @@ com_attach_subr(struct com_softc *sc)
dict = device_properties(sc->sc_dev);
prop_dictionary_get_bool(dict, "is_console", &is_console);
-
callout_init(&sc->sc_diag_callout, 0);
mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_HIGH);
@@ -460,6 +459,12 @@ com_attach_subr(struct com_softc *sc)
fifo_msg = "OMAP UART, working fifo";
SET(sc->sc_hwflags, COM_HW_FIFO);
goto fifodelay;
+
+ case COM_TYPE_INGENIC:
+ sc->sc_fifolen = 64;
+ fifo_msg = "Ingenic UART, working fifo";
+ SET(sc->sc_hwflags, COM_HW_FIFO);
+ goto fifodelay;
}
sc->sc_fifolen = 1;
@@ -2302,8 +2307,16 @@ cominit(struct com_regs *regsp, int rate, int frequency, int type,
}
CSR_WRITE_1(regsp, COM_REG_LCR, cflag2lcr(cflag));
CSR_WRITE_1(regsp, COM_REG_MCR, MCR_DTR | MCR_RTS);
- CSR_WRITE_1(regsp, COM_REG_FIFO,
- FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1);
+
+ if (type == COM_TYPE_INGENIC) {
+ CSR_WRITE_1(regsp, COM_REG_FIFO,
+ FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST |
+ FIFO_TRIGGER_1 | FIFO_UART_ON);
+ } else {
+ CSR_WRITE_1(regsp, COM_REG_FIFO,
+ FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST |
+ FIFO_TRIGGER_1);
+ }
if (type == COM_TYPE_OMAP) {
/* setup the fifos. the FCR value is not used as long
diff --git a/sys/dev/ic/comreg.h b/sys/dev/ic/comreg.h
index dc143760245..035024760ab 100644
--- a/sys/dev/ic/comreg.h
+++ b/sys/dev/ic/comreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: comreg.h,v 1.22 2013/10/03 13:23:03 kiyohara Exp $ */
+/* $NetBSD: comreg.h,v 1.23 2014/11/22 15:14:35 macallan Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -72,6 +72,7 @@
#define FIFO_RCV_RST 0x02 /* Reset RX FIFO */
#define FIFO_XMT_RST 0x04 /* Reset TX FIFO */
#define FIFO_DMA_MODE 0x08
+#define FIFO_UART_ON 0x10 /* JZ47xx only */
#define FIFO_64B_ENABLE 0x20 /* 64byte FIFO Enable (16750) */
#define FIFO_TRIGGER_1 0x00 /* Trigger RXRDY intr on 1 character */
#define FIFO_TRIGGER_4 0x40 /* ibid 4 */
diff --git a/sys/dev/ic/comvar.h b/sys/dev/ic/comvar.h
index 161e2d4cbca..6dd50610295 100644
--- a/sys/dev/ic/comvar.h
+++ b/sys/dev/ic/comvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: comvar.h,v 1.78 2013/10/03 13:23:03 kiyohara Exp $ */
+/* $NetBSD: comvar.h,v 1.79 2014/11/22 15:14:35 macallan Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -234,6 +234,7 @@ struct com_softc {
#define COM_TYPE_AU1x00 3 /* AMD/Alchemy Au1x000 proc. built-in */
#define COM_TYPE_OMAP 4 /* TI OMAP processor built-in */
#define COM_TYPE_16550_NOERS 5 /* like a 16550, no ERS */
+#define COM_TYPE_INGENIC 6 /* JZ4780 built-in */
/* power management hooks */
int (*enable)(struct com_softc *);