Module Name: src
Committed By: reinoud
Date: Sun Aug 12 10:13:17 UTC 2012
Modified Files:
src/sys/arch/evbarm/dev: plcom.c plcomvar.h
Log Message:
Improve support for transmit fifo support for plcom.
As Nick, Michiel and I concluded this driver needs a big overhaul since its
logic is modelled on the standard com.c driver which doesn't have the plcom's
treshold interrupt at al.
On Nicks request, the HW FIFO support hasn't been enabled by default on the
RPi though.
Tested with the RPi.
To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/evbarm/dev/plcom.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbarm/dev/plcomvar.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/evbarm/dev/plcom.c
diff -u src/sys/arch/evbarm/dev/plcom.c:1.40 src/sys/arch/evbarm/dev/plcom.c:1.41
--- src/sys/arch/evbarm/dev/plcom.c:1.40 Wed Jul 25 07:26:17 2012
+++ src/sys/arch/evbarm/dev/plcom.c Sun Aug 12 10:13:17 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: plcom.c,v 1.40 2012/07/25 07:26:17 skrll Exp $ */
+/* $NetBSD: plcom.c,v 1.41 2012/08/12 10:13:17 reinoud Exp $ */
/*-
* Copyright (c) 2001 ARM Ltd
@@ -94,7 +94,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.40 2012/07/25 07:26:17 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.41 2012/08/12 10:13:17 reinoud Exp $");
#include "opt_plcom.h"
#include "opt_ddb.h"
@@ -428,8 +428,10 @@ plcom_enable_debugport(struct plcom_soft
void
plcom_attach_subr(struct plcom_softc *sc)
{
+ static const uint8_t txintr_fill[] = {14, 12, 8, 4, 2};
struct plcom_instance *pi = &sc->sc_pi;
struct tty *tp;
+ int tx_tresh;
aprint_naive("\n");
@@ -478,6 +480,7 @@ plcom_attach_subr(struct plcom_softc *sc
break;
}
+ tx_tresh = PREAD4(pi, PL011COM_IFLS) & 7;
if (sc->sc_fifolen == 0) {
switch (pi->pi_type) {
case PLCOM_TYPE_PL010:
@@ -485,11 +488,13 @@ plcom_attach_subr(struct plcom_softc *sc
* The PL010 has a 16-byte fifo, but the tx interrupt
* triggers when there is space for 8 more bytes.
*/
- sc->sc_fifolen = 8;
+ sc->sc_fifolen = 8; /* XXX can be bumped to 16 */
+ sc->sc_txintrfill = 8;
break;
case PLCOM_TYPE_PL011:
/* Some revisions have a 32 byte TX FIFO */
sc->sc_fifolen = 16;
+ sc->sc_txintrfill = txintr_fill[tx_tresh];
break;
}
}
@@ -1679,11 +1684,16 @@ plcomstart(struct tty *tp)
/* Output the first chunk of the contiguous buffer. */
{
- int n;
+ int n, maxn;
+
+ maxn = sc->sc_fifolen;
+ if (!ISSET(PREAD1(pi, PL01XCOM_FR), PL01X_FR_TXFE))
+ maxn = sc->sc_txintrfill;
n = sc->sc_tbc;
- if (n > sc->sc_fifolen)
- n = sc->sc_fifolen;
+ if (n > maxn)
+ n = maxn;
+
PWRITEM1(pi, PL01XCOM_DR, sc->sc_tba, n);
sc->sc_tbc -= n;
sc->sc_tba += n;
@@ -2201,8 +2211,8 @@ plcomintr(void *arg)
int n;
n = sc->sc_tbc;
- if (n > sc->sc_fifolen)
- n = sc->sc_fifolen;
+ if (n > sc->sc_txintrfill)
+ n = sc->sc_txintrfill;
PWRITEM1(pi, PL01XCOM_DR, sc->sc_tba, n);
sc->sc_tbc -= n;
sc->sc_tba += n;
Index: src/sys/arch/evbarm/dev/plcomvar.h
diff -u src/sys/arch/evbarm/dev/plcomvar.h:1.11 src/sys/arch/evbarm/dev/plcomvar.h:1.12
--- src/sys/arch/evbarm/dev/plcomvar.h:1.11 Wed Jul 25 07:26:18 2012
+++ src/sys/arch/evbarm/dev/plcomvar.h Sun Aug 12 10:13:17 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: plcomvar.h,v 1.11 2012/07/25 07:26:18 skrll Exp $ */
+/* $NetBSD: plcomvar.h,v 1.12 2012/08/12 10:13:17 reinoud Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -113,6 +113,7 @@ struct plcom_softc {
int sc_hwflags,
sc_swflags;
u_int sc_fifolen;
+ u_int sc_txintrfill;
u_int sc_r_hiwat,
sc_r_lowat;