Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/evbarm/dev Improve support for transmit fifo suppor...



details:   https://anonhg.NetBSD.org/src/rev/3b68a3e4dae5
branches:  trunk
changeset: 780933:3b68a3e4dae5
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Sun Aug 12 10:13:17 2012 +0000

description:
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.

diffstat:

 sys/arch/evbarm/dev/plcom.c    |  26 ++++++++++++++++++--------
 sys/arch/evbarm/dev/plcomvar.h |   3 ++-
 2 files changed, 20 insertions(+), 9 deletions(-)

diffs (100 lines):

diff -r 7c52ef2f3395 -r 3b68a3e4dae5 sys/arch/evbarm/dev/plcom.c
--- a/sys/arch/evbarm/dev/plcom.c       Sun Aug 12 08:59:58 2012 +0000
+++ b/sys/arch/evbarm/dev/plcom.c       Sun Aug 12 10:13:17 2012 +0000
@@ -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 @@
 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 @@
                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 @@
                         * 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 @@
 
        /* 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 @@
                                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;
diff -r 7c52ef2f3395 -r 3b68a3e4dae5 sys/arch/evbarm/dev/plcomvar.h
--- a/sys/arch/evbarm/dev/plcomvar.h    Sun Aug 12 08:59:58 2012 +0000
+++ b/sys/arch/evbarm/dev/plcomvar.h    Sun Aug 12 10:13:17 2012 +0000
@@ -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 @@
        int sc_hwflags,
            sc_swflags;
        u_int sc_fifolen;
+       u_int sc_txintrfill;
 
        u_int sc_r_hiwat,
              sc_r_lowat;



Home | Main Index | Thread Index | Old Index