+ fix a bug to think FIFO full as FIFO empty.

+ on rx buffer overflow case, disable error interrupt as wel as rx
  interrupt.

+ FIFO is always enabled.
This commit is contained in:
bsh 2003-05-13 06:26:57 +00:00
parent 8f56bda785
commit 2b33d23a8c
2 changed files with 13 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sscom.c,v 1.3 2003/05/13 06:12:45 bsh Exp $ */ /* $NetBSD: sscom.c,v 1.4 2003/05/13 06:26:57 bsh Exp $ */
/* /*
* Copyright (c) 2002 Fujitsu Component Limited * Copyright (c) 2002 Fujitsu Component Limited
@ -151,6 +151,7 @@
#include <machine/bus.h> #include <machine/bus.h>
#include <arm/s3c2xx0/s3c2xx0reg.h> #include <arm/s3c2xx0/s3c2xx0reg.h>
#include <arm/s3c2xx0/s3c2xx0var.h>
#include <arm/s3c2xx0/sscom_var.h> #include <arm/s3c2xx0/sscom_var.h>
#include <dev/cons.h> #include <dev/cons.h>
@ -387,7 +388,6 @@ sscom_read_modem_status(struct sscom_softc *sc)
return (msts & UMSTAT_CTS) | MSTS_DCD | MSTS_DSR; return (msts & UMSTAT_CTS) | MSTS_DCD | MSTS_DSR;
} }
void void
sscom_attach_subr(struct sscom_softc *sc) sscom_attach_subr(struct sscom_softc *sc)
{ {
@ -439,23 +439,12 @@ sscom_attach_subr(struct sscom_softc *sc)
sc->sc_ucon = UCON_DEBUGPORT; sc->sc_ucon = UCON_DEBUGPORT;
} }
sc->sc_fifolen = 16;
bus_space_write_1(iot, ioh, SSCOM_UFCON, bus_space_write_1(iot, ioh, SSCOM_UFCON,
UFCON_TXTRIGGER_8|UFCON_RXTRIGGER_8|UFCON_FIFO_ENABLE| UFCON_TXTRIGGER_8|UFCON_RXTRIGGER_8|UFCON_FIFO_ENABLE|
UFCON_TXFIFO_RESET|UFCON_RXFIFO_RESET); UFCON_TXFIFO_RESET|UFCON_RXFIFO_RESET);
bus_space_write_1(iot, ioh, SSCOM_UCON, sc->sc_ucon); bus_space_write_1(iot, ioh, SSCOM_UCON, sc->sc_ucon);
printf("%s: ", sc->sc_dev.dv_xname);
if (sc->sc_fifolen > 1) {
SET(sc->sc_hwflags, SSCOM_HW_FIFO);
printf("txfifo length = %d\n", sc->sc_fifolen);
}
else {
printf("txfifo disabled\n");
}
#ifdef KGDB #ifdef KGDB
if (ISSET(sc->sc_hwflags, SSCOM_HW_KGDB)) { if (ISSET(sc->sc_hwflags, SSCOM_HW_KGDB)) {
sscom_kgdb_attached = 1; sscom_kgdb_attached = 1;
@ -1457,6 +1446,10 @@ sscom_rxsoft(struct sscom_softc *sc, struct tty *tp)
if (ISSET(sc->sc_rx_flags, RX_IBUF_OVERFLOWED)) { if (ISSET(sc->sc_rx_flags, RX_IBUF_OVERFLOWED)) {
CLR(sc->sc_rx_flags, RX_IBUF_OVERFLOWED); CLR(sc->sc_rx_flags, RX_IBUF_OVERFLOWED);
sscom_enable_rxint(sc); sscom_enable_rxint(sc);
sc->sc_ucon |= UCON_ERRINT;
bus_space_write_2(sc->sc_iot, sc->sc_ioh, SSCOM_UCON,
sc->sc_ucon);
} }
if (ISSET(sc->sc_rx_flags, RX_IBUF_BLOCKED)) { if (ISSET(sc->sc_rx_flags, RX_IBUF_BLOCKED)) {
CLR(sc->sc_rx_flags, RX_IBUF_BLOCKED); CLR(sc->sc_rx_flags, RX_IBUF_BLOCKED);
@ -1576,7 +1569,7 @@ sscomintr(void *arg)
/* XXX: break interrupt with no character? */ /* XXX: break interrupt with no character? */
if ( (ufstat & UFSTAT_RXCOUNT) != 0 && if ( (ufstat & (UFSTAT_RXCOUNT|UFSTAT_RXFULL)) &&
!ISSET(sc->sc_rx_flags, RX_IBUF_OVERFLOWED)) { !ISSET(sc->sc_rx_flags, RX_IBUF_OVERFLOWED)) {
while (cc > 0) { while (cc > 0) {
int cn_trapped = 0; int cn_trapped = 0;
@ -1612,7 +1605,7 @@ sscomintr(void *arg)
} }
ufstat = bus_space_read_2(iot, ioh, SSCOM_UFSTAT); ufstat = bus_space_read_2(iot, ioh, SSCOM_UFSTAT);
if ( (ufstat & UFSTAT_RXCOUNT) == 0 ) if ( (ufstat & (UFSTAT_RXFULL|UFSTAT_RXCOUNT)) == 0 )
break; break;
} }
@ -1644,6 +1637,8 @@ sscomintr(void *arg)
if (!cc) { if (!cc) {
SET(sc->sc_rx_flags, RX_IBUF_OVERFLOWED); SET(sc->sc_rx_flags, RX_IBUF_OVERFLOWED);
sscom_disable_rxint(sc); sscom_disable_rxint(sc);
sc->sc_ucon &= ~UCON_ERRINT;
bus_space_write_2(iot, ioh, SSCOM_UCON, sc->sc_ucon);
} }
} }
@ -1743,7 +1738,7 @@ sscomintr(void *arg)
* See if data can be transmitted as well. Schedule tx * See if data can be transmitted as well. Schedule tx
* done event if no data left and tty was marked busy. * done event if no data left and tty was marked busy.
*/ */
if ( !ISSET(ufstat,UFSTAT_TXFULL)) { if (!ISSET(ufstat,UFSTAT_TXFULL)) {
/* /*
* Output the next chunk of the contiguous * Output the next chunk of the contiguous
* buffer, if any. * buffer, if any.

View File

@ -1,4 +1,4 @@
/* $NetBSD: sscom_var.h,v 1.1 2002/11/20 17:52:53 bsh Exp $ */ /* $NetBSD: sscom_var.h,v 1.2 2003/05/13 06:26:57 bsh Exp $ */
/* /*
* Copyright (c) 2002 Fujitsu Component Limited * Copyright (c) 2002 Fujitsu Component Limited
@ -32,6 +32,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
/* derived from sys/dev/ic/comvar.h */ /* derived from sys/dev/ic/comvar.h */
/* /*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
* *
@ -73,7 +74,6 @@
#include <machine/bus.h> #include <machine/bus.h>
/* Hardware flag masks */ /* Hardware flag masks */
#define SSCOM_HW_FIFO 0x01
#define SSCOM_HW_FLOW 0x02 #define SSCOM_HW_FLOW 0x02
#define SSCOM_HW_DEV_OK 0x04 #define SSCOM_HW_DEV_OK 0x04
#define SSCOM_HW_CONSOLE 0x08 #define SSCOM_HW_CONSOLE 0x08
@ -103,7 +103,6 @@ struct sscom_softc {
int sc_hwflags, int sc_hwflags,
sc_swflags; sc_swflags;
u_int sc_fifolen;
u_int sc_r_hiwat, u_int sc_r_hiwat,
sc_r_lowat; sc_r_lowat;