Add support for 16750 style UARTs. Activated by defining COM_16750.
Obtained from Marvell, Semihalf.
This commit is contained in:
parent
cb2a012804
commit
0f86c4f94a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: com.c,v 1.308 2013/02/24 06:21:36 matt Exp $ */
|
||||
/* $NetBSD: com.c,v 1.309 2013/04/20 11:52:40 rkujawa 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.308 2013/02/24 06:21:36 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.309 2013/04/20 11:52:40 rkujawa Exp $");
|
||||
|
||||
#include "opt_com.h"
|
||||
#include "opt_ddb.h"
|
||||
@ -246,8 +246,17 @@ void com_kgdb_putc(void *, int);
|
||||
#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
|
||||
@ -1466,6 +1475,20 @@ com_iflush(struct com_softc *sc)
|
||||
if (!timo)
|
||||
aprint_error_dev(sc->sc_dev, "com_iflush timeout %02x\n", reg);
|
||||
#endif
|
||||
|
||||
#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
|
||||
@ -1892,6 +1915,27 @@ comintr(void *arg)
|
||||
|
||||
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);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: comreg.h,v 1.17 2011/05/28 19:30:19 matt Exp $ */
|
||||
/* $NetBSD: comreg.h,v 1.18 2013/04/20 11:52:41 rkujawa Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
@ -62,6 +62,9 @@
|
||||
#define IIR_MLSC 0x0 /* Modem status */
|
||||
#define IIR_NOPEND 0x1 /* No pending interrupts */
|
||||
#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 */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: comvar.h,v 1.73 2012/02/02 19:43:03 tls Exp $ */
|
||||
/* $NetBSD: comvar.h,v 1.74 2013/04/20 11:52:41 rkujawa Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
@ -91,16 +91,27 @@ int com_is_console(bus_space_tag_t, bus_addr_t, bus_space_handle_t *);
|
||||
#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 { \
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ns16550reg.h,v 1.7 2005/12/11 12:21:28 christos Exp $ */
|
||||
/* $NetBSD: ns16550reg.h,v 1.8 2013/04/20 11:52:41 rkujawa 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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user