Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic deal with quirk in Ingenic UARTs



details:   https://anonhg.NetBSD.org/src/rev/c023025fd579
branches:  trunk
changeset: 804074:c023025fd579
user:      macallan <macallan%NetBSD.org@localhost>
date:      Sat Nov 22 15:14:35 2014 +0000

description:
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:

 sys/dev/ic/com.c    |  23 ++++++++++++++++++-----
 sys/dev/ic/comreg.h |   3 ++-
 sys/dev/ic/comvar.h |   3 ++-
 3 files changed, 22 insertions(+), 7 deletions(-)

diffs (92 lines):

diff -r f33e9d410099 -r c023025fd579 sys/dev/ic/com.c
--- a/sys/dev/ic/com.c  Sat Nov 22 15:09:30 2014 +0000
+++ b/sys/dev/ic/com.c  Sat Nov 22 15:14:35 2014 +0000
@@ -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 @@
 
        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 @@
                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 @@
        }
        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 -r f33e9d410099 -r c023025fd579 sys/dev/ic/comreg.h
--- a/sys/dev/ic/comreg.h       Sat Nov 22 15:09:30 2014 +0000
+++ b/sys/dev/ic/comreg.h       Sat Nov 22 15:14:35 2014 +0000
@@ -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 -r f33e9d410099 -r c023025fd579 sys/dev/ic/comvar.h
--- a/sys/dev/ic/comvar.h       Sat Nov 22 15:09:30 2014 +0000
+++ b/sys/dev/ic/comvar.h       Sat Nov 22 15:14:35 2014 +0000
@@ -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 @@
 #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 *);



Home | Main Index | Thread Index | Old Index