Introduce a new "type" field in the softc which is used to indicate
the general UART type. Currently, we have "normal", "hayesp" and "pxa2x0" types. Replace the corresponding hw flags with the new type values.
This commit is contained in:
parent
fee6ce1d9f
commit
5ae120da7b
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pxa2x0_com.c,v 1.1 2003/06/05 13:48:27 scw Exp $ */
|
||||
/* $NetBSD: pxa2x0_com.c,v 1.2 2003/06/14 16:25:53 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2003 Wasabi Systems, Inc.
|
||||
@ -119,7 +119,7 @@ pxauart_attach(struct device *parent, struct device *self, void *aux)
|
||||
sc->sc_iot = &pxa2x0_a4x_bs_tag; /* XXX: This sucks */
|
||||
sc->sc_iobase = pxa->pxa_addr;
|
||||
sc->sc_frequency = PXA2X0_COM_FREQ;
|
||||
sc->sc_hwflags = COM_HW_PXA2X0;
|
||||
sc->sc_type = COM_TYPE_PXA2x0;
|
||||
|
||||
if (com_is_console(sc->sc_iot, sc->sc_iobase, &sc->sc_ioh) == 0 &&
|
||||
bus_space_map(sc->sc_iot, sc->sc_iobase, pxa->pxa_size, 0,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: com.c,v 1.208 2003/06/05 13:40:38 scw Exp $ */
|
||||
/* $NetBSD: com.c,v 1.209 2003/06/14 16:25:52 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
|
||||
@ -77,7 +77,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.208 2003/06/05 13:40:38 scw Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.209 2003/06/14 16:25:52 thorpej Exp $");
|
||||
|
||||
#include "opt_com.h"
|
||||
#include "opt_ddb.h"
|
||||
@ -389,7 +389,7 @@ comprobeHAYESP(bus_space_handle_t hayespioh, struct com_softc *sc)
|
||||
* better), at the correct com port address.
|
||||
*/
|
||||
|
||||
SET(sc->sc_hwflags, COM_HW_HAYESP);
|
||||
sc->sc_type = COM_TYPE_HAYESP;
|
||||
printf(", 1024 byte fifo\n");
|
||||
return (1);
|
||||
}
|
||||
@ -405,7 +405,7 @@ com_enable_debugport(struct com_softc *sc)
|
||||
COM_LOCK(sc);
|
||||
sc->sc_ier = IER_ERXRDY;
|
||||
#ifdef COM_PXA2X0
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_PXA2X0))
|
||||
if (sc->sc_type == COM_TYPE_PXA2x0)
|
||||
sc->sc_ier |= IER_EUART | IER_ERXTOUT;
|
||||
#endif
|
||||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, com_ier, sc->sc_ier);
|
||||
@ -438,7 +438,7 @@ com_attach_subr(struct com_softc *sc)
|
||||
|
||||
/* Disable interrupts before configuring the device. */
|
||||
#ifdef COM_PXA2X0
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_PXA2X0))
|
||||
if (sc->sc_type == COM_TYPE_PXA2x0)
|
||||
sc->sc_ier = IER_EUART;
|
||||
else
|
||||
#endif
|
||||
@ -473,7 +473,7 @@ com_attach_subr(struct com_softc *sc)
|
||||
bus_space_unmap(iot, hayespioh, HAYESP_NPORTS);
|
||||
}
|
||||
/* No ESP; look for other things. */
|
||||
if (!ISSET(sc->sc_hwflags, COM_HW_HAYESP)) {
|
||||
if (sc->sc_type != COM_TYPE_HAYESP) {
|
||||
#endif
|
||||
sc->sc_fifolen = 1;
|
||||
/* look for a NS 16550AF UART with FIFOs */
|
||||
@ -621,7 +621,7 @@ com_config(struct com_softc *sc)
|
||||
|
||||
/* Disable interrupts before configuring the device. */
|
||||
#ifdef COM_PXA2X0
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_PXA2X0))
|
||||
if (sc->sc_type == COM_TYPE_PXA2x0)
|
||||
sc->sc_ier = IER_EUART;
|
||||
else
|
||||
#endif
|
||||
@ -630,7 +630,7 @@ com_config(struct com_softc *sc)
|
||||
|
||||
#ifdef COM_HAYESP
|
||||
/* Look for a Hayes ESP board. */
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_HAYESP)) {
|
||||
if (sc->sc_type == COM_TYPE_HAYESP) {
|
||||
sc->sc_fifolen = 1024;
|
||||
|
||||
/* Set 16550 compatibility mode */
|
||||
@ -781,14 +781,14 @@ com_shutdown(struct com_softc *sc)
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE)) {
|
||||
sc->sc_ier = IER_ERXRDY; /* interrupt on break */
|
||||
#ifdef COM_PXA2X0
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_PXA2X0))
|
||||
if (sc->sc_type == COM_TYPE_PXA2x0)
|
||||
sc->sc_ier |= IER_ERXTOUT;
|
||||
#endif
|
||||
} else
|
||||
sc->sc_ier = 0;
|
||||
|
||||
#ifdef COM_PXA2X0
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_PXA2X0))
|
||||
if (sc->sc_type == COM_TYPE_PXA2x0)
|
||||
sc->sc_ier |= IER_EUART;
|
||||
#endif
|
||||
|
||||
@ -866,7 +866,7 @@ comopen(dev_t dev, int flag, int mode, struct proc *p)
|
||||
/* Turn on interrupts. */
|
||||
sc->sc_ier = IER_ERXRDY | IER_ERLS | IER_EMSC;
|
||||
#ifdef COM_PXA2X0
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_PXA2X0))
|
||||
if (sc->sc_type == COM_TYPE_PXA2x0)
|
||||
sc->sc_ier |= IER_EUART | IER_ERXTOUT;
|
||||
#endif
|
||||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, com_ier, sc->sc_ier);
|
||||
@ -1329,7 +1329,7 @@ com_to_tiocm(struct com_softc *sc)
|
||||
SET(ttybits, TIOCM_RI);
|
||||
|
||||
#ifdef COM_PXA2X0
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_PXA2X0)) {
|
||||
if (sc->sc_type == COM_TYPE_PXA2x0) {
|
||||
if ((sc->sc_ier & 0x0f) != 0)
|
||||
SET(ttybits, TIOCM_LE);
|
||||
} else
|
||||
@ -1382,7 +1382,7 @@ comparam(struct tty *tp, struct termios *t)
|
||||
return (EIO);
|
||||
|
||||
#ifdef COM_HAYESP
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_HAYESP)) {
|
||||
if (sc->sc_type == COM_TYPE_HAYESP) {
|
||||
int prescaler, speed;
|
||||
|
||||
/*
|
||||
@ -1495,7 +1495,7 @@ comparam(struct tty *tp, struct termios *t)
|
||||
* overflows.
|
||||
* * Otherwise set it a bit higher.
|
||||
*/
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_HAYESP))
|
||||
if (sc->sc_type == COM_TYPE_HAYESP)
|
||||
sc->sc_fifo = FIFO_DMA_MODE | FIFO_ENABLE | FIFO_TRIGGER_8;
|
||||
else if (ISSET(sc->sc_hwflags, COM_HW_FIFO))
|
||||
sc->sc_fifo = FIFO_ENABLE |
|
||||
@ -1600,7 +1600,7 @@ com_loadchannelregs(struct com_softc *sc)
|
||||
com_iflush(sc);
|
||||
|
||||
#ifdef COM_PXA2X0
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_PXA2X0))
|
||||
if (sc->sc_type == COM_TYPE_PXA2x0)
|
||||
bus_space_write_1(iot, ioh, com_ier, IER_EUART);
|
||||
else
|
||||
#endif
|
||||
@ -1617,7 +1617,7 @@ com_loadchannelregs(struct com_softc *sc)
|
||||
bus_space_write_1(iot, ioh, com_mcr, sc->sc_mcr_active = sc->sc_mcr);
|
||||
bus_space_write_1(iot, ioh, com_fifo, sc->sc_fifo);
|
||||
#ifdef COM_HAYESP
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_HAYESP)) {
|
||||
if (sc->sc_type == COM_TYPE_HAYESP) {
|
||||
bus_space_write_1(iot, sc->sc_hayespioh, HAYESP_CMD1,
|
||||
HAYESP_SETPRESCALER);
|
||||
bus_space_write_1(iot, sc->sc_hayespioh, HAYESP_CMD2,
|
||||
@ -1889,7 +1889,7 @@ com_rxsoft(struct com_softc *sc, struct tty *tp)
|
||||
CLR(sc->sc_rx_flags, RX_IBUF_OVERFLOWED);
|
||||
SET(sc->sc_ier, IER_ERXRDY);
|
||||
#ifdef COM_PXA2X0
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_PXA2X0))
|
||||
if (sc->sc_type == COM_TYPE_PXA2x0)
|
||||
SET(sc->sc_ier, IER_ERXTOUT);
|
||||
#endif
|
||||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, com_ier, sc->sc_ier);
|
||||
@ -2123,7 +2123,7 @@ again: do {
|
||||
SET(sc->sc_rx_flags, RX_IBUF_OVERFLOWED);
|
||||
CLR(sc->sc_ier, IER_ERXRDY);
|
||||
#ifdef COM_PXA2X0
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_PXA2X0))
|
||||
if (sc->sc_type == COM_TYPE_PXA2x0)
|
||||
CLR(sc->sc_ier, IER_ERXTOUT);
|
||||
#endif
|
||||
bus_space_write_1(iot, ioh, com_ier, sc->sc_ier);
|
||||
@ -2131,7 +2131,7 @@ again: do {
|
||||
} else {
|
||||
if ((iir & IIR_IMASK) == IIR_RXRDY) {
|
||||
#ifdef COM_PXA2X0
|
||||
if (ISSET(sc->sc_hwflags, COM_HW_PXA2X0))
|
||||
if (sc->sc_type == COM_TYPE_PXA2x0)
|
||||
bus_space_write_1(iot, ioh, com_ier,
|
||||
IER_EUART);
|
||||
else
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: comvar.h,v 1.44 2003/06/05 13:40:38 scw Exp $ */
|
||||
/* $NetBSD: comvar.h,v 1.45 2003/06/14 16:25:53 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
@ -57,14 +57,13 @@ int com_is_console __P((bus_space_tag_t, bus_addr_t, bus_space_handle_t *));
|
||||
/* Hardware flag masks */
|
||||
#define COM_HW_NOIEN 0x01
|
||||
#define COM_HW_FIFO 0x02
|
||||
#define COM_HW_HAYESP 0x04
|
||||
/* 0x04 free for use */
|
||||
#define COM_HW_FLOW 0x08
|
||||
#define COM_HW_DEV_OK 0x20
|
||||
#define COM_HW_CONSOLE 0x40
|
||||
#define COM_HW_KGDB 0x80
|
||||
#define COM_HW_TXFIFO_DISABLE 0x100
|
||||
#define COM_HW_NO_TXPRELOAD 0x200
|
||||
#define COM_HW_PXA2X0 0x400
|
||||
|
||||
/* Buffer size for character buffer */
|
||||
#define COM_RING_SIZE 2048
|
||||
@ -124,6 +123,16 @@ struct com_softc {
|
||||
u_char sc_prescaler;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* There are a great many almost-ns16550-compatible UARTs out
|
||||
* there, which have minor differences. The type field here
|
||||
* lets us distinguish between them.
|
||||
*/
|
||||
int sc_type;
|
||||
#define COM_TYPE_NORMAL 0 /* normal 16x50 */
|
||||
#define COM_TYPE_HAYESP 1 /* Hayes ESP modem */
|
||||
#define COM_TYPE_PXA2x0 2 /* Intel PXA2x0 processor built-in */
|
||||
|
||||
/* power management hooks */
|
||||
int (*enable) __P((struct com_softc *));
|
||||
void (*disable) __P((struct com_softc *));
|
||||
|
Loading…
Reference in New Issue
Block a user