[PARPORT] Patch[2.3.48]: ECPSWE fix and assorted

From: Gunther Mayer (gunther.mayer@braunschweig.netsurf.de)
Date: Sun Feb 27 2000 - 06:21:17 EST

  • Next message: Gunther Mayer: "[PARPORT] Patch[2.3.48] Super-IO detection Winbond/SMSC"

    Hi,
    this patch:
    - fixes ECPSWE mode,
    - corrects DMA recognition conforming to the Microsoft ECP ISA Specs
    p.20
    - adds missing checks for parport_wait_peripheral (just warnings)

    Now I can speak ECPSWE to my Laserjet 1100A, sadly the speed is
    the same as in compatible mode :-(20K/sec). At least it works correctly.

    Please review and submit to the Kernel if you like, Tim?

    My Super-IO patch is still work In progress, I just scattered debugging
    printk's
    over the source and promptly fixed the ECPSWE problem...

    Regards, Gunther

    diff -ur linux-2.3.48-orig/drivers/parport/ieee1284.c linux/drivers/parport/ieee1284.c
    --- linux-2.3.48-orig/drivers/parport/ieee1284.c Mon Nov 8 19:40:40 1999
    +++ linux/drivers/parport/ieee1284.c Sun Feb 27 11:41:15 2000
    @@ -165,6 +165,7 @@
     /* Terminate a negotiated mode. */
     static void parport_ieee1284_terminate (struct parport *port)
     {
    + int r;
             port = port->physport;
     
             /* EPP terminates differently. */
    @@ -199,9 +200,10 @@
                                                   | PARPORT_CONTROL_AUTOFD);
     
                             /* Event 49: PError goes high */
    - parport_wait_peripheral (port,
    + r=parport_wait_peripheral (port,
                                                      PARPORT_STATUS_PAPEROUT,
                                                      PARPORT_STATUS_PAPEROUT);
    + if (r) DPRINTK(KERN_INFO "%s Warning Timeout at Event 49\n", port->name);
     
                             parport_data_forward (port);
                             DPRINTK (KERN_DEBUG "%s: ECP direction: forward\n",
    @@ -221,7 +223,8 @@
                                           PARPORT_CONTROL_SELECT);
     
                     /* Event 24: nAck goes low */
    - parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0);
    + r=parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0);
    + if (r) DPRINTK(KERN_INFO "%s Warning Timeout at Event 24\n", port->name);
     
                     /* Event 25: Set nAutoFd low */
                     parport_frob_control (port,
    @@ -229,9 +232,10 @@
                                           PARPORT_CONTROL_AUTOFD);
     
                     /* Event 27: nAck goes high */
    - parport_wait_peripheral (port,
    + r=parport_wait_peripheral (port,
                                              PARPORT_STATUS_ACK,
                                              PARPORT_STATUS_ACK);
    + if (r) DPRINTK(KERN_INFO "%s Warning Timeout at Event 27\n", port->name);
     
                     /* Event 29: Set nAutoFd high */
                     parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0);
    @@ -259,7 +263,7 @@
             printk (KERN_ERR "parport: IEEE1284 not supported in this kernel\n");
             return -1;
     #else
    - int m = mode & ~IEEE1284_ADDR;
    + int m = mode & ~IEEE1284_ADDR,r;
             unsigned char xflag;
     
             port = port->physport;
    @@ -367,7 +371,7 @@
             /* xflag should be high for all modes other than nibble (0). */
             if (mode && !xflag) {
                     /* Mode not supported. */
    - DPRINTK (KERN_DEBUG "%s: Mode 0x%02x not supported\n",
    + DPRINTK (KERN_DEBUG "%s: Mode 0x%02x rejected by peripheral\n",
                              port->name, mode);
                     parport_ieee1284_terminate (port);
                     return 1;
    @@ -434,7 +438,7 @@
             port->ieee1284.mode = mode;
     
             /* But ECP is special */
    - if (!(mode & IEEE1284_EXT_LINK) && (mode & IEEE1284_MODE_ECP)) {
    + if (!(mode & IEEE1284_EXT_LINK) && (m & IEEE1284_MODE_ECP)) {
                     port->ieee1284.phase = IEEE1284_PH_ECP_SETUP;
     
                     /* Event 30: Set nAutoFd low */
    @@ -443,9 +447,10 @@
                                           PARPORT_CONTROL_AUTOFD);
     
                     /* Event 31: PError goes high. */
    - parport_wait_peripheral (port,
    + r=parport_wait_peripheral (port,
                                              PARPORT_STATUS_PAPEROUT,
                                              PARPORT_STATUS_PAPEROUT);
    + if (r) DPRINTK(KERN_INFO "%s Warning Timeout at Event 31\n", port->name);
                     /* (Should check that this works..) */
     
                     port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
    diff -ur linux-2.3.48-orig/drivers/parport/parport_pc.c linux/drivers/parport/parport_pc.c
    --- linux-2.3.48-orig/drivers/parport/parport_pc.c Sun Feb 27 11:19:04 2000
    +++ linux/drivers/parport/parport_pc.c Sun Feb 27 11:33:47 2000
    @@ -1503,7 +1503,7 @@
     
     /* --- DMA detection -------------------------------------- */
     
    -/* Only if supports ECP mode */
    +/* Only if chipset conforms to ECP ISA Interface Standard */
     static int __devinit programmable_dma_support (struct parport *p)
     {
             unsigned char oecr = inb (ECONTROL (p));
    @@ -1511,8 +1511,10 @@
     
             frob_econtrol (p, 0xe0, ECR_CNF << 5);
             
    - dma = inb (CONFIGB(p)) & 0x03;
    - if (!dma)
    + dma = inb (CONFIGB(p)) & 0x07;
    + if (dma==0 ) /* jumpered (or set by others means) 8-bit DMA or none */
    + dma = PARPORT_DMA_NONE;
    + if (dma==4) /* jumpered (or set by others means) 16-bit DMA or none */
                     dma = PARPORT_DMA_NONE;
     
             outb (oecr, ECONTROL (p));

    -- To unsubscribe, send mail to: linux-parport-request@torque.net --
    -- with the single word "unsubscribe" in the body of the message. --



    This archive was generated by hypermail 2b29 : Sun Feb 27 2000 - 06:26:28 EST