Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Revirt 'Move the Marvell extension to com_mv.c' at S...
details: https://anonhg.NetBSD.org/src/rev/f31af8ec8f35
branches: trunk
changeset: 790315:f31af8ec8f35
user: kiyohara <kiyohara%NetBSD.org@localhost>
date: Thu Oct 03 13:23:03 2013 +0000
description:
Revirt 'Move the Marvell extension to com_mv.c' at Sun Sep 1 04:51:24 UTC 2013.
build test only.
diffstat:
sys/dev/ic/com.c | 65 ++++++++++++++++++++++-------
sys/dev/ic/comreg.h | 7 +-
sys/dev/ic/comvar.h | 20 ++++++++-
sys/dev/ic/ns16550reg.h | 10 ++++-
sys/dev/marvell/com_mv.c | 102 ++++++----------------------------------------
5 files changed, 94 insertions(+), 110 deletions(-)
diffs (truncated from 384 to 300 lines):
diff -r 42d08ae86808 -r f31af8ec8f35 sys/dev/ic/com.c
--- a/sys/dev/ic/com.c Thu Oct 03 13:19:24 2013 +0000
+++ b/sys/dev/ic/com.c Thu Oct 03 13:23:03 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.316 2013/09/12 12:54:39 martin Exp $ */
+/* $NetBSD: com.c,v 1.317 2013/10/03 13:23:03 kiyohara 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.316 2013/09/12 12:54:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.317 2013/10/03 13:23:03 kiyohara Exp $");
#include "opt_com.h"
#include "opt_ddb.h"
@@ -247,7 +247,17 @@
#define COM_REG_16550 { \
com_data, com_data, com_dlbl, com_dlbh, com_ier, com_iir, com_fifo, \
com_efr, com_lcr, com_mcr, com_lsr, com_msr }
+/* 16750-specific register set, additional UART status register */
+#define COM_REG_16750 { \
+ com_data, com_data, com_dlbl, com_dlbh, com_ier, com_iir, com_fifo, \
+ com_efr, com_lcr, com_mcr, com_lsr, com_msr, 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, com_usr }
+
+#ifdef COM_16750
+const bus_size_t com_std_map[32] = COM_REG_16750;
+#else
const bus_size_t com_std_map[16] = COM_REG_16550;
+#endif /* COM_16750 */
#endif /* COM_REGMAP */
#define COMUNIT_MASK 0x7ffff
@@ -405,7 +415,10 @@
(u_long)comcons_info.regs.cr_iobase);
}
- sc->sc_lcr = cflag2lcr(comcons_info.cflag);
+#ifdef COM_16750
+ /* Use in comintr(). */
+ sc->sc_lcr = cflag2lcr(comcons_info.cflag);
+#endif
/* Make sure the console is always "hardwired". */
delay(10000); /* wait for output to finish */
@@ -1511,19 +1524,19 @@
aprint_error_dev(sc->sc_dev, "com_iflush timeout %02x\n", reg);
#endif
- if (sc->sc_type == COM_TYPE_ARMADAXP) {
- uint8_t fifo;
- /*
- * Reset all Rx/Tx FIFO, preserve current FIFO length.
- * This should prevent triggering busy interrupt while
- * manipulating divisors.
- */
- fifo = CSR_READ_1(regsp, COM_REG_FIFO) & (FIFO_TRIGGER_1 |
- FIFO_TRIGGER_4 | FIFO_TRIGGER_8 | FIFO_TRIGGER_14);
- CSR_WRITE_1(regsp, COM_REG_FIFO,
- fifo | FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST);
- delay(100);
- }
+#ifdef COM_16750
+ uint8_t fifo;
+ /*
+ * Reset all Rx/Tx FIFO, preserve current FIFO length.
+ * This should prevent triggering busy interrupt while
+ * manipulating divisors.
+ */
+ fifo = CSR_READ_1(regsp, COM_REG_FIFO) & (FIFO_TRIGGER_1 |
+ FIFO_TRIGGER_4 | FIFO_TRIGGER_8 | FIFO_TRIGGER_14);
+ CSR_WRITE_1(regsp, COM_REG_FIFO, fifo | FIFO_ENABLE | FIFO_RCV_RST |
+ FIFO_XMT_RST);
+ delay(100);
+#endif
}
void
@@ -1951,6 +1964,26 @@
mutex_spin_enter(&sc->sc_lock);
iir = CSR_READ_1(regsp, COM_REG_IIR);
+ /* Handle ns16750-specific busy interrupt. */
+#ifdef COM_16750
+ int timeout;
+ if ((iir & IIR_BUSY) == IIR_BUSY) {
+ for (timeout = 10000;
+ (CSR_READ_1(regsp, COM_REG_USR) & 0x1) != 0; timeout--)
+ if (timeout <= 0) {
+ aprint_error_dev(sc->sc_dev,
+ "timeout while waiting for BUSY interrupt "
+ "acknowledge\n");
+ mutex_spin_exit(&sc->sc_lock);
+ return (0);
+ }
+
+ CSR_WRITE_1(regsp, COM_REG_LCR, sc->sc_lcr);
+ iir = CSR_READ_1(regsp, COM_REG_IIR);
+ }
+#endif /* COM_16750 */
+
+
if (ISSET(iir, IIR_NOPEND)) {
mutex_spin_exit(&sc->sc_lock);
return (0);
diff -r 42d08ae86808 -r f31af8ec8f35 sys/dev/ic/comreg.h
--- a/sys/dev/ic/comreg.h Thu Oct 03 13:19:24 2013 +0000
+++ b/sys/dev/ic/comreg.h Thu Oct 03 13:23:03 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: comreg.h,v 1.21 2013/09/03 15:32:55 jmcneill Exp $ */
+/* $NetBSD: comreg.h,v 1.22 2013/10/03 13:23:03 kiyohara Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -56,8 +56,6 @@
/* interrupt identification register */
#define IIR_IMASK 0xf
#define IIR_RXTOUT 0xc
-/* ARMADAXP's ns16550 ports have extra value in this register */
-#define IIR_BUSY 0x7 /* Busy indicator */
#define IIR_RLS 0x6 /* Line status change */
#define IIR_RXRDY 0x4 /* Receiver ready */
#define IIR_TXRDY 0x2 /* Transmitter ready */
@@ -65,6 +63,9 @@
#define IIR_NOPEND 0x1 /* No pending interrupts */
#define IIR_64B_FIFO 0x20 /* 64byte FIFO Enabled (16750) */
#define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */
+#ifdef COM_16750
+#define IIR_BUSY 0x7 /* Busy indicator */
+#endif
/* fifo control register */
#define FIFO_ENABLE 0x01 /* Turn the FIFO on */
diff -r 42d08ae86808 -r f31af8ec8f35 sys/dev/ic/comvar.h
--- a/sys/dev/ic/comvar.h Thu Oct 03 13:19:24 2013 +0000
+++ b/sys/dev/ic/comvar.h Thu Oct 03 13:23:03 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: comvar.h,v 1.77 2013/09/03 15:32:55 jmcneill Exp $ */
+/* $NetBSD: comvar.h,v 1.78 2013/10/03 13:23:03 kiyohara Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -92,16 +92,27 @@
#define COM_REG_MCR 9
#define COM_REG_LSR 10
#define COM_REG_MSR 11
+#ifdef COM_16750
+#define COM_REG_USR 31
+#endif
struct com_regs {
bus_space_tag_t cr_iot;
bus_space_handle_t cr_ioh;
bus_addr_t cr_iobase;
bus_size_t cr_nports;
+#ifdef COM_16750
+ bus_size_t cr_map[32];
+#else
bus_size_t cr_map[16];
+#endif
};
+#ifdef COM_16750
+extern const bus_size_t com_std_map[32];
+#else
extern const bus_size_t com_std_map[16];
+#endif
#define COM_INIT_REGS(regs, tag, hdl, addr) \
do { \
@@ -128,6 +139,9 @@
#define COM_REG_TCR com_msr
#define COM_REG_TLR com_scratch
#define COM_REG_MDR1 8
+#ifdef COM_16750
+#define COM_REG_USR com_usr
+#endif
struct com_regs {
bus_space_tag_t cr_iot;
@@ -220,13 +234,15 @@
#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_ARMADAXP 6 /* Marvell ARMADA XP proc. built-in */
/* power management hooks */
int (*enable)(struct com_softc *);
void (*disable)(struct com_softc *);
int enabled;
+ /* XXXX: vendor workaround functions */
+ int (*sc_vendor_workaround)(struct com_softc *);
+
struct pps_state sc_pps_state; /* pps state */
#ifdef RND_COM
diff -r 42d08ae86808 -r f31af8ec8f35 sys/dev/ic/ns16550reg.h
--- a/sys/dev/ic/ns16550reg.h Thu Oct 03 13:19:24 2013 +0000
+++ b/sys/dev/ic/ns16550reg.h Thu Oct 03 13:23:03 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ns16550reg.h,v 1.9 2013/09/01 04:51:24 kiyohara Exp $ */
+/* $NetBSD: ns16550reg.h,v 1.10 2013/10/03 13:23:03 kiyohara Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -47,3 +47,11 @@
#define com_lsr 5 /* line status register (R/W) */
#define com_msr 6 /* modem status register (R/W) */
#define com_scratch 7 /* scratch register (R/W) */
+
+/*
+ * Additional register present in NS16750
+ */
+#ifdef COM_16750
+#define com_usr 31 /* status register (R) */
+#endif
+
diff -r 42d08ae86808 -r f31af8ec8f35 sys/dev/marvell/com_mv.c
--- a/sys/dev/marvell/com_mv.c Thu Oct 03 13:19:24 2013 +0000
+++ b/sys/dev/marvell/com_mv.c Thu Oct 03 13:23:03 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com_mv.c,v 1.6 2013/09/01 04:51:24 kiyohara Exp $ */
+/* $NetBSD: com_mv.c,v 1.7 2013/10/03 13:23:03 kiyohara Exp $ */
/*
* Copyright (c) 2007, 2010 KIYOHARA Takashi
* All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com_mv.c,v 1.6 2013/09/01 04:51:24 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_mv.c,v 1.7 2013/10/03 13:23:03 kiyohara Exp $");
#include "opt_com.h"
@@ -34,7 +34,6 @@
#include <sys/bus.h>
#include <sys/device.h>
#include <sys/errno.h>
-#include <sys/mutex.h>
#include <sys/termios.h>
#include <dev/marvell/gtvar.h>
@@ -45,56 +44,34 @@
#include <prop/proplib.h>
-#define MVUART_SIZE 0x80
-
-#define MVUART_REG_USR 0x7c /* XXXX: What is this??? */
+#define MVUART_SIZE 0x20
static int mvuart_match(device_t, struct cfdata *, void *);
static void mvuart_attach(device_t, device_t, void *);
-static int mvuart_intr(void *);
-
CFATTACH_DECL_NEW(mvuart_gt, sizeof(struct com_softc),
mvuart_match, mvuart_attach, NULL, NULL);
CFATTACH_DECL_NEW(mvuart_mbus, sizeof(struct com_softc),
mvuart_match, mvuart_attach, NULL, NULL);
#ifdef COM_REGMAP
-#define MVUART_INIT_REGS(regs, tag, hdl, addr, size) \
- do { \
- int _i; \
- \
- regs.cr_iot = tag; \
- regs.cr_ioh = hdl; \
- regs.cr_iobase = addr; \
- regs.cr_nports = size; \
- for (_i = 0; _i < __arraycount(regs.cr_map); _i++) \
- regs.cr_map[_i] = com_std_map[_i] << 2; \
+#define MVUART_INIT_REGS(regs, tag, hdl, addr, size) \
+ do { \
+ int i; \
+ \
+ regs.cr_iot = tag; \
+ regs.cr_ioh = hdl; \
+ regs.cr_iobase = addr; \
+ regs.cr_nports = size; \
+ for (i = 0; i < __arraycount(regs.cr_map); i++) \
+ regs.cr_map[i] = com_std_map[i] << 2; \
} while (0)
-#define CSR_WRITE_1(r, o, v) \
- bus_space_write_1((r)->cr_iot, (r)->cr_ioh, (r)->cr_map[o], v)
-#define CSR_READ_1(r, o) \
- bus_space_read_1((r)->cr_iot, (r)->cr_ioh, (r)->cr_map[o])
#else
#define MVUART_INIT_REGS(regs, tag, hdl, addr, size) \
COM_INIT_REGS(regs, tag, hdl, addr)
-#define CSR_WRITE_1(r, o, v) \
- bus_space_write_1((r)->cr_iot, (r)->cr_ioh, o, v)
-#define CSR_READ_1(r, o) \
- bus_space_read_1((r)->cr_iot, (r)->cr_ioh, o)
Home |
Main Index |
Thread Index |
Old Index