[PATCH] Fix broken superio DMA support in parport_pc.c

From: Duncan Haldane
Date: Sat Oct 11 2003 - 17:11:49 EST


Hi

There is a bogus test for ECP mode in the Via 686 superio support
in drivers/parport/parport_pc.c:sio_via_686a_probe(..)


The incorrect test used is that superio register F0_5 == 0x1
(this means "ECP+EPP" parport control mode is enabled; by default, it's not)

The correct test should be register E2_0-1 == 0x01
(This means Parport mode is ECP (BIOS setting))

see the VT82C686A data sheet, page 45 and 46
( available at http://www.via.com.tw/pdf/productinfo/686a.pdf )


Patches against 2.4.23-pre7 and 2.6.0-test7 are attached.
Who can help me push these into the kernels?

These patches are fully tested. Without it DMA was never enabled by
the superio probe. With it, it finally is.

Duncan Haldane
duncan _haldane at users dot sourceforge dot net
----------------------------------------------

diff -uNr linux-2.6.0-test7/drivers/parport/parport_pc.c
linux-2.6.0-test7-superio_fix/drivers/parport/parport_pc.c
--- linux-2.6.0-test7/drivers/parport/parport_pc.c Fri Sep 12 03:05:52 2003
+++ linux-2.6.0-test7-superio_fix/drivers/parport/parport_pc.c Sat Oct 11
16:35:46 2003
@@ -2564,7 +2564,7 @@
{
u8 tmp;
int dma, irq;
- unsigned port1, port2, have_eppecp;
+ unsigned port1, port2, mode;

/*
* unlock super i/o configuration, set 0x85_1
@@ -2579,9 +2579,9 @@

/* 0xE2_1-0: Parallel Port Mode / Enable */
outb (0xE2, 0x3F0);
- tmp = inb (0x3F1);
+ mode = inb (0x3F1) & 0x03;

- if ((tmp & 0x03) == 0x03) {
+ if (mode == 0x03) {
printk (KERN_INFO "parport_pc: Via 686A parallel port disabled
in BIOS\n");
return 0;
}
@@ -2600,10 +2600,6 @@
return 0;
}

- /* 0xF0_5: EPP+ECP enable */
- outb (0xF0, 0x3F0);
- have_eppecp = (inb (0x3F1) & (1 << 5));
-
/*
* lock super i/o configuration, clear 0x85_1
*/
@@ -2637,7 +2633,7 @@
}

/* if ECP not enabled, DMA is not enabled, assumed bogus 'dma' value */
- if (!have_eppecp)
+ if (mode != 0x01)
dma = PARPORT_DMA_NONE;

/* Let the user (or defaults) steer us away from interrupts and DMA */



----------------------------------
E-Mail: Duncan Haldane <f.duncan.m.haldane@xxxxxxxxxxxxxxxx>
Date: 11-Oct-2003
Time: 17:27:23

This message was sent by XFMail
----------------------------------

Attachment: README
Description: README

Attachment: parport_pc_superio_patch.tar.bz2
Description: parport_pc_superio_patch.tar.bz2